You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/07/16 20:38:16 UTC

svn commit: r794773 - /maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java

Author: jvanzyl
Date: Thu Jul 16 18:38:16 2009
New Revision: 794773

URL: http://svn.apache.org/viewvc?rev=794773&view=rev
Log:
o just making sure the auth bits passed into find their way to be an Authentication object associated with the repository

Modified:
    maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java

Modified: maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java?rev=794773&r1=794772&r2=794773&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java (original)
+++ maven/components/trunk/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java Thu Jul 16 18:38:16 2009
@@ -1,27 +1,24 @@
 package org.apache.maven.repository.legacy;
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
  */
 
 import java.io.File;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.Authentication;
 import org.apache.maven.repository.LegacyRepositorySystem;
 import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.PlexusTestCase;
@@ -35,7 +32,7 @@
     extends PlexusTestCase
 {
 
-    private RepositorySystem repoSystem;
+    private RepositorySystem repositorySystem;
 
     @Override
     protected void setUp()
@@ -43,14 +40,14 @@
     {
         super.setUp();
 
-        repoSystem = lookup( RepositorySystem.class, "default" );
+        repositorySystem = lookup( RepositorySystem.class, "default" );
     }
 
     @Override
     protected void tearDown()
         throws Exception
     {
-        repoSystem = null;
+        repositorySystem = null;
 
         super.tearDown();
     }
@@ -59,9 +56,19 @@
         throws Exception
     {
         File basedir = new File( "target/spacy path" ).getAbsoluteFile();
-        ArtifactRepository repo = repoSystem.createLocalRepository( basedir );
+        ArtifactRepository repo = repositorySystem.createLocalRepository( basedir );
 
         assertEquals( basedir, new File( repo.getBasedir() ) );
     }
 
+    public void testAuthenticationHandling()
+        throws Exception
+    {
+        repositorySystem.addAuthenticationForArtifactRepository( "repository", "jason", "abc123" );
+        ArtifactRepository repository = repositorySystem.createArtifactRepository( "repository", "http://foo", null, null, null );
+        Authentication authentication = repository.getAuthentication();
+        assertNotNull( authentication );
+        assertEquals( "jason", authentication.getUsername() );
+        assertEquals( "abc123", authentication.getPassword() );
+    }
 }