use of org.jboss.pnc.common.json.moduleconfig.IndyRepoDriverModuleConfig 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());
}
use of org.jboss.pnc.common.json.moduleconfig.IndyRepoDriverModuleConfig 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);
}
use of org.jboss.pnc.common.json.moduleconfig.IndyRepoDriverModuleConfig in project pnc by project-ncl.
the class AbstractProviderTest method prepareMockInAbstract.
@Before
public void prepareMockInAbstract() throws ConfigurationParseException {
GlobalModuleGroup globalConfig = new GlobalModuleGroup();
globalConfig.setIndyUrl("http://url.com");
globalConfig.setExternalIndyUrl("http://url.com");
IndyRepoDriverModuleConfig indyRepoDriverModuleConfig = new IndyRepoDriverModuleConfig();
when(pageInfoProducer.getPageInfo(anyInt(), anyInt())).thenAnswer(this::withPageInfo);
}
Aggregations