|
Lines 68-74
Link Here
|
| 68 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); |
68 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); |
| 69 |
|
69 |
|
| 70 |
/* Check accessibility */ |
70 |
/* Check accessibility */ |
| 71 |
assertEquals("ALL", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); |
71 |
assertEquals("ALL", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); |
| 72 |
|
72 |
|
| 73 |
/* Check security */ |
73 |
/* Check security */ |
| 74 |
assertEquals("false", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); |
74 |
assertEquals("false", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); |
|
Lines 87-93
Link Here
|
| 87 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); |
87 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); |
| 88 |
|
88 |
|
| 89 |
/* Check accessibility */ |
89 |
/* Check accessibility */ |
| 90 |
assertEquals("LOCAL", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); |
90 |
assertEquals("LOCAL", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); |
| 91 |
|
91 |
|
| 92 |
/* Check security */ |
92 |
/* Check security */ |
| 93 |
assertEquals("false", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); |
93 |
assertEquals("false", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); |
|
Lines 101-120
Link Here
|
| 101 |
Document document = AdminUtil.parseFile(configLocation, false); |
101 |
Document document = AdminUtil.parseFile(configLocation, false); |
| 102 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
102 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
| 103 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
103 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
| 104 |
assertEquals("localhost", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); /* Check accessibility */ |
104 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); /* Check accessibility */ |
|
|
105 |
assertEquals("localhost", AdminUtil.getAttributeOfElement(document, "Allow", "list", 0)); /* Check accessibility */ |
| 105 |
assertEquals("false", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
106 |
assertEquals("false", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
| 106 |
|
107 |
|
| 107 |
/* Check with empty string passed in for hosts */ |
108 |
/* Check with empty string passed in for hosts */ |
| 108 |
configGenerator.customAccessWithNoSecurity("", acHome, javaExecutable, pluginsFolder, plugins); |
109 |
configGenerator.customAccessWithNoSecurity("", acHome, javaExecutable, pluginsFolder, plugins); |
| 109 |
document = AdminUtil.parseFile(configLocation, false); |
110 |
document = AdminUtil.parseFile(configLocation, false); |
| 110 |
assertEquals("localhost", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); |
111 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); |
|
|
112 |
assertEquals("localhost", AdminUtil.getAttributeOfElement(document, "Allow", "list", 0)); |
| 111 |
|
113 |
|
| 112 |
/* Check with specific machines passed in for hosts */ |
114 |
/* Check with specific machines passed in for hosts */ |
| 113 |
configGenerator.customAccessWithNoSecurity("host1, host2, host3", acHome, javaExecutable, pluginsFolder, plugins); |
115 |
configGenerator.customAccessWithNoSecurity("host1, host2, host3", acHome, javaExecutable, pluginsFolder, plugins); |
| 114 |
document = AdminUtil.parseFile(configLocation, false); |
116 |
document = AdminUtil.parseFile(configLocation, false); |
| 115 |
assertEquals("host1", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); |
117 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); |
| 116 |
assertEquals("host2", AdminUtil.getAttributeOfElement(document, "Allow", "host", 1)); |
118 |
assertEquals("host1, host2, host3", AdminUtil.getAttributeOfElement(document, "Allow", "list", 0)); |
| 117 |
assertEquals("host3", AdminUtil.getAttributeOfElement(document, "Allow", "host", 2)); |
|
|
| 118 |
} |
119 |
} |
| 119 |
|
120 |
|
| 120 |
public void testAllowAllWithSecurity() { |
121 |
public void testAllowAllWithSecurity() { |
|
Lines 125-157
Link Here
|
| 125 |
Document document = AdminUtil.parseFile(configLocation, false); |
126 |
Document document = AdminUtil.parseFile(configLocation, false); |
| 126 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
127 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
| 127 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
128 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
| 128 |
assertEquals("ALL", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); /* Check accessibility */ |
129 |
assertEquals("ALL", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); /* Check accessibility */ |
| 129 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
130 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
| 130 |
assertEquals("ANY", AdminUtil.getElementValue(document, "UserDefinition", 0)); |
131 |
assertEquals("ANY", AdminUtil.getAttributeOfElement(document, "UserDefinition", "type", 0)); |
| 131 |
|
132 |
|
| 132 |
/* Check with empty string passed in for users */ |
133 |
/* Check with empty string passed in for users */ |
| 133 |
configGenerator.allowAllWithSecurity("", "", acHome, javaExecutable, pluginsFolder, plugins); |
134 |
configGenerator.allowAllWithSecurity("", "", acHome, javaExecutable, pluginsFolder, plugins); |
| 134 |
document = AdminUtil.parseFile(configLocation, false); |
135 |
document = AdminUtil.parseFile(configLocation, false); |
| 135 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
136 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
| 136 |
assertEquals("ANY", AdminUtil.getElementValue(document, "UserDefinition", 0)); |
137 |
assertEquals("ANY", AdminUtil.getAttributeOfElement(document, "UserDefinition", "type", 0)); |
| 137 |
|
138 |
|
| 138 |
/* Check with specific users passed in for users */ |
139 |
/* Check with specific users passed in for users */ |
| 139 |
configGenerator.allowAllWithSecurity("CUSTOM", "user1,user2,user3", acHome, javaExecutable, pluginsFolder, plugins); |
140 |
configGenerator.allowAllWithSecurity("CUSTOM", "user1,user2,user3", acHome, javaExecutable, pluginsFolder, plugins); |
| 140 |
document = AdminUtil.parseFile(configLocation, false); |
141 |
document = AdminUtil.parseFile(configLocation, false); |
| 141 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
142 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
| 142 |
assertEquals("user1,user2,user3", AdminUtil.getElementValue(document, "UserDefinition", 0)); |
143 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "UserDefinition", "type", 0)); |
|
|
144 |
assertEquals("user1,user2,user3", AdminUtil.getAttributeOfElement(document, "UserDefinition", "list", 0)); |
| 143 |
} |
145 |
} |
| 144 |
|
146 |
|
| 145 |
public void testSetUpLocallyWithSecurity() { |
147 |
public void testSetUpLocallyWithSecurity() { |
| 146 |
ConfigGenerator configGenerator = new ConfigGenerator(); |
148 |
ConfigGenerator configGenerator = new ConfigGenerator(); |
| 147 |
configGenerator.setUpLocallyWithSecurity("ANY", "user1, user2, user3", acHome, javaExecutable, pluginsFolder, plugins); |
149 |
configGenerator.setUpLocallyWithSecurity("CUSTOM", "user1, user2, user3", acHome, javaExecutable, pluginsFolder, plugins); |
| 148 |
|
150 |
|
| 149 |
Document document = AdminUtil.parseFile(configLocation, false); |
151 |
Document document = AdminUtil.parseFile(configLocation, false); |
| 150 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
152 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
| 151 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
153 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
| 152 |
assertEquals("LOCAL", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); /* Check accessibility */ |
154 |
assertEquals("LOCAL", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); /* Check accessibility */ |
| 153 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
155 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
| 154 |
assertEquals("user1,user2,user3", AdminUtil.getElementValue(document, "UserDefinition", 0)); |
156 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "UserDefinition", "type", 0)); |
|
|
157 |
assertEquals("user1,user2,user3", AdminUtil.getAttributeOfElement(document, "UserDefinition", "list", 0)); |
| 155 |
} |
158 |
} |
| 156 |
|
159 |
|
| 157 |
public void testCustomAccessWithSecurity() { |
160 |
public void testCustomAccessWithSecurity() { |
|
Lines 161-171
Link Here
|
| 161 |
Document document = AdminUtil.parseFile(configLocation, false); |
164 |
Document document = AdminUtil.parseFile(configLocation, false); |
| 162 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
165 |
assertEquals(javaExecutable, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "JAVA_PATH", "value")); /* Check java executable */ |
| 163 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
166 |
assertEquals(acHome, AdminUtil.getAttributeWithMoreDetails(document, "Variable", "name", "RASERVER_HOME", "value")); /* Check AC home */ |
| 164 |
assertEquals("host1", AdminUtil.getAttributeOfElement(document, "Allow", "host", 0)); /* Check accessibility */ |
167 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "Allow", "type", 0)); /* Check accessibility */ |
| 165 |
assertEquals("host2", AdminUtil.getAttributeOfElement(document, "Allow", "host", 1)); /* Check accessibility */ |
168 |
assertEquals("host1, host2, host3", AdminUtil.getAttributeOfElement(document, "Allow", "list", 0)); /* Check accessibility */ |
| 166 |
assertEquals("host3", AdminUtil.getAttributeOfElement(document, "Allow", "host", 2)); /* Check accessibility */ |
|
|
| 167 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
169 |
assertEquals("true", AdminUtil.getElementValue(document, "SecurityEnabled", 0)); /* Check security */ |
| 168 |
assertEquals("user1,user2,user3", AdminUtil.getElementValue(document, "UserDefinition", 0)); |
170 |
assertEquals("CUSTOM", AdminUtil.getAttributeOfElement(document, "UserDefinition", "type", 0)); |
|
|
171 |
assertEquals("user1,user2,user3", AdminUtil.getAttributeOfElement(document, "UserDefinition", "list", 0)); |
| 169 |
} |
172 |
} |
| 170 |
|
173 |
|
| 171 |
} |
174 |
} |