Package: KuraDisconnectPayload

KuraDisconnectPayload

nameinstructionbranchcomplexitylinemethod
KuraDisconnectPayload(KuraPayload)
M: 0 C: 27
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 8
100%
M: 0 C: 1
100%
KuraDisconnectPayload(String, String)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getDisplayName()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getUptime()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011, 2019 Eurotech and/or its affiliates
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License v1.0
6: * which accompanies this distribution, and is available at
7: * http://www.eclipse.org/legal/epl-v10.html
8: *
9: * Contributors:
10: * Eurotech
11: *******************************************************************************/
12: package org.eclipse.kura.message;
13:
14: import java.util.Iterator;
15:
16: /**
17: * The KuraDisconnectPayload is an extension of {@link KuraPayload} that contains the parameters stored in a message
18: * that is usually published when disconnecting from the broker.
19: *
20: * @noextend This class is not intended to be subclassed by clients.
21: * @since 2.1
22: */
23: public class KuraDisconnectPayload extends KuraPayload {
24:
25: private static final String UPTIME = "uptime";
26: private static final String DISPLAY_NAME = "display_name";
27:
28: public KuraDisconnectPayload(String uptime, String displayName) {
29: super();
30:
31: addMetric(UPTIME, uptime);
32: addMetric(DISPLAY_NAME, displayName);
33: }
34:
35: public KuraDisconnectPayload(KuraPayload kuraMessage) {
36: Iterator<String> hdrIterator = kuraMessage.metricsIterator();
37:• while (hdrIterator.hasNext()) {
38: String hdrName = hdrIterator.next();
39: String hdrVal = (String) kuraMessage.getMetric(hdrName);
40: addMetric(hdrName, hdrVal);
41: }
42: setBody(kuraMessage.getBody());
43: }
44:
45: public String getUptime() {
46: return (String) getMetric(UPTIME);
47: }
48:
49: public String getDisplayName() {
50: return (String) getMetric(DISPLAY_NAME);
51: }
52:
53: @Override
54: public String toString() {
55: return "KuraBirthMessage [getUptime()=" + getUptime() + ", getDisplayName()=" + getDisplayName() + "]";
56: }
57: }