Search in sources :

Example 6 with GlobalModuleGroup

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

the class UiConfigRestBuilder method build.

public static UiConfigRest build(Configuration configuration) throws ConfigurationParseException {
    GlobalModuleGroup globalConfig = configuration.getGlobalConfig();
    UIModuleConfig uiModuleConfig = configuration.getModuleConfig(new PncConfigProvider<>(UIModuleConfig.class));
    ScmModuleConfig scmModuleConfig = configuration.getModuleConfig(new PncConfigProvider<>(ScmModuleConfig.class));
    return new UiConfigRest(globalConfig, uiModuleConfig, scmModuleConfig.getInternalScmAuthority());
}
Also used : ScmModuleConfig(org.jboss.pnc.common.json.moduleconfig.ScmModuleConfig) GlobalModuleGroup(org.jboss.pnc.common.json.GlobalModuleGroup) UIModuleConfig(org.jboss.pnc.common.json.moduleconfig.UIModuleConfig)

Example 7 with GlobalModuleGroup

use of org.jboss.pnc.common.json.GlobalModuleGroup 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)

Example 8 with GlobalModuleGroup

use of org.jboss.pnc.common.json.GlobalModuleGroup 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);
}
Also used : IndyRepoDriverModuleConfig(org.jboss.pnc.common.json.moduleconfig.IndyRepoDriverModuleConfig) GlobalModuleGroup(org.jboss.pnc.common.json.GlobalModuleGroup) Before(org.junit.Before)

Example 9 with GlobalModuleGroup

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

the class RepositoryManagerResultSerializationTest method before.

@Before
public void before() throws Exception {
    GlobalModuleGroup globalConfig = new GlobalModuleGroup();
    globalConfig.setIndyUrl("http://url.com");
    globalConfig.setExternalIndyUrl("http://url.com");
    when(configuration.getGlobalConfig()).thenReturn(globalConfig);
    injectMethod("config", artifactMapper, configuration, AbstractArtifactMapper.class);
    injectMethod("targetRepositoryMapper", artifactMapper, targetRepositoryMapper, AbstractArtifactMapperImpl.class);
    injectMethod("buildMapper", artifactMapper, buildMapper, AbstractArtifactMapperImpl.class);
    injectMethod("userMapper", artifactMapper, userMapper, AbstractArtifactMapperImpl.class);
    injectMethod("refToReferenceMapper", artifactMapper, refMapper, AbstractArtifactMapperImpl.class);
    injectMethod("userMapper", refMapper, userMapper, RefToReferenceMapper.class);
    injectMethod("buildMapper", refMapper, buildMapper, RefToReferenceMapper.class);
    injectMethod("targetRepositoryMapper", refMapper, targetRepositoryMapper, RefToReferenceMapper.class);
}
Also used : GlobalModuleGroup(org.jboss.pnc.common.json.GlobalModuleGroup) Before(org.junit.Before)

Example 10 with GlobalModuleGroup

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

the class BuildResultSerializationTest method before.

@Before
public void before() throws Exception {
    GlobalModuleGroup globalConfig = new GlobalModuleGroup();
    globalConfig.setIndyUrl("http://url.com");
    globalConfig.setExternalIndyUrl("http://url.com");
    injectMethod("artifactMapper", repositoryManagerResultMapper, artifactMapper, RepositoryManagerResultMapper.class);
    injectMethod("config", artifactMapper, configuration, AbstractArtifactMapper.class);
    injectMethod("targetRepositoryMapper", artifactMapper, targetRepositoryMapper, AbstractArtifactMapperImpl.class);
    injectMethod("buildMapper", artifactMapper, buildMapper, AbstractArtifactMapperImpl.class);
    injectMethod("userMapper", artifactMapper, userMapper, AbstractArtifactMapperImpl.class);
    injectMethod("refToReferenceMapper", artifactMapper, refMapper, AbstractArtifactMapperImpl.class);
    injectMethod("userMapper", refMapper, userMapper, RefToReferenceMapper.class);
    injectMethod("buildMapper", refMapper, buildMapper, RefToReferenceMapper.class);
    injectMethod("targetRepositoryMapper", refMapper, targetRepositoryMapper, RefToReferenceMapper.class);
    when(configuration.getGlobalConfig()).thenReturn(globalConfig);
}
Also used : GlobalModuleGroup(org.jboss.pnc.common.json.GlobalModuleGroup) Before(org.junit.Before)

Aggregations

GlobalModuleGroup (org.jboss.pnc.common.json.GlobalModuleGroup)10 Before (org.junit.Before)4 UriBuilder (javax.ws.rs.core.UriBuilder)2 Configuration (org.jboss.pnc.common.Configuration)2 IndyRepoDriverModuleConfig (org.jboss.pnc.common.json.moduleconfig.IndyRepoDriverModuleConfig)2 InvalidEntityException (org.jboss.pnc.facade.validation.InvalidEntityException)2 AcceptedResponse (org.jboss.pnc.rest.endpoints.internal.dto.AcceptedResponse)2 BuildExecutionSession (org.jboss.pnc.spi.executor.BuildExecutionSession)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 Properties (java.util.Properties)1 BootStatus (org.commonjava.propulsor.boot.BootStatus)1 ConfigurationParseException (org.jboss.pnc.common.json.ConfigurationParseException)1 ModuleConfigJson (org.jboss.pnc.common.json.ModuleConfigJson)1 PNCModuleGroup (org.jboss.pnc.common.json.PNCModuleGroup)1 ScmModuleConfig (org.jboss.pnc.common.json.moduleconfig.ScmModuleConfig)1 SystemConfig (org.jboss.pnc.common.json.moduleconfig.SystemConfig)1 UIModuleConfig (org.jboss.pnc.common.json.moduleconfig.UIModuleConfig)1 PncConfigProvider (org.jboss.pnc.common.json.moduleprovider.PncConfigProvider)1