blob: f5148830bc4be6b92c356ceec2517a0c1dfc2391 [file] [log] [blame]
xueliang37a396a2016-09-09 14:43:49 +09001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.drivers.fujitsu;
18
19/**
20 * Mock FujitsuVoltXmlUtility.
21 * This is to avoid using the same names/definitions
22 * in FujitsuVoltXmlUtility in test codes - not tied to actual codes.
23 */
24final class FujitsuVoltXmlUtilityMock {
25
26 public static final String TEST_COLON = ":";
27 public static final String TEST_DOT = ".";
28 public static final String TEST_HYPHEN = "-";
29 public static final String TEST_SLASH = "/";
30 public static final String TEST_SPACE = " ";
31 public static final String TEST_NEW_LINE = "\n";
32 public static final String TEST_ANGLE_LEFT = "<";
33 public static final String TEST_ANGLE_RIGHT = ">";
34
35 public static final String TEST_REPORT_ALL = "report-all";
36 public static final String TEST_RUNNING = "running";
37
38 public static final String TEST_VOLT_NE_NAMESPACE =
39 "xmlns=\"http://fujitsu.com/ns/volt/1.1\"";
40 public static final String TEST_VOLT_NE = "volt-ne";
41 public static final String TEST_PONLINK_ID = "ponlink-id";
42 public static final String TEST_ONU_ID = "onu-id";
43 public static final String TEST_ROOT = "fakeroot";
44
45 public static final String TEST_VOLT_NE_OPEN = TEST_ANGLE_LEFT + TEST_VOLT_NE + TEST_SPACE;
46 public static final String TEST_VOLT_NE_CLOSE = TEST_ANGLE_LEFT + TEST_SLASH + TEST_VOLT_NE + TEST_ANGLE_RIGHT;
47
48 public static final String TEST_BASE_NAMESPACE =
49 " xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n";
50
51 public static final String TEST_DUPLICATE_SPACES_REGEX = " +";
52 public static final String TEST_WHITESPACES_REGEX = "\\s+";
53 public static final String TEST_EMPTY_STRING = "";
54
55 public static final String TEST_VOLT_NAMESPACE = TEST_VOLT_NE_OPEN +
56 TEST_VOLT_NE_NAMESPACE;
57
xueliang5b3d34442016-09-23 10:37:33 +090058 public static final int FIRST_PART = 0;
59 public static final int SECOND_PART = 1;
60 public static final int THIRD_PART = 2;
xueliangffe73e42016-09-27 10:38:56 +090061 public static final int ZERO = 0;
xueliang5b3d34442016-09-23 10:37:33 +090062 public static final int ONE = 1;
xueliangadec4dc2016-10-03 16:57:04 +090063 public static final int THREE = 3;
xueliang37a396a2016-09-09 14:43:49 +090064
65 private FujitsuVoltXmlUtilityMock() {
66 }
67
68 /**
69 * Builds XML start tag with name provided.
70 *
71 * @param name tag name
72 * @return string
73 */
74 public static String startTag(String name) {
75 return startTag(name, true);
76 }
77
78 /**
79 * Builds XML end tag with name provided.
80 *
81 * @param name tag name
82 * @return string
83 */
84 public static String endTag(String name) {
85 return endTag(name, true);
86 }
87
88 /**
89 * Builds XML empty tag with name provided.
90 *
91 * @param name tag name
92 * @return string
93 */
94 public static String emptyTag(String name) {
95 return emptyTag(name, true);
96 }
97
98 /**
99 * Builds XML start tag with name provided.
100 *
101 * @param name tag name
102 * @param addNewLine option to add new line character after tag
103 * @return string
104 */
105 public static String startTag(String name, boolean addNewLine) {
106 if (addNewLine) {
107 return (TEST_ANGLE_LEFT + name + TEST_ANGLE_RIGHT + TEST_NEW_LINE);
108 } else {
109 return (TEST_ANGLE_LEFT + name + TEST_ANGLE_RIGHT);
110 }
111 }
112
113 /**
114 * Builds XML end tag with name provided.
115 *
116 * @param name tag name
117 * @param addNewLine option to add new line character after tag
118 * @return string
119 */
120 public static String endTag(String name, boolean addNewLine) {
121 if (addNewLine) {
122 return (TEST_ANGLE_LEFT + TEST_SLASH + name + TEST_ANGLE_RIGHT + TEST_NEW_LINE);
123 } else {
124 return (TEST_ANGLE_LEFT + TEST_SLASH + name + TEST_ANGLE_RIGHT);
125 }
126 }
127
128 /**
129 * Builds XML empty element tag with name provided.
130 *
131 * @param name tag name
132 * @param addNewLine option to add new line character after tag
133 * @return string
134 */
135 public static String emptyTag(String name, boolean addNewLine) {
136 if (addNewLine) {
137 return (TEST_ANGLE_LEFT + name + TEST_SLASH + TEST_ANGLE_RIGHT + TEST_NEW_LINE);
138 } else {
139 return (TEST_ANGLE_LEFT + name + TEST_SLASH + TEST_ANGLE_RIGHT);
140 }
141 }
142
143}