use of org.jboss.pnc.common.json.moduleconfig.AuthenticationModuleConfig in project pnc by project-ncl.
the class ModuleConfigJsonTest method deserializationTest.
@Test
public void deserializationTest() throws IOException {
ObjectMapper mapper = new ObjectMapper();
PncConfigProvider<AuthenticationModuleConfig> pncProvider = new PncConfigProvider<>(AuthenticationModuleConfig.class);
pncProvider.registerProvider(mapper);
mapper.registerSubtypes(PNCModuleGroup.class);
ModuleConfigJson config = mapper.readValue(loadConfig("testConfigNoSpaces.json"), ModuleConfigJson.class);
assertNotNull(config);
assertEquals(1, config.getConfigs().size());
PNCModuleGroup group = (PNCModuleGroup) config.getConfigs().get(0);
assertEquals(2, group.getConfigs().size());
}
use of org.jboss.pnc.common.json.moduleconfig.AuthenticationModuleConfig in project pnc by project-ncl.
the class ModuleConfigJsonTest method serializationTest.
@Test
public void serializationTest() throws IOException {
ModuleConfigJson moduleConfigJson = new ModuleConfigJson("pnc-config");
JenkinsBuildDriverModuleConfig jenkinsBuildDriverModuleConfig = new JenkinsBuildDriverModuleConfig("user", "pass");
IndyRepoDriverModuleConfig indyRepoDriverModuleConfig = new IndyRepoDriverModuleConfig();
indyRepoDriverModuleConfig.setBuildRepositoryAllowSnapshots(true);
indyRepoDriverModuleConfig.setDefaultRequestTimeout(100);
List<String> ignoredPatternsMaven = new ArrayList<>(2);
ignoredPatternsMaven.add(".*/maven-metadata\\.xml$");
ignoredPatternsMaven.add(".*\\.sha1$");
IgnoredPatterns ignoredPatterns = new IgnoredPatterns();
ignoredPatterns.setMaven(ignoredPatternsMaven);
IgnoredPathPatterns ignoredPathPatterns = new IgnoredPathPatterns();
ignoredPathPatterns.setPromotion(ignoredPatterns);
indyRepoDriverModuleConfig.setIgnoredPathPatterns(ignoredPathPatterns);
PNCModuleGroup pncGroup = new PNCModuleGroup();
pncGroup.addConfig(jenkinsBuildDriverModuleConfig);
pncGroup.addConfig(indyRepoDriverModuleConfig);
moduleConfigJson.addConfig(pncGroup);
ObjectMapper mapper = new ObjectMapper();
PncConfigProvider<AuthenticationModuleConfig> pncProvider = new PncConfigProvider<>(AuthenticationModuleConfig.class);
pncProvider.registerProvider(mapper);
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
mapper.writeValue(byteOutStream, moduleConfigJson);
assertEquals(loadConfig("testConfigNoSpaces.json"), byteOutStream.toString());
}
Aggregations