View Javadoc

1   /**
2    * Copyright 2010-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.maven.wagon;
17  
18  import java.util.List;
19  
20  import org.apache.maven.wagon.authentication.AuthenticationInfo;
21  import org.apache.maven.wagon.repository.Repository;
22  
23  public class S3WagonTest {
24  	private static final String USERNAME = "AKIAJFD5IM7IPVVUEBNA";
25  	private static final String PASSWORD = System.getProperty("secret.key");
26  
27  	// private static final Logger log = LoggerFactory.getLogger(S3WagonTest.class);
28  
29  	// @Test
30  	public void testPermissions() {
31  		try {
32  			AuthenticationInfo auth = new AuthenticationInfo();
33  			auth.setUserName(USERNAME);
34  			auth.setPassword(PASSWORD);
35  			Repository repository = new Repository("kuali.release", "s3://deletemenow.kuali.org/release");
36  			S3Wagon wagon = new S3Wagon();
37  			wagon.connect(repository, auth);
38  		} catch (Exception e) {
39  			e.printStackTrace();
40  		}
41  	}
42  
43  	// @Test
44  	public void simple() {
45  		try {
46  			AuthenticationInfo auth = new AuthenticationInfo();
47  			auth.setUserName(USERNAME);
48  			auth.setPassword(PASSWORD);
49  			Repository repository = new Repository("kuali.release", "s3://maven.kuali.org/release");
50  			S3Wagon wagon = new S3Wagon();
51  			wagon.connect(repository, auth);
52  			List<String> files = wagon.getFileList("");
53  			System.out.println(files.size());
54  		} catch (Exception e) {
55  			e.printStackTrace();
56  		}
57  	}
58  
59  }