Search in sources :

Example 11 with Configuration

use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.

the class TermdBuildDriverModuleConfigTest method checkDefaultValuesSetProperly.

@Test
public void checkDefaultValuesSetProperly() throws ConfigurationParseException {
    String backupConfigPath = System.getProperty("pnc-config-file");
    System.setProperty("pnc-config-file", "testConfig.json");
    Configuration configuration = new Configuration();
    TermdBuildDriverModuleConfig termdBuildDriverModuleConfig = configuration.getModuleConfig(new PncConfigProvider<>(TermdBuildDriverModuleConfig.class));
    Assert.assertEquals(new Integer(5000), termdBuildDriverModuleConfig.getInternalCancelTimeoutMillis());
}
Also used : Configuration(org.jboss.pnc.common.Configuration) Test(org.junit.Test)

Example 12 with Configuration

use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.

the class AbstractRepositoryManagerDriverTest method setup.

@Before
public void setup() throws Exception {
    // workaround for NPE in Indy 1.6.2 client
    MDC.put("dummy", "non");
    fixture = newServerFixture();
    Properties sysprops = System.getProperties();
    oldIni = sysprops.getProperty(CONFIG_SYSPROP);
    url = fixture.getUrl();
    File configFile = temp.newFile("pnc-config.json");
    ModuleConfigJson moduleConfigJson = new ModuleConfigJson("pnc-config");
    IndyRepoDriverModuleConfig mavenRepoDriverModuleConfig = new IndyRepoDriverModuleConfig();
    mavenRepoDriverModuleConfig.setIgnoredRepoPatterns(getIgnoredRepoPatterns());
    mavenRepoDriverModuleConfig.setBrewPullActiveMetadataKey(BREW_PULL_ACTIVE_METADATA_KEY);
    preConfigureMavenRepositoryDriver(mavenRepoDriverModuleConfig);
    SystemConfig systemConfig = new SystemConfig("", "", "JAAS", "4", "4", "4", "", "5", null, null, "14", "", "10");
    GlobalModuleGroup globalConfig = new GlobalModuleGroup();
    globalConfig.setIndyUrl(fixture.getUrl());
    PNCModuleGroup pncGroup = new PNCModuleGroup();
    pncGroup.addConfig(mavenRepoDriverModuleConfig);
    pncGroup.addConfig(systemConfig);
    moduleConfigJson.addConfig(globalConfig);
    moduleConfigJson.addConfig(pncGroup);
    ObjectMapper mapper = new ObjectMapper();
    PncConfigProvider<IndyRepoDriverModuleConfig> pncProvider = new PncConfigProvider<>(IndyRepoDriverModuleConfig.class);
    pncProvider.registerProvider(mapper);
    mapper.writeValue(configFile, moduleConfigJson);
    sysprops.setProperty(CONFIG_SYSPROP, configFile.getAbsolutePath());
    System.setProperties(sysprops);
    fixture.start();
    if (!fixture.isStarted()) {
        final BootStatus status = fixture.getBootStatus();
        throw new IllegalStateException("server fixture failed to boot.", status.getError());
    }
    Properties props = new Properties();
    props.setProperty("base.url", url);
    System.out.println("Using base URL: " + url);
    Configuration config = new Configuration();
    BuildRecordRepositoryMock bcRepository = new BuildRecordRepositoryMock();
    driver = new RepositoryManagerDriver(config, bcRepository);
}
Also used : SystemConfig(org.jboss.pnc.common.json.moduleconfig.SystemConfig) IndyRepoDriverModuleConfig(org.jboss.pnc.common.json.moduleconfig.IndyRepoDriverModuleConfig) Configuration(org.jboss.pnc.common.Configuration) BuildRecordRepositoryMock(org.jboss.pnc.mock.repository.BuildRecordRepositoryMock) ModuleConfigJson(org.jboss.pnc.common.json.ModuleConfigJson) BootStatus(org.commonjava.propulsor.boot.BootStatus) PncConfigProvider(org.jboss.pnc.common.json.moduleprovider.PncConfigProvider) Properties(java.util.Properties) GlobalModuleGroup(org.jboss.pnc.common.json.GlobalModuleGroup) PNCModuleGroup(org.jboss.pnc.common.json.PNCModuleGroup) File(java.io.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Aggregations

Configuration (org.jboss.pnc.common.Configuration)12 Test (org.junit.Test)10 BuildDriverFactory (org.jboss.pnc.executor.servicefactories.BuildDriverFactory)5 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)4 HashSet (java.util.HashSet)3 Set (java.util.Set)3 TimeoutException (java.util.concurrent.TimeoutException)3 Consumer (java.util.function.Consumer)3 Inject (javax.inject.Inject)3 Deployment (org.jboss.arquillian.container.test.api.Deployment)3 Arquillian (org.jboss.arquillian.junit.Arquillian)3 ConfigurationParseException (org.jboss.pnc.common.json.ConfigurationParseException)3 ObjectWrapper (org.jboss.pnc.common.util.ObjectWrapper)3 BuildExecutionStatus (org.jboss.pnc.enums.BuildExecutionStatus)3 EnvironmentDriverFactory (org.jboss.pnc.executor.servicefactories.EnvironmentDriverFactory)3 RepositoryManagerFactory (org.jboss.pnc.executor.servicefactories.RepositoryManagerFactory)3 TestProjectConfigurationBuilder (org.jboss.pnc.mock.model.builders.TestProjectConfigurationBuilder)3 BuildResult (org.jboss.pnc.spi.BuildResult)3 BuildExecutionStatusChangedEvent (org.jboss.pnc.spi.events.BuildExecutionStatusChangedEvent)3 ExecutorException (org.jboss.pnc.spi.executor.exceptions.ExecutorException)3