diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java')
-rw-r--r-- | bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java | 95 |
1 files changed, 44 insertions, 51 deletions
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java index bf4a015e36..9521e68e16 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/GrpcNettyServer.java @@ -1,20 +1,15 @@ /* - * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ 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. + * 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. * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= */ package org.onap.so; @@ -60,50 +55,48 @@ public class GrpcNettyServer extends BluePrintProcessingServiceImplBase { @PostConstruct public void start() throws IOException { - final BluePrintProcessingServiceImplBase blueprintPrcessorImpl = - new BluePrintProcessingServiceImplBase() { - @Override - public StreamObserver<ExecutionServiceInput> process( + final BluePrintProcessingServiceImplBase blueprintPrcessorImpl = new BluePrintProcessingServiceImplBase() { + @Override + public StreamObserver<ExecutionServiceInput> process( StreamObserver<ExecutionServiceOutput> responseObserver) { - responseObserverRef.set(responseObserver); + responseObserverRef.set(responseObserver); - StreamObserver<ExecutionServiceInput> requestObserver = new StreamObserver<ExecutionServiceInput>() { - @Override - public void onNext(ExecutionServiceInput message) { - detailedMessages.add(message); - logger.info("Message received: {}", message); - ExecutionServiceOutput executionServiceOutput = ExecutionServiceOutput.newBuilder() + StreamObserver<ExecutionServiceInput> requestObserver = new StreamObserver<ExecutionServiceInput>() { + @Override + public void onNext(ExecutionServiceInput message) { + detailedMessages.add(message); + logger.info("Message received: {}", message); + ExecutionServiceOutput executionServiceOutput = ExecutionServiceOutput.newBuilder() .setActionIdentifiers(message.getActionIdentifiers()) - .setStatus(Status.newBuilder().setEventType( - EventType.EVENT_COMPONENT_EXECUTED).build()).build(); - - responseObserverRef.get().onNext(executionServiceOutput); - logger.info("Message sent: {}", executionServiceOutput); - } - - @Override - public void onError(Throwable t) { - responseObserverRef.get().onError(t); - } - - @Override - public void onCompleted() { - allRequestsDelivered.countDown(); - responseObserverRef.get().onCompleted(); - } - }; - - return requestObserver; - } - }; - grpcCleanup.register( - ServerBuilder.forPort(Integer.valueOf(port)).directExecutor().addService(blueprintPrcessorImpl).build() - .start()); + .setStatus(Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_EXECUTED).build()) + .build(); + + responseObserverRef.get().onNext(executionServiceOutput); + logger.info("Message sent: {}", executionServiceOutput); + } + + @Override + public void onError(Throwable t) { + responseObserverRef.get().onError(t); + } + + @Override + public void onCompleted() { + allRequestsDelivered.countDown(); + responseObserverRef.get().onCompleted(); + } + }; + + return requestObserver; + } + }; + grpcCleanup.register(ServerBuilder.forPort(Integer.valueOf(port)).directExecutor() + .addService(blueprintPrcessorImpl).build().start()); } - public List<ExecutionServiceInput> getDetailedMessages(){ + public List<ExecutionServiceInput> getDetailedMessages() { return this.detailedMessages; } |