use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.
the class EarlyCancellationTest method testBuild.
private void testBuild(BuildExecutionStatus cancelAfter, BuildExecutionStatus[] expectedStatuses, BuildExecutionStatus[] unexpectedStatuses) throws ExecutorException, TimeoutException, InterruptedException, BuildDriverException, ConfigurationParseException {
BuildConfiguration buildConfiguration = configurationBuilder.build(1, "c1-java");
Set<BuildExecutionStatusChangedEvent> statusChangedEvents = new HashSet<>();
ObjectWrapper<BuildResult> buildExecutionResultWrapper = new ObjectWrapper<>();
DefaultBuildExecutor executor = new DefaultBuildExecutor(repositoryManagerFactory, buildDriverFactory, environmentDriverFactory, new Configuration(), null);
Consumer<BuildExecutionStatusChangedEvent> cancel = (e) -> {
if (cancelAfter.equals(e.getNewStatus())) {
try {
log.info("Cancelling build ...");
executor.cancel("1");
} catch (ExecutorException e0) {
e0.printStackTrace();
}
}
};
runBuild(buildConfiguration, statusChangedEvents, buildExecutionResultWrapper, cancel, executor);
// check build statuses
checkBuildStatuses(statusChangedEvents, Arrays.asList(expectedStatuses));
buildStatusesShouldNotContain(statusChangedEvents, Arrays.asList(unexpectedStatuses));
}
use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.
the class BuildDriverFactoryTest method shouldPickProperDriver.
@Test
public void shouldPickProperDriver() throws Exception {
// given
ProperDriver testedBuildDriver = new ProperDriver();
TestInstance<BuildDriver> allDrivers = new TestInstance<>(testedBuildDriver);
Configuration configuration = mock(Configuration.class);
BuildDriverFactory factory = new BuildDriverFactory(allDrivers, configuration);
// when
BuildDriver buildDriver = factory.getBuildDriver();
// then
assertThat(buildDriver).isEqualTo(testedBuildDriver);
}
use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.
the class GlobalConfigTest method loadGlobalConfigTest.
@Test
public void loadGlobalConfigTest() throws ConfigurationParseException {
Configuration configuration = new Configuration();
GlobalModuleGroup globalConfig = configuration.getGlobalConfig();
assertNotNull(globalConfig);
assertEquals("http://127.0.0.1:8001", globalConfig.getBpmUrl());
assertEquals("http://127.0.0.1:8002", globalConfig.getCartographerUrl());
assertEquals("http://127.0.0.1:8003", globalConfig.getDaUrl());
assertEquals("http://127.0.0.1:8004", globalConfig.getIndyUrl());
assertEquals("http://127.0.0.1:8005", globalConfig.getPncUrl());
assertEquals("http://127.0.0.1:8006", globalConfig.getRepourUrl());
assertEquals("http://127.0.0.1:8007", globalConfig.getDelAnalUrl());
assertEquals("http://1.2.3.4", globalConfig.getExternalBifrostUrl());
assertEquals("http://1.2.3.5", globalConfig.getExternalDaUrl());
assertEquals("http://1.2.3.6", globalConfig.getExternalCausewayUrl());
assertEquals("http://1.2.3.7", globalConfig.getExternalIndyUrl());
assertEquals("http://1.2.3.8", globalConfig.getExternalKafkaStoreUrl());
assertEquals("http://1.2.3.9", globalConfig.getExternalPncUrl());
assertEquals("http://1.2.3.10", globalConfig.getExternalRepourUrl());
}
use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.
the class IndyRepoDriverModuleConfigTest method loadIndyRepoDriverConfigTest.
@Test
public void loadIndyRepoDriverConfigTest() throws ConfigurationParseException {
Configuration configuration = new Configuration();
IndyRepoDriverModuleConfig indyDriverConfig = configuration.getModuleConfig(new PncConfigProvider<>(IndyRepoDriverModuleConfig.class));
assertNotNull(indyDriverConfig);
assertEquals(100, indyDriverConfig.getDefaultRequestTimeout().intValue());
assertTrue(indyDriverConfig.getBuildRepositoryAllowSnapshots().booleanValue());
assertEquals(0, indyDriverConfig.getIgnoredPathPatterns().getData().getMaven().getPatterns().size());
assertEquals(0, indyDriverConfig.getIgnoredPathPatterns().getData().getNpm().getPatterns().size());
assertEquals(0, indyDriverConfig.getIgnoredPathPatterns().getPromotion().getNpm().getPatterns().size());
List<Pattern> ignoredPathPatternsMaven = indyDriverConfig.getIgnoredPathPatterns().getPromotion().getMaven().getPatterns();
assertNotNull(ignoredPathPatternsMaven);
assertEquals(2, ignoredPathPatternsMaven.size());
List<String> strings = ignoredPathPatternsMaven.stream().map(Pattern::pattern).collect(Collectors.toList());
assertTrue(strings.contains(".*/maven-metadata\\.xml$"));
assertTrue(strings.contains(".*\\.sha1$"));
}
use of org.jboss.pnc.common.Configuration in project pnc by project-ncl.
the class JenkinsBuildDriverModuleConfigTest method loadJenkinsBuildDriverConfigTest.
@Test
public void loadJenkinsBuildDriverConfigTest() throws ConfigurationParseException {
Configuration configuration = new Configuration();
JenkinsBuildDriverModuleConfig jenkinsConfig = configuration.getModuleConfig(new PncConfigProvider<>(JenkinsBuildDriverModuleConfig.class));
assertNotNull(jenkinsConfig);
assertEquals("user", jenkinsConfig.getUsername());
assertEquals("pass", jenkinsConfig.getPassword());
}
Aggregations