Search in sources :

Example 1 with TrackingIdsDTO

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());
}
Also used : TrackingIdsDTO(org.commonjava.indy.folo.dto.TrackingIdsDTO) IndyFoloAdminClientModule(org.commonjava.indy.folo.client.IndyFoloAdminClientModule) InputStream(java.io.InputStream) IndyFoloContentClientModule(org.commonjava.indy.folo.client.IndyFoloContentClientModule) Test(org.junit.Test)

Example 2 with TrackingIdsDTO

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;
}
Also used : ResponseUtils.formatResponse(org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse) Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.annotations.ApiResponse) TrackingIdsDTO(org.commonjava.indy.folo.dto.TrackingIdsDTO) HashSet(java.util.HashSet) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

TrackingIdsDTO (org.commonjava.indy.folo.dto.TrackingIdsDTO)2 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponse (io.swagger.annotations.ApiResponse)1 ApiResponses (io.swagger.annotations.ApiResponses)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Response (javax.ws.rs.core.Response)1 ResponseUtils.formatResponse (org.commonjava.indy.bind.jaxrs.util.ResponseUtils.formatResponse)1 IndyFoloAdminClientModule (org.commonjava.indy.folo.client.IndyFoloAdminClientModule)1 IndyFoloContentClientModule (org.commonjava.indy.folo.client.IndyFoloContentClientModule)1 Test (org.junit.Test)1