package org.jboss.pnc.mavenrepositorymanager;

import java.util.Properties;
import java.util.logging.Logger;

import org.commonjava.aprox.boot.BootStatus;
import org.commonjava.aprox.test.fixture.core.CoreServerFixture;
import org.jboss.pnc.common.Configuration;
import org.jboss.pnc.common.json.moduleconfig.MavenRepoDriverModuleConfig;
import org.jboss.pnc.model.BuildConfiguration;
import org.jboss.pnc.model.Product;
import org.jboss.pnc.model.ProductVersion;
import org.jboss.pnc.model.Project;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;

public class AbstractRepositoryManagerDriverTest {
    
    private static final Logger log = Logger.getLogger(AbstractRepositoryManagerDriverTest.class.getName());

    @Rule
    public TemporaryFolder temp = new TemporaryFolder();

    protected RepositoryManagerDriver driver;
    protected CoreServerFixture fixture;
    protected String url;

    @Before
    public void setup() throws Exception {
        fixture = new CoreServerFixture(temp);
        fixture.start();
        
        url = fixture.getUrl();
        if (!fixture.isStarted()) {
            final BootStatus status = fixture.getBootStatus();
            throw new IllegalStateException("server fixture failed to boot.", status.getError());
        }

        log.info("Using base URL: " + url);
        Configuration<MavenRepoDriverModuleConfig> config = new Configuration<>();
        driver = new RepositoryManagerDriver(config);
    }

    @After
    public void teardown() throws Exception {
        if (fixture != null) {
            fixture.stop();
        }
    }

    protected BuildConfiguration simpleBuildConfiguration() {
        Project project = new Project();
        project.setName("myproject");

        Product product = new Product();
        product.setName("myproduct");

        ProductVersion pv = new ProductVersion();
        pv.setProduct(product);
        pv.setVersion("1.0");

        BuildConfiguration pbc = new BuildConfiguration();
        pbc.setProject(project);
        pbc.setProductVersion(pv);

        return pbc;
    }

}

@@ -56,23 +56,15 @@
 ava.
-util.Properties
+io.File
 ;%0Aim
@@ -82,22 +82,18 @@
 til.
-logging.Logger
+Properties
 ;%0A%0Ai
@@ -236,32 +236,83 @@
 .Configuration;%0A
+import org.jboss.pnc.common.json.ModuleConfigJson;%0A
 import org.jboss
@@ -649,119 +649,74 @@
 r;%0A%0A
-public class AbstractRepositoryManagerDriverTest %7B%0A    %0A    private static final Logger log = Logger.getLogger(
+import com.fasterxml.jackson.databind.ObjectMapper;%0A%0Apublic class 
 Abst
@@ -750,26 +750,10 @@
 Test
-.class.getName());
+ %7B
 %0A%0A  
@@ -932,16 +932,44 @@
 g url;%0A%0A
+    private String oldIni;%0A%0A
     @Bef
@@ -1062,24 +1062,25 @@
 (temp);%0A
+%0A
         
 fixture.
@@ -1075,48 +1075,411 @@
     
-fixture.start();%0A        %0A        url = 
+Properties sysprops = System.getProperties();%0A        oldIni = sysprops.getProperty(Configuration.CONFIG_SYSPROP);%0A%0A        url = fixture.getUrl();%0A        File configFile = temp.newFile(%22pnc-config.json%22);%0A        ModuleConfigJson moduleConfigJson =  new ModuleConfigJson(%22pnc-config%22);%0A        MavenRepoDriverModuleConfig mavenRepoDriverModuleConfig = %0A                new MavenRepoDriverModuleConfig(
 fixt
@@ -1482,34 +1482,374 @@
 fixture.getUrl()
+)
 ;%0A
+        moduleConfigJson.addConfig(mavenRepoDriverModuleConfig);%0A        %0A        ObjectMapper mapper = new ObjectMapper();%0A        mapper.writeValue(configFile, moduleConfigJson);%0A%0A        sysprops.setProperty(Configuration.CONFIG_SYSPROP, configFile.getAbsolutePath());%0A        System.setProperties(sysprops);%0A%0A        fixture.start();%0A%0A
         if (!fix
@@ -2052,16 +2052,116 @@
     
-log.info
+Properties props = new Properties();%0A        props.setProperty(%22base.url%22, url);%0A%0A        System.out.println
 (%22Us
@@ -2184,16 +2184,17 @@
 + url);%0A
+%0A
         
@@ -2263,16 +2263,43 @@
 uration%3C
+MavenRepoDriverModuleConfig
 %3E();%0A   
@@ -2405,32 +2405,315 @@
 ows Exception %7B%0A
+        Properties sysprops = System.getProperties();%0A        if (oldIni == null) %7B%0A            sysprops.remove(Configuration.CONFIG_SYSPROP);%0A        %7D else %7B%0A            sysprops.setProperty(Configuration.CONFIG_SYSPROP, oldIni);%0A        %7D%0A        System.setProperties(sysprops);%0A%0A
         if (fixt
@@ -2766,26 +2766,24 @@
      %7D%0A    %7D
-%0A%0A
     protecte

Revert changes in AbstractRepositoryManagerDriverTest from commit 1514082288b089328638d1f79c20244d6b279d3d