@Test public void buildOperationalDataResponseWithNotAvailableRecordsTo() throws Exception { ClientId client = ClientId.create( "XTEE-CI-XM", "00000001", "GOV", "System1"); OperationalDataRequestHandler handler = new OperationalDataRequestHandler(); long recordsAvailableBefore = TimeUtils.getEpochSecond(); GetSecurityServerOperationalDataResponseType response = handler .buildOperationalDataResponse(client, 1474968960L, recordsAvailableBefore + 10, null, Collections.emptySet(), recordsAvailableBefore); assertNotNull(response.getNextRecordsFrom()); }
protected GetSecurityServerOperationalDataResponseType buildOperationalDataResponse(ClientId filterByClient, long recordsFrom, long recordsTo, ClientId filterByServiceProvider, Set<String> outputFields, long recordsAvailableBefore) throws IOException { OperationalDataRecords responseRecords; GetSecurityServerOperationalDataResponseType opDataResponse = OBJECT_FACTORY .createGetSecurityServerOperationalDataResponseType(); if (recordsTo >= recordsAvailableBefore) { log.debug("recordsTo({}) >= recordsAvailableBefore({})," + " set nextRecordsFrom to {}", recordsTo, recordsAvailableBefore, recordsAvailableBefore); recordsTo = recordsAvailableBefore - 1; opDataResponse.setNextRecordsFrom(recordsAvailableBefore); } responseRecords = getOperationalDataRecords(filterByClient, recordsFrom, recordsTo, filterByServiceProvider, outputFields); opDataResponse.setRecordsCount(responseRecords.size()); String payload = responseRecords.getPayload(GSON); responseRecords.getRecords().clear(); opDataResponse.setRecords(createAttachmentDataSource(compress(payload), CID, MimeTypes.GZIP)); if (responseRecords.getNextRecordsFrom() != null) { opDataResponse.setNextRecordsFrom( responseRecords.getNextRecordsFrom()); } return opDataResponse; }
OperationalDataRequestHandler extends QueryRequestHandler { protected GetSecurityServerOperationalDataResponseType buildOperationalDataResponse(ClientId filterByClient, long recordsFrom, long recordsTo, ClientId filterByServiceProvider, Set<String> outputFields, long recordsAvailableBefore) throws IOException { OperationalDataRecords responseRecords; GetSecurityServerOperationalDataResponseType opDataResponse = OBJECT_FACTORY .createGetSecurityServerOperationalDataResponseType(); if (recordsTo >= recordsAvailableBefore) { log.debug("recordsTo({}) >= recordsAvailableBefore({})," + " set nextRecordsFrom to {}", recordsTo, recordsAvailableBefore, recordsAvailableBefore); recordsTo = recordsAvailableBefore - 1; opDataResponse.setNextRecordsFrom(recordsAvailableBefore); } responseRecords = getOperationalDataRecords(filterByClient, recordsFrom, recordsTo, filterByServiceProvider, outputFields); opDataResponse.setRecordsCount(responseRecords.size()); String payload = responseRecords.getPayload(GSON); responseRecords.getRecords().clear(); opDataResponse.setRecords(createAttachmentDataSource(compress(payload), CID, MimeTypes.GZIP)); if (responseRecords.getNextRecordsFrom() != null) { opDataResponse.setNextRecordsFrom( responseRecords.getNextRecordsFrom()); } return opDataResponse; } }
OperationalDataRequestHandler extends QueryRequestHandler { protected GetSecurityServerOperationalDataResponseType buildOperationalDataResponse(ClientId filterByClient, long recordsFrom, long recordsTo, ClientId filterByServiceProvider, Set<String> outputFields, long recordsAvailableBefore) throws IOException { OperationalDataRecords responseRecords; GetSecurityServerOperationalDataResponseType opDataResponse = OBJECT_FACTORY .createGetSecurityServerOperationalDataResponseType(); if (recordsTo >= recordsAvailableBefore) { log.debug("recordsTo({}) >= recordsAvailableBefore({})," + " set nextRecordsFrom to {}", recordsTo, recordsAvailableBefore, recordsAvailableBefore); recordsTo = recordsAvailableBefore - 1; opDataResponse.setNextRecordsFrom(recordsAvailableBefore); } responseRecords = getOperationalDataRecords(filterByClient, recordsFrom, recordsTo, filterByServiceProvider, outputFields); opDataResponse.setRecordsCount(responseRecords.size()); String payload = responseRecords.getPayload(GSON); responseRecords.getRecords().clear(); opDataResponse.setRecords(createAttachmentDataSource(compress(payload), CID, MimeTypes.GZIP)); if (responseRecords.getNextRecordsFrom() != null) { opDataResponse.setNextRecordsFrom( responseRecords.getNextRecordsFrom()); } return opDataResponse; }  }
OperationalDataRequestHandler extends QueryRequestHandler { protected GetSecurityServerOperationalDataResponseType buildOperationalDataResponse(ClientId filterByClient, long recordsFrom, long recordsTo, ClientId filterByServiceProvider, Set<String> outputFields, long recordsAvailableBefore) throws IOException { OperationalDataRecords responseRecords; GetSecurityServerOperationalDataResponseType opDataResponse = OBJECT_FACTORY .createGetSecurityServerOperationalDataResponseType(); if (recordsTo >= recordsAvailableBefore) { log.debug("recordsTo({}) >= recordsAvailableBefore({})," + " set nextRecordsFrom to {}", recordsTo, recordsAvailableBefore, recordsAvailableBefore); recordsTo = recordsAvailableBefore - 1; opDataResponse.setNextRecordsFrom(recordsAvailableBefore); } responseRecords = getOperationalDataRecords(filterByClient, recordsFrom, recordsTo, filterByServiceProvider, outputFields); opDataResponse.setRecordsCount(responseRecords.size()); String payload = responseRecords.getPayload(GSON); responseRecords.getRecords().clear(); opDataResponse.setRecords(createAttachmentDataSource(compress(payload), CID, MimeTypes.GZIP)); if (responseRecords.getNextRecordsFrom() != null) { opDataResponse.setNextRecordsFrom( responseRecords.getNextRecordsFrom()); } return opDataResponse; }  @Override void handle(SoapMessageImpl requestSoap, OutputStream out,
            Consumer<String> contentTypeCallback); }
OperationalDataRequestHandler extends QueryRequestHandler { protected GetSecurityServerOperationalDataResponseType buildOperationalDataResponse(ClientId filterByClient, long recordsFrom, long recordsTo, ClientId filterByServiceProvider, Set<String> outputFields, long recordsAvailableBefore) throws IOException { OperationalDataRecords responseRecords; GetSecurityServerOperationalDataResponseType opDataResponse = OBJECT_FACTORY .createGetSecurityServerOperationalDataResponseType(); if (recordsTo >= recordsAvailableBefore) { log.debug("recordsTo({}) >= recordsAvailableBefore({})," + " set nextRecordsFrom to {}", recordsTo, recordsAvailableBefore, recordsAvailableBefore); recordsTo = recordsAvailableBefore - 1; opDataResponse.setNextRecordsFrom(recordsAvailableBefore); } responseRecords = getOperationalDataRecords(filterByClient, recordsFrom, recordsTo, filterByServiceProvider, outputFields); opDataResponse.setRecordsCount(responseRecords.size()); String payload = responseRecords.getPayload(GSON); responseRecords.getRecords().clear(); opDataResponse.setRecords(createAttachmentDataSource(compress(payload), CID, MimeTypes.GZIP)); if (responseRecords.getNextRecordsFrom() != null) { opDataResponse.setNextRecordsFrom( responseRecords.getNextRecordsFrom()); } return opDataResponse; }  @Override void handle(SoapMessageImpl requestSoap, OutputStream out,
            Consumer<String> contentTypeCallback);  }