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;
@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");
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();
}
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;
protected MetadataRepository metadataRepository;
- protected ArchivaRepositoryRegistry repositoryRegistry;
-
@Inject
protected ApplicationContext applicationContext;
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 );
{
config = null;
repo = null;
- repositoryRegistry.destroy();
-
}
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+import org.springframework.test.context.TestContextManager;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException;
}
+ @Override
+ protected Statement withAfterClasses( final Statement statement )
+ {
+ final TestContextManager cm = getTestContextManager( );
+ return new Statement( )
+ {
+ @Override
+ public void evaluate( ) throws Throwable
+ {
+ statement.evaluate();
+ cm.getTestContext( ).markApplicationContextDirty( null );
+ }
+ };
+ }
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import static org.assertj.core.api.Assertions.assertThat;
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} )
public abstract class AbstractMetadataRepositoryTest
extends TestCase
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.jcr.ImportUUIDBehavior;
import javax.jcr.Node;
import java.util.Map;
import java.util.zip.GZIPInputStream;
-@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
public class JcrRepositoryStatisticsGatheringTest
extends TestCase