@Test public void testMergeSegments() throws Exception { List<Tuple<Long, Long>> segments = new ArrayList<>(); segments.add(tuple(0L, 2449L)); segments.add(tuple(4922L, 11284L)); segments.add(tuple(14000L, 15000L)); List<Tuple<Long, Long>> segments2 = new ArrayList<>(); segments2.add(tuple(1449L, 3449L)); segments2.add(tuple(11285L, 11290L)); segments2.add(tuple(15000L, 16000L)); List<Tuple<Long, Long>> mergedSegments = endpoint.mergeSegments(segments, segments2); assertEquals(5, mergedSegments.size()); }
protected List<Tuple<Long, Long>> mergeSegments(List<Tuple<Long, Long>> segments, List<Tuple<Long, Long>> segments2) { List<Tuple<Long, Long>> mergedSegments = mergeInternal(segments, segments2); Collections.sort(mergedSegments, new Comparator<Tuple<Long, Long>>() { @Override public int compare(Tuple<Long, Long> t1, Tuple<Long, Long> t2) { return t1.getA().compareTo(t2.getA()); } }); return mergedSegments; }
ToolsEndpoint implements ManagedService { protected List<Tuple<Long, Long>> mergeSegments(List<Tuple<Long, Long>> segments, List<Tuple<Long, Long>> segments2) { List<Tuple<Long, Long>> mergedSegments = mergeInternal(segments, segments2); Collections.sort(mergedSegments, new Comparator<Tuple<Long, Long>>() { @Override public int compare(Tuple<Long, Long> t1, Tuple<Long, Long> t2) { return t1.getA().compareTo(t2.getA()); } }); return mergedSegments; } }
ToolsEndpoint implements ManagedService { protected List<Tuple<Long, Long>> mergeSegments(List<Tuple<Long, Long>> segments, List<Tuple<Long, Long>> segments2) { List<Tuple<Long, Long>> mergedSegments = mergeInternal(segments, segments2); Collections.sort(mergedSegments, new Comparator<Tuple<Long, Long>>() { @Override public int compare(Tuple<Long, Long> t1, Tuple<Long, Long> t2) { return t1.getA().compareTo(t2.getA()); } }); return mergedSegments; }  }
ToolsEndpoint implements ManagedService { protected List<Tuple<Long, Long>> mergeSegments(List<Tuple<Long, Long>> segments, List<Tuple<Long, Long>> segments2) { List<Tuple<Long, Long>> mergedSegments = mergeInternal(segments, segments2); Collections.sort(mergedSegments, new Comparator<Tuple<Long, Long>>() { @Override public int compare(Tuple<Long, Long> t1, Tuple<Long, Long> t2) { return t1.getA().compareTo(t2.getA()); } }); return mergedSegments; }  @Override void updated(Dictionary<String, ?> properties); @GET @Path("{mediapackageid}.json") @RestQuery(name = "getAvailableTools", description = "Returns a list of tools which are currently available for the given media package.", returnDescription = "A JSON array with tools identifiers", pathParameters = { @RestParameter(name = "mediapackageid", description = "The id of the media package", isRequired = true, type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "Available tools evaluated", responseCode = HttpServletResponse.SC_OK) }) Response getAvailableTools(@PathParam("mediapackageid") final String mediaPackageId); @GET @Path("{mediapackageid}/editor.json") @Produces(MediaType.APPLICATION_JSON) @RestQuery(name = "getVideoEditor", description = "Returns all the information required to get the editor tool started", returnDescription = "JSON object", pathParameters = { @RestParameter(name = "mediapackageid", description = "The id of the media package", isRequired = true, type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "Media package found", responseCode = SC_OK), @RestResponse(description = "Media package not found", responseCode = SC_NOT_FOUND) }) Response getVideoEditor(@PathParam("mediapackageid") final String mediaPackageId); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @Path("{mediapackageid}/thumbnail.json") Response changeThumbnail(@PathParam("mediapackageid") final String mediaPackageId,
    @Context HttpServletRequest request); @POST @Path("{mediapackageid}/editor.json") @Consumes(MediaType.APPLICATION_JSON) @RestQuery(name = "editVideo", description = "Takes editing information from the client side and processes it", returnDescription = "", pathParameters = { @RestParameter(name = "mediapackageid", description = "The id of the media package", isRequired = true, type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "Editing information saved and processed", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "Media package not found", responseCode = HttpServletResponse.SC_NOT_FOUND), @RestResponse(description = "The editing information cannot be parsed", responseCode = HttpServletResponse.SC_BAD_REQUEST) }) Response editVideo(@PathParam("mediapackageid") final String mediaPackageId,
          @Context HttpServletRequest request); }
ToolsEndpoint implements ManagedService { protected List<Tuple<Long, Long>> mergeSegments(List<Tuple<Long, Long>> segments, List<Tuple<Long, Long>> segments2) { List<Tuple<Long, Long>> mergedSegments = mergeInternal(segments, segments2); Collections.sort(mergedSegments, new Comparator<Tuple<Long, Long>>() { @Override public int compare(Tuple<Long, Long> t1, Tuple<Long, Long> t2) { return t1.getA().compareTo(t2.getA()); } }); return mergedSegments; }  @Override void updated(Dictionary<String, ?> properties); @GET @Path("{mediapackageid}.json") @RestQuery(name = "getAvailableTools", description = "Returns a list of tools which are currently available for the given media package.", returnDescription = "A JSON array with tools identifiers", pathParameters = { @RestParameter(name = "mediapackageid", description = "The id of the media package", isRequired = true, type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "Available tools evaluated", responseCode = HttpServletResponse.SC_OK) }) Response getAvailableTools(@PathParam("mediapackageid") final String mediaPackageId); @GET @Path("{mediapackageid}/editor.json") @Produces(MediaType.APPLICATION_JSON) @RestQuery(name = "getVideoEditor", description = "Returns all the information required to get the editor tool started", returnDescription = "JSON object", pathParameters = { @RestParameter(name = "mediapackageid", description = "The id of the media package", isRequired = true, type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "Media package found", responseCode = SC_OK), @RestResponse(description = "Media package not found", responseCode = SC_NOT_FOUND) }) Response getVideoEditor(@PathParam("mediapackageid") final String mediaPackageId); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) @Path("{mediapackageid}/thumbnail.json") Response changeThumbnail(@PathParam("mediapackageid") final String mediaPackageId,
    @Context HttpServletRequest request); @POST @Path("{mediapackageid}/editor.json") @Consumes(MediaType.APPLICATION_JSON) @RestQuery(name = "editVideo", description = "Takes editing information from the client side and processes it", returnDescription = "", pathParameters = { @RestParameter(name = "mediapackageid", description = "The id of the media package", isRequired = true, type = RestParameter.Type.STRING) }, responses = { @RestResponse(description = "Editing information saved and processed", responseCode = HttpServletResponse.SC_OK), @RestResponse(description = "Media package not found", responseCode = HttpServletResponse.SC_NOT_FOUND), @RestResponse(description = "The editing information cannot be parsed", responseCode = HttpServletResponse.SC_BAD_REQUEST) }) Response editVideo(@PathParam("mediapackageid") final String mediaPackageId,
          @Context HttpServletRequest request);  }