diff options
Diffstat (limited to 'ms/blueprintsprocessor/application')
-rwxr-xr-x | ms/blueprintsprocessor/application/pom.xml | 5 | ||||
-rw-r--r-- | ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java | 1 | ||||
-rw-r--r-- | ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java (renamed from ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcDisable.java) | 5 | ||||
-rw-r--r-- | ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java | 56 | ||||
-rw-r--r-- | ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java | 55 |
5 files changed, 3 insertions, 119 deletions
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml index 2e94b7b11..4e487304c 100755 --- a/ms/blueprintsprocessor/application/pom.xml +++ b/ms/blueprintsprocessor/application/pom.xml @@ -17,13 +17,12 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> <artifactId>parent</artifactId> - <version>0.5.0-SNAPSHOT</version> + <version>0.5.2-SNAPSHOT</version> <relativePath>../parent</relativePath> </parent> <artifactId>application</artifactId> diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java index 6bb6a2697..5ad6ee205 100644 --- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.java @@ -59,7 +59,6 @@ public class BlueprintGRPCServer implements ApplicationListener<ContextRefreshed server.start(); log.info("Blueprint Processor GRPC server started and ready to serve on port({})...", server.getPort()); - server.awaitTermination(); } catch (Exception e) { log.error("*** Error ***", e); } diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcDisable.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java index c20a324d5..85ccd1f43 100644 --- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcDisable.java +++ b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.java @@ -17,15 +17,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.stereotype.Component; -// When GRPC disable, no need to create the netty server -@ConditionalOnProperty(name = "blueprintsprocessor.grpcEnable", havingValue = "false") @Component -public class HttpServerWhenGrpcDisable implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> { +public class BlueprintHttpServer implements WebServerFactoryCustomizer<NettyReactiveWebServerFactory> { @Value("${blueprintsprocessor.httpPort}") private Integer httpPort; diff --git a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java b/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java deleted file mode 100644 index e769b9361..000000000 --- a/ms/blueprintsprocessor/application/src/main/java/org/onap/ccsdk/cds/blueprintsprocessor/HttpServerWhenGrpcEnable.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2019 Bell Canada. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onap.ccsdk.cds.blueprintsprocessor; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; -import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory; -import org.springframework.boot.web.server.WebServer; -import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.stereotype.Component; - -// When GRPC enable, we need to manually create the netty server -@ConditionalOnProperty(name = "blueprintsprocessor.grpcEnable", havingValue = "true") -@Component -public class HttpServerWhenGrpcEnable { - - @Value("${blueprintsprocessor.httpPort}") - private Integer httpPort; - - private final HttpHandler httpHandler; - private WebServer http; - - @Autowired - public HttpServerWhenGrpcEnable(HttpHandler httpHandler) { - this.httpHandler = httpHandler; - } - - @PostConstruct - public void start() { - ReactiveWebServerFactory factory = new NettyReactiveWebServerFactory(httpPort); - this.http = factory.getWebServer(this.httpHandler); - this.http.start(); - } - - @PreDestroy - public void stop() { - this.http.stop(); - } -}
\ No newline at end of file diff --git a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java deleted file mode 100644 index d2d8ea58d..000000000 --- a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintProcessorApplicationTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 IBM. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.onap.ccsdk.cds.blueprintsprocessor; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -/** - * BlueprintProcessorApplicationTest - * - * @author Brinda Santh - * DATE : 8/14/2018 - */ -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {BlueprintProcessorApplication.class}) -@SpringBootTest(classes = BlueprintProcessorApplication.class, - webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class BlueprintProcessorApplicationTest { - - @Autowired - private ApplicationContext context; - - @Before - public void setUp() { - - } - - @Test - public void testSample() { - Assert.assertNotNull("Failed to create Application Context ", context); - } - -} |