use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class GroupPromoteRequestTest method roundTripJSON_Basic.
@Test
public void roundTripJSON_Basic() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final GroupPromoteRequest req = new GroupPromoteRequest(new StoreKey(StoreType.hosted, "source"), "target");
final String json = mapper.writeValueAsString(req);
System.out.println(json);
final GroupPromoteRequest result = mapper.readValue(json, GroupPromoteRequest.class);
assertThat(result.getSource(), equalTo(req.getSource()));
assertThat(result.getTargetGroup(), equalTo(req.getTargetGroup()));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class GroupPromoteResultTest method roundTripJSON_NoError.
@Test
public void roundTripJSON_NoError() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final GroupPromoteResult in = new GroupPromoteResult(new GroupPromoteRequest(new StoreKey(StoreType.hosted, "source"), "target"), new ValidationResult());
final String json = mapper.writeValueAsString(in);
System.out.println(json);
final GroupPromoteResult out = mapper.readValue(json, GroupPromoteResult.class);
// we have separate unit tests to handle serialization checks for PromoteRequest...skipping here.
assertThat(out.getError(), equalTo(in.getError()));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class PathsPromoteRequestTest method roundTripJSON_withPurgeSource.
@Test
public void roundTripJSON_withPurgeSource() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final PathsPromoteRequest req = new PathsPromoteRequest(new StoreKey(StoreType.hosted, "source"), new StoreKey(StoreType.hosted, "target")).setPurgeSource(true);
final String json = mapper.writeValueAsString(req);
System.out.println(json);
final PathsPromoteRequest result = mapper.readValue(json, PathsPromoteRequest.class);
assertThat(result.getSource(), equalTo(req.getSource()));
assertThat(result.getTarget(), equalTo(req.getTarget()));
assertThat(result.isPurgeSource(), equalTo(req.isPurgeSource()));
assertThat(result.getPaths(), equalTo(req.getPaths()));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class PathsPromoteRequestTest method roundTripJSON_withPaths.
@Test
public void roundTripJSON_withPaths() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final PathsPromoteRequest req = new PathsPromoteRequest(new StoreKey(StoreType.hosted, "source"), new StoreKey(StoreType.hosted, "target"), new HashSet<String>(Arrays.asList("/path/one", "/path/two")));
final String json = mapper.writeValueAsString(req);
System.out.println(json);
final PathsPromoteRequest result = mapper.readValue(json, PathsPromoteRequest.class);
assertThat(result.getSource(), equalTo(req.getSource()));
assertThat(result.getTarget(), equalTo(req.getTarget()));
assertThat(result.isPurgeSource(), equalTo(req.isPurgeSource()));
assertThat(result.getPaths(), equalTo(req.getPaths()));
}
use of org.commonjava.indy.model.core.io.IndyObjectMapper in project indy by Commonjava.
the class TestProvider method init.
@PostConstruct
public void init() {
try {
this.storageProviderConfig = new DefaultStorageProviderConfiguration(TEMP.newFolder("storage"));
this.dataConfig = new DataFileConfiguration(TEMP.newFolder("data"), TEMP.newFolder("work"));
} catch (final IOException e) {
e.printStackTrace();
Assert.fail("Failed to setup temporary directory structures: " + e.getMessage());
}
this.nfc = new MemoryNotFoundCache();
this.xmlInfra = new XMLInfrastructure();
this.typeMapper = new StandardTypeMapper();
this.indyConfig = new DefaultIndyConfiguration();
this.objectMapper = new IndyObjectMapper(true);
}
Aggregations