o just making sure the auth bits passed into find their way to be an Authentication object associated with the repository

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@794773 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-07-16 18:38:16 +00:00
parent 1ceae0f25e
commit 3bcaf7ac83
1 changed files with 27 additions and 20 deletions

View File

@ -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 @@ public class LegacyRepositorySystemTest
extends PlexusTestCase
{
private RepositorySystem repoSystem;
private RepositorySystem repositorySystem;
@Override
protected void setUp()
@ -43,14 +40,14 @@ public class LegacyRepositorySystemTest
{
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 @@ public class LegacyRepositorySystemTest
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() );
}
}