use of org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase in project so by onap.
the class GrpcNettyServer method start.
@PostConstruct
public void start() throws IOException {
final BluePrintProcessingServiceImplBase blueprintPrcessorImpl = new BluePrintProcessingServiceImplBase() {
@Override
public StreamObserver<ExecutionServiceInput> process(StreamObserver<ExecutionServiceOutput> 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().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());
}
use of org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase in project so by onap.
the class CDSProcessingClientTest method setUp.
@Before
public void setUp() throws Exception {
String serverName = InProcessServerBuilder.generateName();
grpcCleanup.register(InProcessServerBuilder.forName(serverName).fallbackHandlerRegistry(serviceRegistry).directExecutor().build().start());
handler = new CDSProcessingHandler(listener);
client = new CDSProcessingClient(InProcessChannelBuilder.forName(serverName).directExecutor().build(), handler);
final BluePrintProcessingServiceImplBase routeChatImpl = new BluePrintProcessingServiceImplBase() {
@Override
public StreamObserver<ExecutionServiceInput> process(StreamObserver<ExecutionServiceOutput> responseObserver) {
responseObserverRef.set(responseObserver);
StreamObserver<ExecutionServiceInput> requestObserver = new StreamObserver<ExecutionServiceInput>() {
@Override
public void onNext(ExecutionServiceInput message) {
messagesDelivered.add(message.getActionIdentifiers().getActionName());
}
@Override
public void onError(Throwable t) {
}
@Override
public void onCompleted() {
allRequestsDelivered.countDown();
}
};
return requestObserver;
}
};
serviceRegistry.addService(routeChatImpl);
}
Aggregations