aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-02-22 21:09:56 +0100
committerMartin Stockhammer <martin_s@apache.org>2019-02-25 08:41:18 +0100
commit63154a6af822384907566f3998c7948d6d34eed8 (patch)
tree8e24842ad8d3887f6897b6ffb7efc2f62bb845d9
parent5681431abe7a7f3cd114c93efc655d341953c4ed (diff)
downloadarchiva-63154a6af822384907566f3998c7948d6d34eed8.tar.gz
archiva-63154a6af822384907566f3998c7948d6d34eed8.zip
Adding config file removal before tests
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
index 96d217d59..ba966399c 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java
@@ -27,12 +27,15 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.admin.model.proxyconnectorrule.ProxyConnectorRuleAdmin;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
+import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.redback.role.RoleManager;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.memory.SimpleUser;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
+import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,6 +44,10 @@ import org.springframework.test.context.ContextConfiguration;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -76,6 +83,23 @@ public abstract class AbstractRepositoryAdminTest
@Inject
protected ProxyConnectorRuleAdmin proxyConnectorRuleAdmin;
+ @Inject
+ private ArchivaConfiguration archivaConfiguration;
+
+ @Before
+ public void initialize() {
+ Path confFile = Paths.get(System.getProperty( "appserver.base" ), "conf/archiva.xml");
+ try
+ {
+ Files.deleteIfExists( confFile );
+ archivaConfiguration.reload();
+ }
+ catch ( IOException e )
+ {
+ // ignore
+ }
+ }
+
protected AuditInformation getFakeAuditInformation()
{
AuditInformation auditInformation = new AuditInformation( getFakeUser(), "archiva-localhost" );