From a255a089675687d4c41665aa5c9ba348a089ddef Mon Sep 17 00:00:00 2001 From: predix-adoption-bot Date: Sun, 2 Sep 2018 18:42:45 +0000 Subject: [PATCH] Release 2.0.58 --- manifest.yml | 2 +- manifest.yml.template | 2 +- pom.xml | 4 +- .../ge/predix/solsvc/boot/Application.java | 16 +- .../solsvc/winddata/impl/WindDataImpl.java | 610 +++++++++--------- .../predix/solsvc/boot/WindDataServiceIT.java | 2 - 6 files changed, 332 insertions(+), 304 deletions(-) diff --git a/manifest.yml b/manifest.yml index 78c2aa8..1eec518 100755 --- a/manifest.yml +++ b/manifest.yml @@ -1,7 +1,7 @@ applications: - name: your-name-winddata-service buildpack: java_buildpack - path: target/winddata-timeseries-service-2.0.57.jar + path: target/winddata-timeseries-service-2.0.58.jar memory: 500M timeout: 180 services: diff --git a/manifest.yml.template b/manifest.yml.template index 78c2aa8..1eec518 100755 --- a/manifest.yml.template +++ b/manifest.yml.template @@ -1,7 +1,7 @@ applications: - name: your-name-winddata-service buildpack: java_buildpack - path: target/winddata-timeseries-service-2.0.57.jar + path: target/winddata-timeseries-service-2.0.58.jar memory: 500M timeout: 180 services: diff --git a/pom.xml b/pom.xml index 19f652a..e41cd6c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.ge.predix.solsvc winddata-timeseries-service - 2.0.57 + 2.0.58 org.springframework.boot @@ -15,7 +15,7 @@ - 2.1.82 + 2.1.86 3.1.7 8.1.7.v20120910 diff --git a/src/main/java/com/ge/predix/solsvc/boot/Application.java b/src/main/java/com/ge/predix/solsvc/boot/Application.java index 747b53a..c1dd70f 100755 --- a/src/main/java/com/ge/predix/solsvc/boot/Application.java +++ b/src/main/java/com/ge/predix/solsvc/boot/Application.java @@ -15,6 +15,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ImportResource; @@ -27,6 +28,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.support.StandardServletEnvironment; +import com.ge.predix.solsvc.timeseries.bootstrap.client.TimeseriesClientImpl; + /** * This project uses a SpringBoot HelloWorld as a starting point. Then it adds in the capability to cf push a * CXF Rest Service simply by extending PredixSpringBootInitializer. @@ -61,7 +64,7 @@ * Or if you want to import Spring XMLs from other dependent projects you can use the @ImportResource, e.g. * \@ImportResource( * { - * "classpath*:META-INF/spring/predix-rest-client-scan-context.xml" + * "classpath*:META-INF/spring/timeseries-bootstrap-scan-context.xml" * }) * * For other Spring Features see: http://docs.spring.io/spring-boot/docs/current/reference/html/ @@ -74,15 +77,14 @@ }) @PropertySource("classpath:application-default.properties") +@SpringApplicationConfiguration(classes = +{ + TimeseriesClientImpl.class +}) @ImportResource( { "classpath*:META-INF/spring/winddata-cxf-context.xml", - "classpath*:META-INF/spring/winddata-scan-context.xml", - "classpath*:META-INF/spring/ext-util-scan-context.xml", - "classpath*:META-INF/spring/predix-rest-client-scan-context.xml", - "classpath*:META-INF/spring/predix-websocket-client-scan-context.xml", - "classpath*:META-INF/spring/timeseries-bootstrap-scan-context.xml" - + "classpath*:META-INF/spring/winddata-scan-context.xml" }) @Controller public class Application diff --git a/src/main/java/com/ge/predix/solsvc/winddata/impl/WindDataImpl.java b/src/main/java/com/ge/predix/solsvc/winddata/impl/WindDataImpl.java index 9e7de10..04fd5fb 100755 --- a/src/main/java/com/ge/predix/solsvc/winddata/impl/WindDataImpl.java +++ b/src/main/java/com/ge/predix/solsvc/winddata/impl/WindDataImpl.java @@ -17,6 +17,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.ImportResource; import org.springframework.stereotype.Component; import com.ge.predix.entity.timeseries.datapoints.ingestionrequest.Body; @@ -25,7 +26,6 @@ import com.ge.predix.entity.timeseries.datapoints.queryrequest.latest.DatapointsLatestQuery; import com.ge.predix.entity.timeseries.datapoints.queryresponse.DatapointsResponse; import com.ge.predix.entity.timeseries.tags.TagsList; -import com.ge.predix.solsvc.restclient.impl.RestClient; import com.ge.predix.solsvc.spi.IServiceManagerService; import com.ge.predix.solsvc.timeseries.bootstrap.client.TimeseriesClient; import com.ge.predix.solsvc.timeseries.bootstrap.config.ITimeseriesConfig; @@ -43,295 +43,323 @@ * @author predix - */ @Component -public class WindDataImpl implements WindDataAPI { - private static Logger log = LoggerFactory.getLogger(WindDataImpl.class); - - @Autowired - private IServiceManagerService serviceManagerService; - - @Autowired - private RestClient restClient; - - @Autowired - private TimeseriesClient timeseriesClient; - - @Autowired - @Qualifier("defaultTimeseriesConfig") - private ITimeseriesConfig timeseriesConfig; - - // things needed for 2nd time series, if you have that use-case -// @Autowired -// private RestClient restClient2; -// -// @Autowired -// private TimeseriesFactory timeseriesFactory2; -// -// @Autowired -// private SecondaryTimeseriesConfig secondaryTimeseriesConfig; - - /** - * - - */ - public WindDataImpl() { - super(); - } - - /** - * - - */ - @SuppressWarnings("nls") - @PostConstruct - public void init() { - try { - this.serviceManagerService.createRestWebService(this, null); - this.timeseriesClient.createTimeseriesWebsocketConnectionPool(); - createMetrics(); - } catch (Exception e) { - throw new RuntimeException( - "unable to set up timeseries Websocket Pool timeseriesConfig=" + this.timeseriesConfig, e); - } -// try { -// // a second timeseries, if you have that use-case -// this.restClient2.overrideRestConfig(this.secondaryTimeseriesConfig); -// this.timeseriesFactory2.overrideConfig(this.secondaryTimeseriesConfig); -// log.debug("init secondary timeseries properties=" + this.secondaryTimeseriesConfig.toString()); -// // if write privs to 2nd timeseries are revoked do not uncomment -// // this or you'll get 401 unauthorized -// // this.timeseriesFactory2.createConnectionToTimeseriesWebsocket(); -// createMetrics(); -// } catch (Exception e) { -// throw new RuntimeException("unable to set up timeseries Websocket Pool secondaryTimeseriesConfig=" -// + this.secondaryTimeseriesConfig, e); -// } - } - - @Override - public Response greetings() { - return handleResult("Greetings from CXF Bean Rest Service " + new Date()); //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see com.ge.predix.solsvc.api.WindDataAPI#getWindDataTags() - */ - @SuppressWarnings("nls") - @Override - public Response getWindDataTags(String authorization) { - try { - List
headers = generateHeaders(); - TagsList tagsList = this.timeseriesClient.listTags(headers); - - // example of calling 2nd time series -// List
headers2 = this.restClient2.getSecureTokenForClientId(); -// this.restClient2.addZoneToHeaders(headers2, this.secondaryTimeseriesConfig.getZoneId()); -// TagsList tagsList2 = this.timeseriesFactory2.listTags(headers2); -// tagsList.getResults().add("*****************************"); -// tagsList.getResults().add(this.timeseriesConfig.toString()); -// tagsList.getResults().add("*****************************"); -// tagsList.getResults().add(this.secondaryTimeseriesConfig.toString()); -// tagsList.getResults().add("*****************************"); -// tagsList.getResults().addAll(tagsList2.getResults()); - - return handleResult(tagsList); - } catch (Throwable e) { - log.error("unable to get wind data, config=" + this.timeseriesConfig, e); - // This is sample code so we need to easily show you what went - // wrong, please convert your app to show appropriate info to end - // users. For security - // reasons do not expose these properties. - throw new RuntimeException( - "unable to get wind data, errorMsg=" + e.getMessage() + ". config=" + this.timeseriesConfig, e); - } - } - - @SuppressWarnings("nls") - @Override - public Response getYearlyWindDataPoints(String id, String authorization, String starttime, String taglimit, - String tagorder) { - try { - if (id == null) { - return null; - } - - List
headers = generateHeaders(); - - DatapointsQuery dpQuery = buildDatapointsQueryRequest(id, starttime, getInteger(taglimit), tagorder); - DatapointsResponse response = this.timeseriesClient.queryForDatapoints(dpQuery, headers); - log.debug(response.toString()); - return handleResult(response); - } catch (Throwable e) { - log.error("unable to get wind data, config=" + this.timeseriesConfig, e); - // This is sample code so we need to easily show you what went - // wrong, please convert your app to show appropriate info to end - // users. For security - // reasons do not expose these properties. - throw new RuntimeException( - "unable to get wind data, errorMsg=" + e.getMessage() + ". config=" + this.timeseriesConfig, e); - } - } - - /** - * - * @param s - * - - * @return - */ - private int getInteger(String s) { - int inValue = 25; - try { - inValue = Integer.parseInt(s); - - } catch (NumberFormatException ex) { - // s is not an integer - } - return inValue; - } - - @SuppressWarnings("nls") - @Override - public Response getLatestWindDataPoints(String id, String authorization) { - try { - if (id == null) { - return null; - } - List
headers = generateHeaders(); - - DatapointsLatestQuery dpQuery = buildLatestDatapointsQueryRequest(id); - DatapointsResponse response = this.timeseriesClient.queryForLatestDatapoint(dpQuery, headers); - log.debug(response.toString()); - - return handleResult(response); - } catch (Throwable e) { - log.error("unable to get wind data, config=" + this.timeseriesConfig, e); - // This is sample code so we need to easily show you what went - // wrong, please convert your app to show appropriate info to end - // users. For security - // reasons do not expose these properties. - throw new RuntimeException( - "unable to get wind data, errorMsg=" + e.getMessage() + ". config=" + this.timeseriesConfig, e); - - } - } - - @SuppressWarnings({}) - private List
generateHeaders() { - List
headers = this.restClient.getSecureTokenForClientId(); - this.restClient.addZoneToHeaders(headers, this.timeseriesConfig.getZoneId()); - return headers; - } - - private DatapointsLatestQuery buildLatestDatapointsQueryRequest(String id) { - DatapointsLatestQuery datapointsLatestQuery = new DatapointsLatestQuery(); - - com.ge.predix.entity.timeseries.datapoints.queryrequest.latest.Tag tag = new com.ge.predix.entity.timeseries.datapoints.queryrequest.latest.Tag(); - tag.setName(id); - List tags = new ArrayList(); - tags.add(tag); - datapointsLatestQuery.setTags(tags); - return datapointsLatestQuery; - } - - /** - * - * @param id - * @param startDuration - * @param tagorder - * @return - */ - private DatapointsQuery buildDatapointsQueryRequest(String id, String startDuration, int taglimit, - String tagorder) { - DatapointsQuery datapointsQuery = new DatapointsQuery(); - List tags = new ArrayList(); - datapointsQuery.setStart(startDuration); - // datapointsQuery.setStart("1y-ago"); //$NON-NLS-1$ - String[] tagArray = id.split(","); //$NON-NLS-1$ - List entryTags = Arrays.asList(tagArray); - - for (String entryTag : entryTags) { - com.ge.predix.entity.timeseries.datapoints.queryrequest.Tag tag = new com.ge.predix.entity.timeseries.datapoints.queryrequest.Tag(); - tag.setName(entryTag); - tag.setLimit(taglimit); - tag.setOrder(tagorder); - tags.add(tag); - } - datapointsQuery.setTags(tags); - return datapointsQuery; - } - - @SuppressWarnings({ "nls", "unchecked" }) - private void createMetrics() { - for (int i = 0; i < 10; i++) { - DatapointsIngestion dpIngestion = new DatapointsIngestion(); - dpIngestion.setMessageId(String.valueOf(System.currentTimeMillis())); - - Body body = new Body(); - body.setName("Compressor-2015:CompressionRatio"); //$NON-NLS-1$ - List datapoint1 = new ArrayList(); - datapoint1.add(generateTimestampsWithinYear(System.currentTimeMillis())); - datapoint1.add(10); - datapoint1.add(3); // quality - - List datapoint2 = new ArrayList(); - datapoint2.add(generateTimestampsWithinYear(System.currentTimeMillis())); - datapoint2.add(9); - datapoint2.add(1); // quality - - List datapoint3 = new ArrayList(); - datapoint3.add(generateTimestampsWithinYear(System.currentTimeMillis())); - datapoint3.add(27); - datapoint3.add(0); // quality - - List datapoint4 = new ArrayList(); - datapoint4.add(generateTimestampsWithinYear(System.currentTimeMillis())); - datapoint4.add(78); - datapoint4.add(2); // quality - - List datapoint5 = new ArrayList(); - datapoint5.add(generateTimestampsWithinYear(System.currentTimeMillis())); - datapoint5.add(2); - datapoint5.add(3); // quality - - List datapoint6 = new ArrayList(); - datapoint6.add(generateTimestampsWithinYear(System.currentTimeMillis())); - datapoint6.add(98); - datapoint6.add(1); // quality - - List datapoints = new ArrayList(); - datapoints.add(datapoint1); - datapoints.add(datapoint2); - datapoints.add(datapoint3); - datapoints.add(datapoint4); - datapoints.add(datapoint5); - datapoints.add(datapoint6); - - body.setDatapoints(datapoints); - - com.ge.predix.entity.util.map.Map map = new com.ge.predix.entity.util.map.Map(); - map.put("host", "server1"); //$NON-NLS-2$ - map.put("customer", "Acme"); //$NON-NLS-2$ - - body.setAttributes(map); - - List bodies = new ArrayList(); - bodies.add(body); - - dpIngestion.setBody(bodies); - this.timeseriesClient.postDataToTimeseriesWebsocket(dpIngestion); - } - } - - @SuppressWarnings("javadoc") - protected Response handleResult(Object entity) { - ResponseBuilder responseBuilder = Response.status(Status.OK); - responseBuilder.type(MediaType.APPLICATION_JSON); - responseBuilder.entity(entity); - return responseBuilder.build(); - } - - private Long generateTimestampsWithinYear(Long current) { - long yearInMMS = Long.valueOf(31536000000L); - return ThreadLocalRandom.current().nextLong(current - yearInMMS, current + 1); - } +@ImportResource( +{ + "classpath*:META-INF/spring/timeseries-bootstrap-scan-context.xml" +}) +public class WindDataImpl + implements WindDataAPI +{ + private static Logger log = LoggerFactory.getLogger(WindDataImpl.class); + + @Autowired + private IServiceManagerService serviceManagerService; + + @Autowired + private TimeseriesClient timeseriesClient; + + @Autowired + @Qualifier("defaultTimeseriesConfig") + private ITimeseriesConfig timeseriesConfig; + + // things needed for 2nd time series, if you have that use-case + // @Autowired + // private RestClient restClient2; + // + // @Autowired + // private TimeseriesFactory timeseriesFactory2; + // + // @Autowired + // private SecondaryTimeseriesConfig secondaryTimeseriesConfig; + + /** + * - + */ + public WindDataImpl() + { + super(); + } + + /** + * - + */ + @SuppressWarnings("nls") + @PostConstruct + public void init() + { + try + { + this.serviceManagerService.createRestWebService(this, null); + this.timeseriesClient.createTimeseriesWebsocketConnectionPool(); + createMetrics(); + } + catch (Exception e) + { + throw new RuntimeException( + "unable to set up timeseries Websocket Pool timeseriesConfig=" + this.timeseriesConfig, e); + } + // try { + // // a second timeseries, if you have that use-case + // this.restClient2.overrideRestConfig(this.secondaryTimeseriesConfig); + // this.timeseriesFactory2.overrideConfig(this.secondaryTimeseriesConfig); + // log.debug("init secondary timeseries properties=" + this.secondaryTimeseriesConfig.toString()); + // // if write privs to 2nd timeseries are revoked do not uncomment + // // this or you'll get 401 unauthorized + // // this.timeseriesFactory2.createConnectionToTimeseriesWebsocket(); + // createMetrics(); + // } catch (Exception e) { + // throw new RuntimeException("unable to set up timeseries Websocket Pool secondaryTimeseriesConfig=" + // + this.secondaryTimeseriesConfig, e); + // } + } + + @Override + public Response greetings() + { + return handleResult("Greetings from CXF Bean Rest Service " + new Date()); //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * @see com.ge.predix.solsvc.api.WindDataAPI#getWindDataTags() + */ + @SuppressWarnings("nls") + @Override + public Response getWindDataTags(String authorization) + { + try + { + List
headers = this.timeseriesClient.getTimeseriesHeaders(); + TagsList tagsList = this.timeseriesClient.listTags(headers); + + // example of calling 2nd time series + // List
headers2 = this.restClient2.getSecureTokenForClientId(); + // this.restClient2.addZoneToHeaders(headers2, this.secondaryTimeseriesConfig.getZoneId()); + // TagsList tagsList2 = this.timeseriesFactory2.listTags(headers2); + // tagsList.getResults().add("*****************************"); + // tagsList.getResults().add(this.timeseriesConfig.toString()); + // tagsList.getResults().add("*****************************"); + // tagsList.getResults().add(this.secondaryTimeseriesConfig.toString()); + // tagsList.getResults().add("*****************************"); + // tagsList.getResults().addAll(tagsList2.getResults()); + + return handleResult(tagsList); + } + catch (Throwable e) + { + log.error("unable to get wind data, config=" + this.timeseriesConfig, e); + // This is sample code so we need to easily show you what went + // wrong, please convert your app to show appropriate info to end + // users. For security + // reasons do not expose these properties. + throw new RuntimeException( + "unable to get wind data, errorMsg=" + e.getMessage() + ". config=" + this.timeseriesConfig, e); + } + } + + @SuppressWarnings("nls") + @Override + public Response getYearlyWindDataPoints(String id, String authorization, String starttime, String taglimit, + String tagorder) + { + try + { + if ( id == null ) + { + return null; + } + + List
headers = this.timeseriesClient.getTimeseriesHeaders(); + + DatapointsQuery dpQuery = buildDatapointsQueryRequest(id, starttime, getInteger(taglimit), tagorder); + DatapointsResponse response = this.timeseriesClient.queryForDatapoints(dpQuery, headers); + log.debug(response.toString()); + return handleResult(response); + } + catch (Throwable e) + { + log.error("unable to get wind data, config=" + this.timeseriesConfig, e); + // This is sample code so we need to easily show you what went + // wrong, please convert your app to show appropriate info to end + // users. For security + // reasons do not expose these properties. + throw new RuntimeException( + "unable to get wind data, errorMsg=" + e.getMessage() + ". config=" + this.timeseriesConfig, e); + } + } + + /** + * + * @param s + * - + * @return + */ + private int getInteger(String s) + { + int inValue = 25; + try + { + inValue = Integer.parseInt(s); + + } + catch (NumberFormatException ex) + { + // s is not an integer + } + return inValue; + } + + @SuppressWarnings("nls") + @Override + public Response getLatestWindDataPoints(String id, String authorization) + { + try + { + if ( id == null ) + { + return null; + } + List
headers = this.timeseriesClient.getTimeseriesHeaders(); + + DatapointsLatestQuery dpQuery = buildLatestDatapointsQueryRequest(id); + DatapointsResponse response = this.timeseriesClient.queryForLatestDatapoint(dpQuery, headers); + log.debug(response.toString()); + + return handleResult(response); + } + catch (Throwable e) + { + log.error("unable to get wind data, config=" + this.timeseriesConfig, e); + // This is sample code so we need to easily show you what went + // wrong, please convert your app to show appropriate info to end + // users. For security + // reasons do not expose these properties. + throw new RuntimeException( + "unable to get wind data, errorMsg=" + e.getMessage() + ". config=" + this.timeseriesConfig, e); + + } + } + + private DatapointsLatestQuery buildLatestDatapointsQueryRequest(String id) + { + DatapointsLatestQuery datapointsLatestQuery = new DatapointsLatestQuery(); + + com.ge.predix.entity.timeseries.datapoints.queryrequest.latest.Tag tag = new com.ge.predix.entity.timeseries.datapoints.queryrequest.latest.Tag(); + tag.setName(id); + List tags = new ArrayList(); + tags.add(tag); + datapointsLatestQuery.setTags(tags); + return datapointsLatestQuery; + } + + /** + * + * @param id + * @param startDuration + * @param tagorder + * @return + */ + private DatapointsQuery buildDatapointsQueryRequest(String id, String startDuration, int taglimit, String tagorder) + { + DatapointsQuery datapointsQuery = new DatapointsQuery(); + List tags = new ArrayList(); + datapointsQuery.setStart(startDuration); + // datapointsQuery.setStart("1y-ago"); //$NON-NLS-1$ + String[] tagArray = id.split(","); //$NON-NLS-1$ + List entryTags = Arrays.asList(tagArray); + + for (String entryTag : entryTags) + { + com.ge.predix.entity.timeseries.datapoints.queryrequest.Tag tag = new com.ge.predix.entity.timeseries.datapoints.queryrequest.Tag(); + tag.setName(entryTag); + tag.setLimit(taglimit); + tag.setOrder(tagorder); + tags.add(tag); + } + datapointsQuery.setTags(tags); + return datapointsQuery; + } + + @SuppressWarnings( + { + "nls", "unchecked" + }) + private void createMetrics() + { + for (int i = 0; i < 10; i++) + { + DatapointsIngestion dpIngestion = new DatapointsIngestion(); + dpIngestion.setMessageId(String.valueOf(System.currentTimeMillis())); + + Body body = new Body(); + body.setName("Compressor-2015:CompressionRatio"); //$NON-NLS-1$ + List datapoint1 = new ArrayList(); + datapoint1.add(generateTimestampsWithinYear(System.currentTimeMillis())); + datapoint1.add(10); + datapoint1.add(3); // quality + + List datapoint2 = new ArrayList(); + datapoint2.add(generateTimestampsWithinYear(System.currentTimeMillis())); + datapoint2.add(9); + datapoint2.add(1); // quality + + List datapoint3 = new ArrayList(); + datapoint3.add(generateTimestampsWithinYear(System.currentTimeMillis())); + datapoint3.add(27); + datapoint3.add(0); // quality + + List datapoint4 = new ArrayList(); + datapoint4.add(generateTimestampsWithinYear(System.currentTimeMillis())); + datapoint4.add(78); + datapoint4.add(2); // quality + + List datapoint5 = new ArrayList(); + datapoint5.add(generateTimestampsWithinYear(System.currentTimeMillis())); + datapoint5.add(2); + datapoint5.add(3); // quality + + List datapoint6 = new ArrayList(); + datapoint6.add(generateTimestampsWithinYear(System.currentTimeMillis())); + datapoint6.add(98); + datapoint6.add(1); // quality + + List datapoints = new ArrayList(); + datapoints.add(datapoint1); + datapoints.add(datapoint2); + datapoints.add(datapoint3); + datapoints.add(datapoint4); + datapoints.add(datapoint5); + datapoints.add(datapoint6); + + body.setDatapoints(datapoints); + + com.ge.predix.entity.util.map.Map map = new com.ge.predix.entity.util.map.Map(); + map.put("host", "server1"); //$NON-NLS-2$ + map.put("customer", "Acme"); //$NON-NLS-2$ + + body.setAttributes(map); + + List bodies = new ArrayList(); + bodies.add(body); + + dpIngestion.setBody(bodies); + this.timeseriesClient.postDataToTimeseriesWebsocket(dpIngestion); + } + } + + @SuppressWarnings("javadoc") + protected Response handleResult(Object entity) + { + ResponseBuilder responseBuilder = Response.status(Status.OK); + responseBuilder.type(MediaType.APPLICATION_JSON); + responseBuilder.entity(entity); + return responseBuilder.build(); + } + + private Long generateTimestampsWithinYear(Long current) + { + long yearInMMS = Long.valueOf(31536000000L); + return ThreadLocalRandom.current().nextLong(current - yearInMMS, current + 1); + } } diff --git a/src/test/java/com/ge/predix/solsvc/boot/WindDataServiceIT.java b/src/test/java/com/ge/predix/solsvc/boot/WindDataServiceIT.java index 42a30a4..6ab014a 100755 --- a/src/test/java/com/ge/predix/solsvc/boot/WindDataServiceIT.java +++ b/src/test/java/com/ge/predix/solsvc/boot/WindDataServiceIT.java @@ -17,7 +17,6 @@ import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.boot.test.TestRestTemplate; -import org.springframework.context.annotation.ComponentScan; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -39,7 +38,6 @@ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration -@ComponentScan("com.ge.predix.solsvc.restclient") @ActiveProfiles("local") @IntegrationTest({"server.port=0"}) public class WindDataServiceIT {