use of org.commonjava.indy.folo.dto.TrackingIdsDTO in project indy by Commonjava.
the class ReportIdsGettingTest method doTest.
@Test
public void doTest() throws Exception {
final String trackingId = newName();
final String path = "org/commonjava/commonjava/2/commonjava-2.pom";
final InputStream result = client.module(IndyFoloContentClientModule.class).get(trackingId, remote, CENTRAL, path);
assertThat(result, notNullValue());
result.close();
assertThat(client.module(IndyFoloAdminClientModule.class).initReport(trackingId), equalTo(true));
assertThat(client.module(IndyFoloAdminClientModule.class).sealTrackingRecord(trackingId), equalTo(true));
TrackingIdsDTO ids = client.module(IndyFoloAdminClientModule.class).getTrackingIds("sealed");
assertNotNull(ids);
assertNotNull(ids.getSealed());
assertThat(ids.getSealed().contains(trackingId), equalTo(true));
ids = client.module(IndyFoloAdminClientModule.class).getTrackingIds("all");
assertNotNull(ids);
assertNotNull(ids.getSealed());
assertThat(ids.getSealed().contains(trackingId), equalTo(true));
assertNull(ids.getInProgress());
}
use of org.commonjava.indy.folo.dto.TrackingIdsDTO in project indy by Commonjava.
the class FoloAdminResource method getRecordIds.
@ApiOperation("Retrieve folo report tracking ids for folo records.")
@ApiResponses({ @ApiResponse(code = 200, response = List.class, message = "folo tracking ids with sealed or in_progress"), @ApiResponse(code = 404, message = "No ids found for type") })
@Path("/report/ids/{type}")
@GET
public Response getRecordIds(@ApiParam("Report type, should be in_progress|sealed|all") @PathParam("type") final String type) {
Response response;
Set<FoloConstants.TRACKING_TYPE> types = new HashSet<>();
if ("in_progress".equals(type) || "all".equals(type)) {
types.add(FoloConstants.TRACKING_TYPE.IN_PROGRESS);
}
if ("sealed".equals(type) || "all".equals(type)) {
types.add(FoloConstants.TRACKING_TYPE.SEALED);
}
TrackingIdsDTO ids = controller.getTrackingIds(types);
if (ids != null) {
response = formatOkResponseWithJsonEntity(ids, objectMapper);
} else {
response = Response.status(Status.NOT_FOUND).build();
}
return response;
}
Aggregations