Search in sources :

Example 86 with StoreKey

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()));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 87 with StoreKey

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()));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 88 with StoreKey

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()));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 89 with StoreKey

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()));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Example 90 with StoreKey

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()));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) StoreKey(org.commonjava.indy.model.core.StoreKey) Test(org.junit.Test)

Aggregations

StoreKey (org.commonjava.indy.model.core.StoreKey)186 Test (org.junit.Test)92 ArtifactStore (org.commonjava.indy.model.core.ArtifactStore)40 StoreType (org.commonjava.indy.model.core.StoreType)39 InputStream (java.io.InputStream)33 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)32 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)31 IndyDataException (org.commonjava.indy.data.IndyDataException)30 Group (org.commonjava.indy.model.core.Group)29 Transfer (org.commonjava.maven.galley.model.Transfer)27 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)24 Response (javax.ws.rs.core.Response)23 IOException (java.io.IOException)22 Logger (org.slf4j.Logger)21 ApiOperation (io.swagger.annotations.ApiOperation)20 ResponseUtils.formatResponse (org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse)20 ArrayList (java.util.ArrayList)19 Path (javax.ws.rs.Path)19 ApiResponse (io.swagger.annotations.ApiResponse)18 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)18