@Test public void listResourceEndpoints() throws Exception { RestAssured.given() .accept(MediaType.APPLICATION_JSON) .header(GlobalDataRest.X_TENANT_ID, TENANT_ID) .when().options("/") .then().statusCode(Status.OK.getStatusCode()) .body(new BaseMatcher<String>() { @Override public boolean matches(Object o) { try { ObjectMapper mapper = new ObjectMapper(); EndpointInfo[] endpoints = mapper.readValue((String) o, EndpointInfo[].class); EndpointInfo postIngests = Arrays.stream(endpoints) .filter(ep -> ep.getPermission().equals("ingests:create")) .findFirst() .orElseThrow(RuntimeException::new); Assert.assertEquals("POST", postIngests.getVerb()); Assert.assertEquals("/ingest-external/v1/ingests/", postIngests.getEndpoint()); Assert.assertEquals(1, postIngests.getConsumedMediaTypes().length); Assert.assertEquals("application/octet-stream", postIngests.getConsumedMediaTypes()[0]); Assert.assertEquals(0, postIngests.getProducedMediaTypes().length); Assert.assertEquals("Envoyer un SIP à Vitam afin qu'il en réalise l'entrée", postIngests.getDescription()); return true; } catch (Exception e) { throw new RuntimeException(e); } } @Override public void describeTo(Description description) { } }); }
@Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = IngestExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); }
IngestExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = IngestExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } }
IngestExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = IngestExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } IngestExternalResource(
        IngestExternalConfiguration ingestExternalConfiguration,
        SecureEndpointRegistry secureEndpointRegistry,
        FormatIdentifierFactory formatIdentifierFactory,
        IngestInternalClientFactory ingestInternalClientFactory); }
IngestExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = IngestExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } IngestExternalResource(
        IngestExternalConfiguration ingestExternalConfiguration,
        SecureEndpointRegistry secureEndpointRegistry,
        FormatIdentifierFactory formatIdentifierFactory,
        IngestInternalClientFactory ingestInternalClientFactory); @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() Response listResourceEndpoints(); @Path("ingests") @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "ingests:create", description = "Envoyer un SIP à Vitam afin qu'il en réalise l'entrée") void upload(
        @HeaderParam(GlobalDataRest.X_CONTEXT_ID) String contextId,
        @HeaderParam(GlobalDataRest.X_ACTION) String action,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_ALGORITHM) String manifestDigestAlgo,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_VALUE) String manifestDigestValue,
        InputStream uploadedInputStream,
        @Suspended final AsyncResponse asyncResponse); @Path("ingests") @POST @Consumes(MediaType.APPLICATION_JSON) @Secured(permission = "ingests:local:create", description = "Envoyer un SIP en local à Vitam afin qu'il en réalise l'entrée") void uploadLocal(
        @HeaderParam(GlobalDataRest.X_CONTEXT_ID) String contextId,
        @HeaderParam(GlobalDataRest.X_ACTION) String action,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_ALGORITHM) String manifestDigestAlgo,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_VALUE) String manifestDigestValue,
        LocalFile localFile,
        @Suspended final AsyncResponse asyncResponse); @GET @Path("/ingests/{objectId}/archivetransferreply") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "ingests:id:archivetransfertreply:read", description = "Récupérer l'accusé de récéption pour une opération d'entrée donnée") Response downloadArchiveTransferReplyAsStream(@PathParam("objectId") String objectId); @GET @Path("/ingests/{objectId}/manifests") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "ingests:id:manifests:read", description = "Récupérer le bordereau de versement pour une opération d'entrée donnée") Response downloadIngestManifestsAsStream(@PathParam("objectId") String objectId); }
IngestExternalResource extends ApplicationStatusResource { @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() public Response listResourceEndpoints() { String resourcePath = IngestExternalResource.class.getAnnotation(Path.class).value(); List<EndpointInfo> securedEndpointList = secureEndpointRegistry.getEndPointsByResourcePath(resourcePath); return Response.status(Status.OK).entity(securedEndpointList).build(); } IngestExternalResource(
        IngestExternalConfiguration ingestExternalConfiguration,
        SecureEndpointRegistry secureEndpointRegistry,
        FormatIdentifierFactory formatIdentifierFactory,
        IngestInternalClientFactory ingestInternalClientFactory); @Path("/") @OPTIONS @Produces(MediaType.APPLICATION_JSON) @Unsecured() Response listResourceEndpoints(); @Path("ingests") @POST @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "ingests:create", description = "Envoyer un SIP à Vitam afin qu'il en réalise l'entrée") void upload(
        @HeaderParam(GlobalDataRest.X_CONTEXT_ID) String contextId,
        @HeaderParam(GlobalDataRest.X_ACTION) String action,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_ALGORITHM) String manifestDigestAlgo,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_VALUE) String manifestDigestValue,
        InputStream uploadedInputStream,
        @Suspended final AsyncResponse asyncResponse); @Path("ingests") @POST @Consumes(MediaType.APPLICATION_JSON) @Secured(permission = "ingests:local:create", description = "Envoyer un SIP en local à Vitam afin qu'il en réalise l'entrée") void uploadLocal(
        @HeaderParam(GlobalDataRest.X_CONTEXT_ID) String contextId,
        @HeaderParam(GlobalDataRest.X_ACTION) String action,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_ALGORITHM) String manifestDigestAlgo,
        @HeaderParam(GlobalDataRest.X_MANIFEST_DIGEST_VALUE) String manifestDigestValue,
        LocalFile localFile,
        @Suspended final AsyncResponse asyncResponse); @GET @Path("/ingests/{objectId}/archivetransferreply") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "ingests:id:archivetransfertreply:read", description = "Récupérer l'accusé de récéption pour une opération d'entrée donnée") Response downloadArchiveTransferReplyAsStream(@PathParam("objectId") String objectId); @GET @Path("/ingests/{objectId}/manifests") @Produces(MediaType.APPLICATION_OCTET_STREAM) @Secured(permission = "ingests:id:manifests:read", description = "Récupérer le bordereau de versement pour une opération d'entrée donnée") Response downloadIngestManifestsAsStream(@PathParam("objectId") String objectId);  }