Tests sort of working

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-with-new-repoapi@744006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James William Dumay 2009-02-13 06:19:18 +00:00
parent 48c5d9bc92
commit a2c354d30e
14 changed files with 606 additions and 935 deletions

View File

@ -41,6 +41,11 @@
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-layer</artifactId> <artifactId>archiva-repository-layer</artifactId>

View File

@ -29,7 +29,6 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.web.servlet.RepositoryServlet;
import org.codehaus.plexus.spring.PlexusInSpringTestCase; import org.codehaus.plexus.spring.PlexusInSpringTestCase;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -76,12 +75,12 @@ public abstract class AbstractRepositoryServletTestCase
protected void assertRepositoryValid( RepositoryServlet servlet, String repoId ) protected void assertRepositoryValid( RepositoryServlet servlet, String repoId )
{ {
ManagedRepositoryConfiguration repository = servlet.getRepository( repoId ); // ManagedRepositoryConfiguration repository = servlet.getRepository( repoId );
assertNotNull( "Archiva Managed Repository id:<" + repoId + "> should exist.", repository ); // assertNotNull( "Archiva Managed Repository id:<" + repoId + "> should exist.", repository );
File repoRoot = new File( repository.getLocation() ); // File repoRoot = new File( repository.getLocation() );
assertTrue( "Archiva Managed Repository id:<" + repoId + "> should have a valid location on disk.", repoRoot // assertTrue( "Archiva Managed Repository id:<" + repoId + "> should have a valid location on disk.", repoRoot
.exists() // .exists()
&& repoRoot.isDirectory() ); // && repoRoot.isDirectory() );
} }
protected void assertResponseOK( WebResponse response ) protected void assertResponseOK( WebResponse response )
@ -144,6 +143,7 @@ public abstract class AbstractRepositoryServletTestCase
archivaConfiguration.save( archivaConfiguration.getConfiguration() ); archivaConfiguration.save( archivaConfiguration.getConfiguration() );
} }
@Override
protected void setUp() protected void setUp()
throws Exception throws Exception
{ {
@ -175,7 +175,7 @@ public abstract class AbstractRepositoryServletTestCase
@Override @Override
protected String getPlexusConfigLocation() protected String getPlexusConfigLocation()
{ {
return "org/apache/maven/archiva/webdav/RepositoryServletTest.xml"; return "org/apache/archiva/web/servlet/RepositoryServletTest.xml";
} }
@Override @Override

View File

@ -51,49 +51,49 @@ public class RepositoryServletTest
assertRepositoryValid( servlet, REPOID_INTERNAL ); assertRepositoryValid( servlet, REPOID_INTERNAL );
} }
//
public void testGetRepositoryAfterDelete() // public void testGetRepositoryAfterDelete()
throws Exception // throws Exception
{ // {
RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet(); // RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet ); // assertNotNull( servlet );
//
ArchivaConfiguration archivaConfiguration = servlet.getConfiguration(); // ArchivaConfiguration archivaConfiguration = servlet.getConfiguration();
Configuration c = archivaConfiguration.getConfiguration(); // Configuration c = archivaConfiguration.getConfiguration();
c.removeManagedRepository( c.findManagedRepositoryById( REPOID_INTERNAL ) ); // c.removeManagedRepository( c.findManagedRepositoryById( REPOID_INTERNAL ) );
saveConfiguration( archivaConfiguration ); // saveConfiguration( archivaConfiguration );
//
ManagedRepositoryConfiguration repository = servlet.getRepository( REPOID_INTERNAL ); // ManagedRepositoryConfiguration repository = servlet.getRepository( REPOID_INTERNAL );
assertNull( repository ); // assertNull( repository );
} // }
//
public void testGetRepositoryAfterAdd() // public void testGetRepositoryAfterAdd()
throws Exception // throws Exception
{ // {
RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet(); // RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet ); // assertNotNull( servlet );
//
ArchivaConfiguration archivaConfiguration = servlet.getConfiguration(); // ArchivaConfiguration archivaConfiguration = servlet.getConfiguration();
Configuration c = archivaConfiguration.getConfiguration(); // Configuration c = archivaConfiguration.getConfiguration();
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); // ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
repo.setId( NEW_REPOSITORY_ID ); // repo.setId( NEW_REPOSITORY_ID );
repo.setName( NEW_REPOSITORY_NAME ); // repo.setName( NEW_REPOSITORY_NAME );
File repoRoot = new File( getBasedir(), "target/test-repository-root" ); // File repoRoot = new File( getBasedir(), "target/test-repository-root" );
if ( !repoRoot.exists() ) // if ( !repoRoot.exists() )
{ // {
repoRoot.mkdirs(); // repoRoot.mkdirs();
} // }
repo.setLocation( repoRoot.getAbsolutePath() ); // repo.setLocation( repoRoot.getAbsolutePath() );
c.addManagedRepository( repo ); // c.addManagedRepository( repo );
saveConfiguration( archivaConfiguration ); // saveConfiguration( archivaConfiguration );
//
ManagedRepositoryConfiguration repository = servlet.getRepository( NEW_REPOSITORY_ID ); // ManagedRepositoryConfiguration repository = servlet.getRepository( NEW_REPOSITORY_ID );
assertNotNull( repository ); // assertNotNull( repository );
assertEquals( NEW_REPOSITORY_NAME, repository.getName() ); // assertEquals( NEW_REPOSITORY_NAME, repository.getName() );
//
// check other is still intact // // check other is still intact
assertRepositoryValid( servlet, REPOID_INTERNAL ); // assertRepositoryValid( servlet, REPOID_INTERNAL );
} // }
public void testGetRepositoryInvalidPathPassthroughPresent() public void testGetRepositoryInvalidPathPassthroughPresent()
throws Exception throws Exception

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ 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.
-->
<component-set>
<components>
<!-- Components that are common for all test cases -->
<component>
<role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
<implementation>org.apache.maven.archiva.webdav.util.MimeTypes</implementation>
<description>MimeTypes</description>
<configuration>
<resource>archiva-mime-types.txt</resource>
</configuration>
</component>
</components>
</component-set>

View File

@ -38,7 +38,7 @@
<param-value> <param-value>
classpath*:/META-INF/plexus/components.xml classpath*:/META-INF/plexus/components.xml
classpath*:/META-INF/spring-context.xml classpath*:/META-INF/spring-context.xml
target/test-classes/org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml target/test-classes/org/apache/archiva/web/servlet/RepositoryServletSecurityTest.xml
</param-value> </param-value>
</context-param> </context-param>

View File

@ -38,7 +38,7 @@
<param-value> <param-value>
classpath*:/META-INF/plexus/components.xml classpath*:/META-INF/plexus/components.xml
classpath*:/META-INF/spring-context.xml classpath*:/META-INF/spring-context.xml
target/test-classes/org/apache/maven/archiva/webdav/RepositoryServletTest.xml target/test-classes/org/apache/archiva/web/servlet/RepositoryServletTest.xml
</param-value> </param-value>
</context-param> </context-param>

View File

@ -62,20 +62,7 @@
</properties> </properties>
</configuration> </configuration>
</component> </component>
<component>
<role>org.apache.maven.archiva.webdav.DavServerManager</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
<description>DefaultDavServerManager</description>
<requirements>
<requirement>
<role>org.apache.maven.archiva.webdav.DavServerComponent</role>
<role-hint>proxied</role-hint>
</requirement>
</requirements>
</component>
<component> <component>
<role>org.codehaus.plexus.cache.Cache</role> <role>org.codehaus.plexus.cache.Cache</role>
<role-hint>url-failures-cache</role-hint> <role-hint>url-failures-cache</role-hint>
@ -101,68 +88,6 @@
<role>org.codehaus.plexus.redback.system.SecuritySystem</role> <role>org.codehaus.plexus.redback.system.SecuritySystem</role>
<role-hint>default</role-hint> <role-hint>default</role-hint>
<implementation>org.codehaus.plexus.redback.system.DefaultSecuritySystem</implementation> <implementation>org.codehaus.plexus.redback.system.DefaultSecuritySystem</implementation>
</component>
<component>
<role>org.apache.maven.archiva.webdav.ArchivaDavResourceFactory</role>
<implementation>org.apache.maven.archiva.webdav.ArchivaDavResourceFactory</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<field-name>archivaConfiguration</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role>
<field-name>repositoryFactory</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.content.RepositoryRequest</role>
<field-name>repositoryRequest</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.proxy.RepositoryProxyConnectors</role>
<field-name>connectors</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
<field-name>metadataTools</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.security.ServletAuthenticator</role>
<field-name>servletAuth</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
<field-name>mimeTypes</field-name>
</requirement>
<requirement>
<role>org.codehaus.plexus.redback.xwork.filter.authentication.HttpAuthenticator</role>
<role-hint>basic</role-hint>
<field-name>httpAuth</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.codehaus.plexus.digest.ChecksumFile</role>
<field-name>checksum</field-name>
</requirement>
<requirement>
<role>org.codehaus.plexus.digest.Digester</role>
<role-hint>sha1</role-hint>
<field-name>digestSha1</field-name>
</requirement>
<requirement>
<role>org.codehaus.plexus.digest.Digester</role>
<role-hint>md5</role-hint>
<field-name>digestMd5</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.security.ArchivaXworkUser</role>
<field-name>archivaXworkUser</field-name>
</requirement>
</requirements>
</component> </component>
</components> </components>
</plexus> </plexus>

View File

@ -63,19 +63,6 @@
</configuration> </configuration>
</component> </component>
<component>
<role>org.apache.maven.archiva.webdav.DavServerManager</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
<description>DefaultDavServerManager</description>
<requirements>
<requirement>
<role>org.apache.maven.archiva.webdav.DavServerComponent</role>
<role-hint>proxied</role-hint>
</requirement>
</requirements>
</component>
<component> <component>
<role>org.codehaus.plexus.cache.Cache</role> <role>org.codehaus.plexus.cache.Cache</role>
<role-hint>url-failures-cache</role-hint> <role-hint>url-failures-cache</role-hint>
@ -102,67 +89,6 @@
<role-hint>default</role-hint> <role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.webdav.BypassSecuritySystem</implementation> <implementation>org.apache.maven.archiva.webdav.BypassSecuritySystem</implementation>
</component> </component>
<component>
<role>org.apache.maven.archiva.webdav.ArchivaDavResourceFactory</role>
<implementation>org.apache.maven.archiva.webdav.UnauthenticatedDavResourceFactory</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<field-name>archivaConfiguration</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role>
<field-name>repositoryFactory</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.content.RepositoryRequest</role>
<field-name>repositoryRequest</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.proxy.RepositoryProxyConnectors</role>
<field-name>connectors</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
<field-name>metadataTools</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.security.ServletAuthenticator</role>
<field-name>servletAuth</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.webdav.util.MimeTypes</role>
<field-name>mimeTypes</field-name>
</requirement>
<requirement>
<role>org.codehaus.plexus.redback.struts2.filter.authentication.HttpAuthenticator</role>
<role-hint>basic</role-hint>
<field-name>httpAuth</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.codehaus.plexus.digest.ChecksumFile</role>
<field-name>checksum</field-name>
</requirement>
<requirement>
<role>org.codehaus.plexus.digest.Digester</role>
<role-hint>sha1</role-hint>
<field-name>digestSha1</field-name>
</requirement>
<requirement>
<role>org.codehaus.plexus.digest.Digester</role>
<role-hint>md5</role-hint>
<field-name>digestMd5</field-name>
</requirement>
<requirement>
<role>org.apache.maven.archiva.security.ArchivaXworkUser</role>
<field-name>archivaXworkUser</field-name>
</requirement>
</requirements>
</component>
</components> </components>
</plexus> </plexus>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" ?>
<!--
~ 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.
-->
<plexus>
<components>
<component>
<role>org.apache.maven.archiva.webdav.DavServerManager</role>
<role-hint>simple</role-hint>
<implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
<description>DefaultDavServerManager</description>
<requirements>
<requirement>
<role>org.apache.maven.archiva.webdav.DavServerComponent</role>
<role-hint>simple</role-hint>
</requirement>
</requirements>
</component>
</components>
</plexus>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" ?>
<!--
~ 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.
-->
<plexus>
<components>
<component>
<role>org.apache.maven.archiva.webdav.DavServerManager</role>
<role-hint>simple</role-hint>
<implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
<description>DefaultDavServerManager</description>
<requirements>
<requirement>
<role>org.apache.maven.archiva.webdav.DavServerComponent</role>
<role-hint>simple</role-hint>
</requirement>
</requirements>
</component>
</components>
</plexus>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" ?>
<!--
~ 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.
-->
<plexus>
<components>
<component>
<role>org.apache.maven.archiva.webdav.DavServerManager</role>
<role-hint>simple</role-hint>
<implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
<description>DefaultDavServerManager</description>
<requirements>
<requirement>
<role>org.apache.maven.archiva.webdav.DavServerComponent</role>
<role-hint>simple</role-hint>
</requirement>
</requirements>
</component>
</components>
</plexus>

View File

@ -1,38 +0,0 @@
<?xml version="1.0" ?>
<!--
~ 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.
-->
<plexus>
<components>
<component>
<role>org.apache.maven.archiva.webdav.DavServerManager</role>
<role-hint>simple</role-hint>
<implementation>org.apache.maven.archiva.webdav.DefaultDavServerManager</implementation>
<description>DefaultDavServerManager</description>
<requirements>
<requirement>
<role>org.apache.maven.archiva.webdav.DavServerComponent</role>
<role-hint>simple</role-hint>
</requirement>
</requirements>
</component>
</components>
</plexus>