use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class AbstractIndyFunctionalTest method createIndyClient.
protected Indy createIndyClient() throws IndyClientException {
SiteConfig config = new SiteConfigBuilder("indy", fixture.getUrl()).withRequestTimeoutSeconds(60).build();
Collection<IndyClientModule> modules = getAdditionalClientModules();
return new Indy(config, new MemoryPasswordManager(), new IndyObjectMapper(getAdditionalMapperModules()), modules.toArray(new IndyClientModule[modules.size()]));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class RuleDTOTest method jsonRoundTrip.
@Test
public void jsonRoundTrip() throws IOException {
try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream("test-autoprox-rule.groovy")) {
String spec = IOUtils.toString(stream);
RuleDTO in = new RuleDTO("test", spec);
IndyObjectMapper mapper = new IndyObjectMapper(true);
String json = mapper.writeValueAsString(in);
RuleDTO out = mapper.readValue(json, RuleDTO.class);
assertThat(out, notNullValue());
assertThat(out.getName(), equalTo(in.getName()));
assertThat(out.getSpec(), equalTo(in.getSpec()));
assertThat(out, equalTo(in));
}
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class DownloadDiagBundleTest method createIndyClient.
protected Indy createIndyClient() throws IndyClientException {
SiteConfig config = new SiteConfigBuilder("indy", fixture.getUrl()).withRequestTimeoutSeconds(120).build();
Collection<IndyClientModule> modules = getAdditionalClientModules();
return new Indy(config, new MemoryPasswordManager(), new IndyObjectMapper(getAdditionalMapperModules()), modules.toArray(new IndyClientModule[modules.size()]));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class AutoProxCalculationTest method jsonRoundTrip_HostedRepoCreation.
@Test
public void jsonRoundTrip_HostedRepoCreation() throws IOException {
HostedRepository repo = new HostedRepository("test");
AutoProxCalculation in = new AutoProxCalculation(repo, "test-rule.groovy");
IndyObjectMapper mapper = new IndyObjectMapper(true);
String json = mapper.writeValueAsString(in);
AutoProxCalculation out = mapper.readValue(json, AutoProxCalculation.class);
assertThat(out, notNullValue());
assertThat(out.getRuleName(), equalTo(in.getRuleName()));
assertThat(out.getStore(), equalTo(in.getStore()));
assertThat(out, equalTo(in));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class AutoProxCalculationTest method jsonRoundTrip_GroupCreation.
@Test
public void jsonRoundTrip_GroupCreation() throws IOException {
HostedRepository first = new HostedRepository("first");
HostedRepository second = new HostedRepository("second");
Group repo = new Group("test", first.getKey(), second.getKey());
AutoProxCalculation in = new AutoProxCalculation(repo, Arrays.asList(first, second), "test-rule.groovy");
IndyObjectMapper mapper = new IndyObjectMapper(true);
String json = mapper.writeValueAsString(in);
AutoProxCalculation out = mapper.readValue(json, AutoProxCalculation.class);
assertThat(out, notNullValue());
assertThat(out.getRuleName(), equalTo(in.getRuleName()));
assertThat(out.getStore(), equalTo(in.getStore()));
assertThat(out, equalTo(in));
List<ArtifactStore> supplementalStores = out.getSupplementalStores();
assertThat(supplementalStores, notNullValue());
assertThat(supplementalStores.size(), equalTo(2));
assertThat(supplementalStores.get(0), equalTo(first));
assertThat(supplementalStores.get(1), equalTo(second));
}
Aggregations