aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2021-01-27 22:17:34 +0100
committerMartin Stockhammer <martin_s@apache.org>2021-01-27 22:17:34 +0100
commit8fa8083ef91f7a53ea7257b880326550b122e062 (patch)
tree30ffb00c2d172d11888bc333f4cdae2c2e2e11d2 /archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers
parentb32d75a85b4f5805d6d251ea2237f838087aa2bf (diff)
downloadarchiva-8fa8083ef91f7a53ea7257b880326550b122e062.tar.gz
archiva-8fa8083ef91f7a53ea7257b880326550b122e062.zip
Making application context dirty after each test class run
Diffstat (limited to 'archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java14
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java7
2 files changed, 3 insertions, 18 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
index 0ff779ffe..e0197f19c 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java
@@ -33,6 +33,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import javax.inject.Inject;
@@ -55,15 +56,12 @@ public abstract class AbstractArtifactConsumerTest
@Inject
ArchivaConfiguration archivaConfiguration;
- ArchivaRepositoryRegistry repositoryRegistry;
-
-
@Before
public void setUp()
throws Exception
{
FileType fileType =
- (FileType) archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get( 0 );
+ archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get( 0 );
assertEquals( FileTypes.ARTIFACTS, fileType.getId() );
fileType.addPattern( "**/*.xml" );
archivaConfiguration.getConfiguration().getArchivaRuntimeConfiguration().addChecksumType("MD5");
@@ -71,14 +69,6 @@ public abstract class AbstractArtifactConsumerTest
archivaConfiguration.getConfiguration().getArchivaRuntimeConfiguration().addChecksumType("SHA256");
repoLocation = Paths.get( "target/test-" + getName() + "/test-repo" );
-
- repositoryRegistry = applicationContext.getBean( "repositoryRegistry", ArchivaRepositoryRegistry.class );
- assertNotNull( repositoryRegistry );
- }
-
- @After
- public void destroy() {
- repositoryRegistry.destroy();
}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
index 2f906a586..f1791b7d0 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
@@ -42,6 +42,7 @@ import org.junit.Before;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import javax.inject.Inject;
@@ -109,8 +110,6 @@ public abstract class AbstractRepositoryPurgeTest
protected MetadataRepository metadataRepository;
- protected ArchivaRepositoryRegistry repositoryRegistry;
-
@Inject
protected ApplicationContext applicationContext;
@@ -130,8 +129,6 @@ public abstract class AbstractRepositoryPurgeTest
repositorySession = sessionControl.createMock( RepositorySession.class );
metadataRepository = mock( MetadataRepository.class );
sessionFactory = sessionFactoryControl.createMock( RepositorySessionFactory.class );
- repositoryRegistry = applicationContext.getBean( "repositoryRegistry", ArchivaRepositoryRegistry.class );
- assertNotNull( repositoryRegistry );
EasyMock.expect( repositorySession.getRepository() ).andStubReturn( metadataRepository );
EasyMock.expect( sessionFactory.createSession( ) ).andStubReturn( repositorySession );
@@ -143,8 +140,6 @@ public abstract class AbstractRepositoryPurgeTest
{
config = null;
repo = null;
- repositoryRegistry.destroy();
-
}