use of org.jboss.pnc.dto.BuildConfiguration in project bacon by project-ncl.
the class BuildConfigMappingTest method testBuildCategorySet.
@Test
void testBuildCategorySet() {
Map<String, String> parameters = new HashMap<>();
parameters.put("BUILD_CATEGORY", "SERVICE");
BuildConfiguration buildConfiguration = BuildConfiguration.builder().parameters(parameters).build();
BuildConfigMapping.setBuildConfigFieldsBasedOnParameters(buildConfiguration, buildConfig);
assertEquals("SERVICE", buildConfig.getBuildCategory());
// make sure no other parameters are set
assertTrue(buildConfig.getAlignmentParameters().size() == 0);
assertNull(buildConfig.getBuildPodMemory());
assertNull(buildConfig.getPigYamlMetadata());
assertNull(buildConfig.getBrewBuildName());
assertTrue(buildConfig.getExtraRepositories().size() == 0);
}
use of org.jboss.pnc.dto.BuildConfiguration in project bacon by project-ncl.
the class BuildConfigMappingTest method testExtraRepositoriesSet.
@Test
void testExtraRepositoriesSet() {
Map<String, String> parameters = new HashMap<>();
parameters.put("EXTRA_REPOSITORIES", "hello\nworld");
BuildConfiguration buildConfiguration = BuildConfiguration.builder().parameters(parameters).build();
BuildConfigMapping.setBuildConfigFieldsBasedOnParameters(buildConfiguration, buildConfig);
assertTrue(buildConfig.getExtraRepositories().contains("hello"));
assertTrue(buildConfig.getExtraRepositories().contains("world"));
assertTrue(buildConfig.getExtraRepositories().size() == 2);
// make sure no other parameters are set
assertTrue(buildConfig.getAlignmentParameters().size() == 0);
assertNull(buildConfig.getBuildPodMemory());
assertNull(buildConfig.getBuildCategory());
assertNull(buildConfig.getPigYamlMetadata());
assertNull(buildConfig.getBrewBuildName());
}
use of org.jboss.pnc.dto.BuildConfiguration in project bacon by project-ncl.
the class BuildConfigMappingTest method testEntireMapping.
@Test
void testEntireMapping() {
EasyRandom easyRandom = new EasyRandom();
BuildConfiguration buildConfiguration = easyRandom.nextObject(BuildConfiguration.class);
BuildConfig bc = BuildConfigMapping.toBuildConfig(buildConfiguration);
assertEquals(buildConfiguration.getName(), bc.getName());
assertEquals(buildConfiguration.getProject().getName(), bc.getProject());
assertEquals(buildConfiguration.getBuildScript(), bc.getBuildScript());
assertEquals(buildConfiguration.getScmRepository().getExternalUrl(), bc.getScmUrl());
assertEquals(buildConfiguration.getScmRevision(), bc.getScmRevision());
assertEquals(buildConfiguration.getDescription(), bc.getDescription());
assertEquals(buildConfiguration.getEnvironment().getSystemImageId(), bc.getSystemImageId());
assertEquals(buildConfiguration.getDependencies().keySet(), new HashSet(bc.getDependencies()));
assertEquals(buildConfiguration.getBrewPullActive(), bc.getBrewPullActive());
assertEquals(buildConfiguration.getBuildType().toString(), bc.getBuildType());
}
use of org.jboss.pnc.dto.BuildConfiguration in project bacon by project-ncl.
the class BuildConfigMappingTest method testBrewBuildNameSet.
@Test
void testBrewBuildNameSet() {
Map<String, String> parameters = new HashMap<>();
parameters.put("BREW_BUILD_NAME", "testme");
BuildConfiguration buildConfiguration = BuildConfiguration.builder().parameters(parameters).build();
BuildConfigMapping.setBuildConfigFieldsBasedOnParameters(buildConfiguration, buildConfig);
assertEquals("testme", buildConfig.getBrewBuildName());
// make sure no other parameters are set
assertTrue(buildConfig.getAlignmentParameters().size() == 0);
assertNull(buildConfig.getBuildPodMemory());
assertNull(buildConfig.getBuildCategory());
assertNull(buildConfig.getPigYamlMetadata());
assertTrue(buildConfig.getExtraRepositories().size() == 0);
}
use of org.jboss.pnc.dto.BuildConfiguration in project pnc by project-ncl.
the class DeserializerTest method testDTOAsRefDeserialization2.
@Test
public void testDTOAsRefDeserialization2() throws IOException {
String json = "{" + " \"name\":\"mtest190826\"," + " \"environment\":{" + " \"id\":8," + " \"name\":\"OpenJDK 1.8.0; Mvn 3.5.2\"," + " \"description\":\"OpenJDK 1.8.0; Mvn 3.5.2\"," + " \"systemImageRepositoryUrl\":\"docker-registry-default.cloud.registry.upshift.redhat.com\"," + " \"systemImageId\":\"newcastle/builder-rhel-7-j8-mvn3.5.2:latest\"," + " \"attributes\":{" + " \"JDK\":\"1.8.0\"," + " \"MAVEN\":\"3.5.2\"," + " \"OS\":\"Linux\"" + " }," + " \"systemImageType\":\"DOCKER_IMAGE\"," + " \"deprecated\":false" + " }," + " \"buildType\":\"MVN\"," + " \"buildScript\":\"mvn clean deploy\"," + " \"parameters\":{ }," + " \"dependencies\":{}," + " \"scmRevision\":\"master\"," + " \"project\":{" + " \"id\":122," + " \"name\":\"mtest180719\"," + " \"description\":null," + " \"issueTrackerUrl\":null," + " \"projectUrl\":null," + " \"buildConfigs\":{" + " \"134\": {" + " \"id\":134," + " \"name\":\"mtest1907252\"," + " \"description\":null," + " \"buildScript\":\"mvn clean deploy\"," + " \"scmRevision\":\"master\"," + " \"creationTime\":\"2019-07-25T09:32:44.206Z\"," + " \"modificationTime\":\"2019-08-14T11:37:51.355Z\"," + " \"archived\":false," + " \"buildType\":\"MVN\"" + " }" + " }" + " }," + " \"groupConfigs\":{}" + " }";
ObjectMapper mapper = provider.getContext(null);
BuildConfiguration obj = mapper.readValue(json, BuildConfiguration.class);
}
Aggregations