use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.
the class GroupPromoteResultTest method roundTripJSON_NoCompletedPendingWithError.
@Test
public void roundTripJSON_NoCompletedPendingWithError() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final GroupPromoteResult in = new GroupPromoteResult(new GroupPromoteRequest(new StoreKey(StoreType.hosted, "source"), "target"), "Something stupid happened");
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.StoreKey in project indy by Commonjava.
the class PathsPromoteRequestTest method roundTripJSON_Basic.
@Test
public void roundTripJSON_Basic() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final PathsPromoteRequest req = new PathsPromoteRequest(new StoreKey(StoreType.hosted, "source"), new StoreKey(StoreType.hosted, "target"));
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.StoreKey in project indy by Commonjava.
the class PathsPromoteResultTest method roundTripJSON_CompletedNoPendingNoError.
@Test
public void roundTripJSON_CompletedNoPendingNoError() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final PathsPromoteResult in = new PathsPromoteResult(new PathsPromoteRequest(new StoreKey(StoreType.hosted, "source"), new StoreKey(StoreType.hosted, "target")), Collections.emptySet(), Collections.emptySet(), new HashSet<String>(Arrays.asList("/path/one", "/path/two")), new ValidationResult());
final String json = mapper.writeValueAsString(in);
System.out.println(json);
final PathsPromoteResult out = mapper.readValue(json, PathsPromoteResult.class);
// we have separate unit tests to handle serialization checks for PromoteRequest...skipping here.
assertThat(out.getPendingPaths(), equalTo(in.getPendingPaths()));
assertThat(out.getCompletedPaths(), equalTo(in.getCompletedPaths()));
assertThat(out.getError(), equalTo(in.getError()));
}
use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.
the class PathsPromoteResultTest method roundTripJSON_CompletedANDPendingWithError.
@Test
public void roundTripJSON_CompletedANDPendingWithError() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final PathsPromoteResult in = new PathsPromoteResult(new PathsPromoteRequest(new StoreKey(StoreType.hosted, "source"), new StoreKey(StoreType.hosted, "target")), new HashSet<>(Arrays.asList("/path/one", "/path/two")), new HashSet<>(Collections.singletonList("/path/three")), Collections.emptySet(), "Something stupid happened", new ValidationResult());
final String json = mapper.writeValueAsString(in);
System.out.println(json);
final PathsPromoteResult out = mapper.readValue(json, PathsPromoteResult.class);
// we have separate unit tests to handle serialization checks for PromoteRequest...skipping here.
assertThat(out.getPendingPaths(), equalTo(in.getPendingPaths()));
assertThat(out.getCompletedPaths(), equalTo(in.getCompletedPaths()));
assertThat(out.getError(), equalTo(in.getError()));
}
use of org.commonjava.indy.model.core.StoreKey in project indy by Commonjava.
the class PathsPromoteResultTest method roundTripJSON_NoCompletedPendingWithError.
@Test
public void roundTripJSON_NoCompletedPendingWithError() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
final PathsPromoteResult in = new PathsPromoteResult(new PathsPromoteRequest(new StoreKey(StoreType.hosted, "source"), new StoreKey(StoreType.hosted, "target")), new HashSet<>(Arrays.asList("/path/one", "/path/two")), Collections.emptySet(), Collections.emptySet(), "Something stupid happened", new ValidationResult());
final String json = mapper.writeValueAsString(in);
System.out.println(json);
final PathsPromoteResult out = mapper.readValue(json, PathsPromoteResult.class);
// we have separate unit tests to handle serialization checks for PromoteRequest...skipping here.
assertThat(out.getPendingPaths(), equalTo(in.getPendingPaths()));
assertThat(out.getCompletedPaths(), equalTo(in.getCompletedPaths()));
assertThat(out.getError(), equalTo(in.getError()));
}
Aggregations