Skip to content

Package: DefaultApplication

DefaultApplication

nameinstructionbranchcomplexitylinemethod
DefaultApplication(AbstractClient.Context)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
close()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
data(Topic)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
publish(Topic, Payload)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
subscribe(Topic, MessageHandler, ErrorHandler)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
transport()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Red Hat Inc and others.
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Red Hat Inc - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.client.gateway.spi;
14:
15: import java.util.concurrent.CompletionStage;
16:
17: import org.eclipse.kapua.client.gateway.Application;
18: import org.eclipse.kapua.client.gateway.ErrorHandler;
19: import org.eclipse.kapua.client.gateway.MessageHandler;
20: import org.eclipse.kapua.client.gateway.Payload;
21: import org.eclipse.kapua.client.gateway.Topic;
22: import org.eclipse.kapua.client.gateway.Transport;
23:
24: public class DefaultApplication implements Application {
25:
26: private final AbstractClient.Context context;
27:
28: public DefaultApplication(final AbstractClient.Context context) {
29: this.context = context;
30: }
31:
32: @Override
33: public synchronized Transport transport() {
34: return context.transport();
35: }
36:
37: @Override
38: public DefaultData data(Topic topic) {
39: return new DefaultData(this, topic);
40: }
41:
42: @Override
43: public void close() throws Exception {
44: context.close();
45: }
46:
47: protected CompletionStage<?> publish(Topic topic, Payload payload) {
48: return context.publish(topic, payload);
49: }
50:
51: public CompletionStage<?> subscribe(final Topic topic, final MessageHandler handler, final ErrorHandler<? extends Throwable> errorHandler) throws Exception {
52: return context.subscribe(topic, handler, errorHandler);
53: }
54: }