mirror of https://github.com/apache/maven.git
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:
parent
1ceae0f25e
commit
3bcaf7ac83
|
@ -1,27 +1,24 @@
|
||||||
package org.apache.maven.repository.legacy;
|
package org.apache.maven.repository.legacy;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||||
* distributed with this work for additional information
|
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||||
* to you under the Apache License, Version 2.0 (the
|
* copy of the License at
|
||||||
* "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
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* or implied. See the License for the specific language governing permissions and limitations under
|
||||||
* software distributed under the License is distributed on an
|
* the License.
|
||||||
* "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 java.io.File;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.LegacyRepositorySystem;
|
||||||
import org.apache.maven.repository.RepositorySystem;
|
import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
|
@ -35,7 +32,7 @@ public class LegacyRepositorySystemTest
|
||||||
extends PlexusTestCase
|
extends PlexusTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private RepositorySystem repoSystem;
|
private RepositorySystem repositorySystem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
|
@ -43,14 +40,14 @@ public class LegacyRepositorySystemTest
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
repoSystem = lookup( RepositorySystem.class, "default" );
|
repositorySystem = lookup( RepositorySystem.class, "default" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown()
|
protected void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
repoSystem = null;
|
repositorySystem = null;
|
||||||
|
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
@ -59,9 +56,19 @@ public class LegacyRepositorySystemTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File basedir = new File( "target/spacy path" ).getAbsoluteFile();
|
File basedir = new File( "target/spacy path" ).getAbsoluteFile();
|
||||||
ArtifactRepository repo = repoSystem.createLocalRepository( basedir );
|
ArtifactRepository repo = repositorySystem.createLocalRepository( basedir );
|
||||||
|
|
||||||
assertEquals( basedir, new File( repo.getBasedir() ) );
|
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() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue