1 | package gov.hhs.fha.nhinc.connectmgr;
|
---|
2 |
|
---|
3 | import gov.hhs.fha.nhinc.connectmgr.data.CMHomeCommunity;
|
---|
4 | import gov.hhs.fha.nhinc.connectmgr.data.CMBusinessEntities;
|
---|
5 | import gov.hhs.fha.nhinc.connectmgr.data.CMBusinessEntity;
|
---|
6 | import gov.hhs.fha.nhinc.connectmgr.data.CMBusinessService;
|
---|
7 | import gov.hhs.fha.nhinc.connectmgr.data.CMContact;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 | import java.util.ArrayList;
|
---|
11 | import org.junit.After;
|
---|
12 | import org.junit.AfterClass;
|
---|
13 | import org.junit.Before;
|
---|
14 | import org.junit.BeforeClass;
|
---|
15 | import org.junit.Test;
|
---|
16 | import static org.junit.Assert.*;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * This class is used to test the ConnectionManagerCache class.
|
---|
20 | *
|
---|
21 | * @author Les Westberg
|
---|
22 | */
|
---|
23 | public class ConnectionManagerCacheTest {
|
---|
24 |
|
---|
25 | public ConnectionManagerCacheTest() {
|
---|
26 | }
|
---|
27 |
|
---|
28 | @BeforeClass
|
---|
29 | public static void setUpClass() throws Exception
|
---|
30 | {
|
---|
31 | // Point to our local copy of the property files for testing purposes.
|
---|
32 | // This will pick up the ones in this project.
|
---|
33 | //--------------------------------------------------------------------
|
---|
34 | ConnectionManagerCache.overrideFileLocations("uddiConnectionInfo.xml", "internalConnectionInfo.xml");
|
---|
35 | }
|
---|
36 |
|
---|
37 | @AfterClass
|
---|
38 | public static void tearDownClass() throws Exception
|
---|
39 | {
|
---|
40 | }
|
---|
41 |
|
---|
42 | @Before
|
---|
43 | public void setUp() {
|
---|
44 | }
|
---|
45 |
|
---|
46 | @After
|
---|
47 | public void tearDown() {
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Test of forceRefreshUDDICache method, of class ConnectionManagerCache.
|
---|
52 | */
|
---|
53 | @Test
|
---|
54 | public void testForceRefreshUDDICache() throws Exception
|
---|
55 | {
|
---|
56 | System.out.println("forceRefreshUDDICache");
|
---|
57 |
|
---|
58 | try
|
---|
59 | {
|
---|
60 | ConnectionManagerCache.forceRefreshUDDICache();
|
---|
61 | }
|
---|
62 | catch (Exception e)
|
---|
63 | {
|
---|
64 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Test of forceRefreshInternalConnectCache method, of class ConnectionManagerCache.
|
---|
70 | */
|
---|
71 | @Test
|
---|
72 | public void testForceRefreshInternalConnectCache() throws Exception
|
---|
73 | {
|
---|
74 | System.out.println("forceRefreshInternalConnectCache");
|
---|
75 |
|
---|
76 | try
|
---|
77 | {
|
---|
78 | ConnectionManagerCache.forceRefreshInternalConnectCache();
|
---|
79 | }
|
---|
80 | catch (Exception e)
|
---|
81 | {
|
---|
82 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Test of getAllCommunities method, of class ConnectionManagerCache.
|
---|
88 | */
|
---|
89 | @Test
|
---|
90 | public void testGetAllCommunities() throws Exception
|
---|
91 | {
|
---|
92 | System.out.println("getAllCommunities");
|
---|
93 |
|
---|
94 | try
|
---|
95 | {
|
---|
96 | List<CMHomeCommunity> oaHomeComm = null;
|
---|
97 | oaHomeComm = ConnectionManagerCache.getAllCommunities();
|
---|
98 | assertNotNull(oaHomeComm);
|
---|
99 | assertEquals(4, oaHomeComm.size());
|
---|
100 | boolean baFound[] = {false, false, false, false};
|
---|
101 |
|
---|
102 | for (CMHomeCommunity oComm : oaHomeComm)
|
---|
103 | {
|
---|
104 | if (oComm.getHomeCommunityId().equals("1111.1111.1111.1111"))
|
---|
105 | {
|
---|
106 | baFound[0] = true;
|
---|
107 | assertEquals("Home1", oComm.getName());
|
---|
108 | assertEquals("Home1 Description", oComm.getDescription());
|
---|
109 | }
|
---|
110 | else if (oComm.getHomeCommunityId().equals("2222.2222.2222.2222"))
|
---|
111 | {
|
---|
112 | baFound[1] = true;
|
---|
113 | assertEquals("Home2", oComm.getName());
|
---|
114 | assertEquals("Home2 Description", oComm.getDescription());
|
---|
115 | }
|
---|
116 | else if (oComm.getHomeCommunityId().equals("1111.1111.1111.1111..2"))
|
---|
117 | {
|
---|
118 | baFound[2] = true;
|
---|
119 | assertEquals("DuplicateFromUDDI Name", oComm.getName());
|
---|
120 | assertEquals("DuplicateFromUDDI Description", oComm.getDescription());
|
---|
121 | }
|
---|
122 | else if (oComm.getHomeCommunityId().equals("1111.1111.1111.1111..1"))
|
---|
123 | {
|
---|
124 | baFound[3] = true;
|
---|
125 | assertEquals("BusinessName.1.1", oComm.getName());
|
---|
126 | assertEquals("BusinessDescription.1.1", oComm.getDescription());
|
---|
127 | }
|
---|
128 | else
|
---|
129 | {
|
---|
130 | fail("Found an unexpected entry. HomeCommunityId:" + oComm.getHomeCommunityId());
|
---|
131 | }
|
---|
132 | }
|
---|
133 | assertTrue(baFound[0]);
|
---|
134 | assertTrue(baFound[1]);
|
---|
135 | assertTrue(baFound[2]);
|
---|
136 | assertTrue(baFound[3]);
|
---|
137 | }
|
---|
138 | catch (Exception e)
|
---|
139 | {
|
---|
140 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
141 | }
|
---|
142 |
|
---|
143 | }
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * This method validates the entire contents of a business entity for
|
---|
147 | * HomeCommunity 1111.1111.1111.1111
|
---|
148 | *
|
---|
149 | * @param oEntity The business entity for this home community.
|
---|
150 | * @param sUniformServiceName If this is passed, then it will validate all of the
|
---|
151 | * general stuff and only the one specific service and that
|
---|
152 | * the service is the only one that exists.
|
---|
153 | */
|
---|
154 | private void validateEntity_1111_1111_1111_1111(CMBusinessEntity oEntity, String sUniformServiceName)
|
---|
155 | {
|
---|
156 | assertNotNull(oEntity);
|
---|
157 | assertEquals("1111.1111.1111.1111", oEntity.getHomeCommunityId());
|
---|
158 |
|
---|
159 | assertNotNull(oEntity.getNames());
|
---|
160 | assertEquals(1, oEntity.getNames().getBusinessName().size());
|
---|
161 | assertEquals("Home1", oEntity.getNames().getBusinessName().get(0));
|
---|
162 |
|
---|
163 | assertNotNull(oEntity.getDescriptions());
|
---|
164 | assertEquals(1, oEntity.getDescriptions().getBusinessDescription().size());
|
---|
165 | assertEquals("Home1 Description", oEntity.getDescriptions().getBusinessDescription().get(0));
|
---|
166 |
|
---|
167 | assertNotNull(oEntity.getBusinessServices());
|
---|
168 | assertNotNull(oEntity.getBusinessServices().getBusinessService());
|
---|
169 |
|
---|
170 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
171 | {
|
---|
172 | assertEquals(2, oEntity.getBusinessServices().getBusinessService().size());
|
---|
173 | }
|
---|
174 | else
|
---|
175 | {
|
---|
176 | assertEquals(1, oEntity.getBusinessServices().getBusinessService().size());
|
---|
177 | }
|
---|
178 |
|
---|
179 | boolean baFoundService[] = {false, false};
|
---|
180 | boolean bMatchedService = false; // Used when we are looking just for one service.
|
---|
181 | for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
182 | {
|
---|
183 | if (oService.getUniformServiceName().equals("Service 1 Name"))
|
---|
184 | {
|
---|
185 | baFoundService[0] = true;
|
---|
186 | assertNotNull(oService.getDescriptions());
|
---|
187 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
188 | assertEquals(1, oService.getDescriptions().getDescription().size());
|
---|
189 | assertEquals("Service 1 Description", oService.getDescriptions().getDescription().get(0));
|
---|
190 |
|
---|
191 | assertEquals(false, oService.isInternalWebService());
|
---|
192 |
|
---|
193 | assertNotNull(oService.getBindingTemplates());
|
---|
194 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
195 | assertEquals(1, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
196 | assertEquals("http://www.service1.com", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
197 | }
|
---|
198 | else if (oService.getUniformServiceName().equals("Service 2 Name"))
|
---|
199 | {
|
---|
200 | baFoundService[1] = true;
|
---|
201 | assertNotNull(oService.getDescriptions());
|
---|
202 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
203 | assertEquals(1, oService.getDescriptions().getDescription().size());
|
---|
204 | assertEquals("Service 2 Description", oService.getDescriptions().getDescription().get(0));
|
---|
205 |
|
---|
206 | assertEquals(true, oService.isInternalWebService());
|
---|
207 |
|
---|
208 | assertNotNull(oService.getBindingTemplates());
|
---|
209 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
210 | assertEquals(1, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
211 | assertEquals("http://www.service2.com", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
212 | }
|
---|
213 | else
|
---|
214 | {
|
---|
215 | fail("Found an unexpected service: " + oService.getUniformServiceName());
|
---|
216 | }
|
---|
217 |
|
---|
218 | // We can check this here because if it does not match either of the two specified, we will
|
---|
219 | // get an error. So we are guaranteed that we will either fail before we are done, or
|
---|
220 | // that everything is in order.
|
---|
221 | //------------------------------------------------------------------------------------------
|
---|
222 | if ((sUniformServiceName != null) && (sUniformServiceName.equals(oService.getUniformServiceName())))
|
---|
223 | {
|
---|
224 | bMatchedService = true;
|
---|
225 | }
|
---|
226 |
|
---|
227 |
|
---|
228 | } // for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
229 |
|
---|
230 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
231 | {
|
---|
232 | assertTrue(baFoundService[0]);
|
---|
233 | assertTrue(baFoundService[1]);
|
---|
234 | }
|
---|
235 | else
|
---|
236 | {
|
---|
237 | assertTrue(bMatchedService);
|
---|
238 | }
|
---|
239 |
|
---|
240 | }
|
---|
241 |
|
---|
242 | /**
|
---|
243 | * This method validates the entire contents of a business entity for
|
---|
244 | * HomeCommunity 2222.2222.2222.2222
|
---|
245 | *
|
---|
246 | * @param oEntity The business entity for this home community.
|
---|
247 | * @param sUniformServiceName If this is passed, then it will validate all of the
|
---|
248 | * general stuff and only the one specific service and that
|
---|
249 | * the service is the only one that exists.
|
---|
250 | *
|
---|
251 | */
|
---|
252 | private void validateEntity_2222_2222_2222_2222(CMBusinessEntity oEntity, String sUniformServiceName)
|
---|
253 | {
|
---|
254 | assertNotNull(oEntity);
|
---|
255 | assertEquals("2222.2222.2222.2222", oEntity.getHomeCommunityId());
|
---|
256 |
|
---|
257 | assertNotNull(oEntity.getNames());
|
---|
258 | assertEquals(1, oEntity.getNames().getBusinessName().size());
|
---|
259 | assertEquals("Home2", oEntity.getNames().getBusinessName().get(0));
|
---|
260 |
|
---|
261 | assertNotNull(oEntity.getDescriptions());
|
---|
262 | assertEquals(1, oEntity.getDescriptions().getBusinessDescription().size());
|
---|
263 | assertEquals("Home2 Description", oEntity.getDescriptions().getBusinessDescription().get(0));
|
---|
264 |
|
---|
265 | assertNotNull(oEntity.getBusinessServices());
|
---|
266 | assertNotNull(oEntity.getBusinessServices().getBusinessService());
|
---|
267 |
|
---|
268 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
269 | {
|
---|
270 | assertEquals(2, oEntity.getBusinessServices().getBusinessService().size());
|
---|
271 | }
|
---|
272 | else
|
---|
273 | {
|
---|
274 | assertEquals(1, oEntity.getBusinessServices().getBusinessService().size());
|
---|
275 | }
|
---|
276 |
|
---|
277 | boolean baFoundService[] = {false, false};
|
---|
278 | boolean bMatchedService = false; // Used when we are looking just for one service.
|
---|
279 | for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
280 | {
|
---|
281 | if (oService.getUniformServiceName().equals("Service 3 Name"))
|
---|
282 | {
|
---|
283 | baFoundService[0] = true;
|
---|
284 | assertNotNull(oService.getDescriptions());
|
---|
285 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
286 | assertEquals(1, oService.getDescriptions().getDescription().size());
|
---|
287 | assertEquals("Service 3 Description", oService.getDescriptions().getDescription().get(0));
|
---|
288 |
|
---|
289 | assertEquals(false, oService.isInternalWebService());
|
---|
290 |
|
---|
291 | assertNotNull(oService.getBindingTemplates());
|
---|
292 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
293 | assertEquals(1, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
294 | assertEquals("http://www.service3.com", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
295 | }
|
---|
296 | else if (oService.getUniformServiceName().equals("Service 4 Name"))
|
---|
297 | {
|
---|
298 | baFoundService[1] = true;
|
---|
299 | assertNotNull(oService.getDescriptions());
|
---|
300 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
301 | assertEquals(1, oService.getDescriptions().getDescription().size());
|
---|
302 | assertEquals("Service 4 Description", oService.getDescriptions().getDescription().get(0));
|
---|
303 |
|
---|
304 | assertEquals(true, oService.isInternalWebService());
|
---|
305 |
|
---|
306 | assertNotNull(oService.getBindingTemplates());
|
---|
307 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
308 | assertEquals(1, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
309 | assertEquals("http://www.service4.com", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
310 | }
|
---|
311 | else
|
---|
312 | {
|
---|
313 | fail("Found an unexpected service: " + oService.getUniformServiceName());
|
---|
314 | }
|
---|
315 |
|
---|
316 | // We can check this here because if it does not match either of the two specified, we will
|
---|
317 | // get an error. So we are guaranteed that we will either fail before we are done, or
|
---|
318 | // that everything is in order.
|
---|
319 | //------------------------------------------------------------------------------------------
|
---|
320 | if ((sUniformServiceName != null) && (sUniformServiceName.equals(oService.getUniformServiceName())))
|
---|
321 | {
|
---|
322 | bMatchedService = true;
|
---|
323 | }
|
---|
324 |
|
---|
325 | } // for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
326 |
|
---|
327 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
328 | {
|
---|
329 | assertTrue(baFoundService[0]);
|
---|
330 | assertTrue(baFoundService[1]);
|
---|
331 | }
|
---|
332 | else
|
---|
333 | {
|
---|
334 | assertTrue(bMatchedService);
|
---|
335 | }
|
---|
336 |
|
---|
337 | }
|
---|
338 |
|
---|
339 | /**
|
---|
340 | * This method validates the entire contents of a business entity for
|
---|
341 | * HomeCommunity 1111.1111.1111.1111..2
|
---|
342 | *
|
---|
343 | * @param oEntity The business entity for this home community.
|
---|
344 | * @param sUniformServiceName If this is passed, then it will validate all of the
|
---|
345 | * general stuff and only the one specific service and that
|
---|
346 | * the service is the only one that exists.
|
---|
347 | */
|
---|
348 | private void validateEntity_1111_1111_1111_1111__2(CMBusinessEntity oEntity, String sUniformServiceName)
|
---|
349 | {
|
---|
350 | assertNotNull(oEntity);
|
---|
351 | assertEquals("1111.1111.1111.1111..2", oEntity.getHomeCommunityId());
|
---|
352 |
|
---|
353 | assertNotNull(oEntity.getDiscoveryURLs());
|
---|
354 | assertEquals(2, oEntity.getDiscoveryURLs().getDiscoveryURL().size());
|
---|
355 | assertEquals("URL.2.1", oEntity.getDiscoveryURLs().getDiscoveryURL().get(0));
|
---|
356 | assertEquals("URL.2.2", oEntity.getDiscoveryURLs().getDiscoveryURL().get(1));
|
---|
357 |
|
---|
358 | assertNotNull(oEntity.getNames());
|
---|
359 | assertEquals(2, oEntity.getNames().getBusinessName().size());
|
---|
360 | assertEquals("BusinessName.2.1", oEntity.getNames().getBusinessName().get(0));
|
---|
361 | assertEquals("BusinessName.2.2", oEntity.getNames().getBusinessName().get(1));
|
---|
362 |
|
---|
363 | assertNotNull(oEntity.getDescriptions());
|
---|
364 | assertEquals(2, oEntity.getDescriptions().getBusinessDescription().size());
|
---|
365 | assertEquals("BusinessDescription.2.1", oEntity.getDescriptions().getBusinessDescription().get(0));
|
---|
366 | assertEquals("BusinessDescription.2.2", oEntity.getDescriptions().getBusinessDescription().get(1));
|
---|
367 |
|
---|
368 | assertNotNull(oEntity.getContacts());
|
---|
369 | assertNotNull(oEntity.getContacts().getContact());
|
---|
370 | assertEquals(2, oEntity.getContacts().getContact().size());
|
---|
371 | boolean baFoundContact[] = {false, false};
|
---|
372 | for (CMContact oContact : oEntity.getContacts().getContact())
|
---|
373 | {
|
---|
374 | assertNotNull(oContact.getPersonNames());
|
---|
375 | assertNotNull(oContact.getPersonNames().getPersonName());
|
---|
376 | assertEquals(2, oContact.getPersonNames().getPersonName().size());
|
---|
377 | if (oContact.getPersonNames().getPersonName().get(0).equals("ContactPersonName.2.1.1"))
|
---|
378 | {
|
---|
379 | baFoundContact[0] = true;
|
---|
380 | assertEquals("ContactPersonName.2.1.1", oContact.getPersonNames().getPersonName().get(0));
|
---|
381 | assertEquals("ContactPersonName.2.1.2", oContact.getPersonNames().getPersonName().get(1));
|
---|
382 |
|
---|
383 | assertNotNull(oContact.getDescriptions());
|
---|
384 | assertNotNull(oContact.getDescriptions().getDescription());
|
---|
385 | assertEquals(2, oContact.getDescriptions().getDescription().size());
|
---|
386 | assertEquals("ContactDescription.2.1.1", oContact.getDescriptions().getDescription().get(0));
|
---|
387 | assertEquals("ContactDescription.2.1.2", oContact.getDescriptions().getDescription().get(1));
|
---|
388 |
|
---|
389 | assertNotNull(oContact.getPhones());
|
---|
390 | assertNotNull(oContact.getPhones().getPhone());
|
---|
391 | assertEquals(2, oContact.getPhones().getPhone().size());
|
---|
392 | assertEquals("ContactPhone.2.1.1", oContact.getPhones().getPhone().get(0));
|
---|
393 | assertEquals("ContactPhone.2.1.2", oContact.getPhones().getPhone().get(1));
|
---|
394 |
|
---|
395 | assertNotNull(oContact.getEmails());
|
---|
396 | assertNotNull(oContact.getEmails().getEmail());
|
---|
397 | assertEquals(2, oContact.getEmails().getEmail().size());
|
---|
398 | assertEquals("Email.2.1.1", oContact.getEmails().getEmail().get(0));
|
---|
399 | assertEquals("Email.2.1.2", oContact.getEmails().getEmail().get(1));
|
---|
400 |
|
---|
401 | assertNotNull(oContact.getAddresses());
|
---|
402 | assertNotNull(oContact.getAddresses().getAddress());
|
---|
403 | assertEquals(2, oContact.getAddresses().getAddress().size());
|
---|
404 |
|
---|
405 | assertNotNull(oContact.getAddresses().getAddress().get(0).getAddressLine());
|
---|
406 | assertEquals(2, oContact.getAddresses().getAddress().get(0).getAddressLine().size());
|
---|
407 | assertEquals("AddressLine.2.1.1.1", oContact.getAddresses().getAddress().get(0).getAddressLine().get(0));
|
---|
408 | assertEquals("AddressLine.2.1.1.2", oContact.getAddresses().getAddress().get(0).getAddressLine().get(1));
|
---|
409 |
|
---|
410 | assertNotNull(oContact.getAddresses().getAddress().get(1).getAddressLine());
|
---|
411 | assertEquals(2, oContact.getAddresses().getAddress().get(1).getAddressLine().size());
|
---|
412 | assertEquals("AddressLine.2.1.2.1", oContact.getAddresses().getAddress().get(1).getAddressLine().get(0));
|
---|
413 | assertEquals("AddressLine.2.1.2.2", oContact.getAddresses().getAddress().get(1).getAddressLine().get(1));
|
---|
414 | }
|
---|
415 | else if (oContact.getPersonNames().getPersonName().get(0).equals("ContactPersonName.2.2.1"))
|
---|
416 | {
|
---|
417 | baFoundContact[1] = true;
|
---|
418 |
|
---|
419 | assertEquals("ContactPersonName.2.2.1", oContact.getPersonNames().getPersonName().get(0));
|
---|
420 | assertEquals("ContactPersonName.2.2.2", oContact.getPersonNames().getPersonName().get(1));
|
---|
421 |
|
---|
422 | assertNotNull(oContact.getDescriptions());
|
---|
423 | assertNotNull(oContact.getDescriptions().getDescription());
|
---|
424 | assertEquals(2, oContact.getDescriptions().getDescription().size());
|
---|
425 | assertEquals("ContactDescription.2.2.1", oContact.getDescriptions().getDescription().get(0));
|
---|
426 | assertEquals("ContactDescription.2.2.2", oContact.getDescriptions().getDescription().get(1));
|
---|
427 |
|
---|
428 | assertNotNull(oContact.getPhones());
|
---|
429 | assertNotNull(oContact.getPhones().getPhone());
|
---|
430 | assertEquals(2, oContact.getPhones().getPhone().size());
|
---|
431 | assertEquals("ContactPhone.2.2.1", oContact.getPhones().getPhone().get(0));
|
---|
432 | assertEquals("ContactPhone.2.2.2", oContact.getPhones().getPhone().get(1));
|
---|
433 |
|
---|
434 | assertNotNull(oContact.getEmails());
|
---|
435 | assertNotNull(oContact.getEmails().getEmail());
|
---|
436 | assertEquals(2, oContact.getEmails().getEmail().size());
|
---|
437 | assertEquals("Email.2.2.1", oContact.getEmails().getEmail().get(0));
|
---|
438 | assertEquals("Email.2.2.2", oContact.getEmails().getEmail().get(1));
|
---|
439 |
|
---|
440 | assertNotNull(oContact.getAddresses());
|
---|
441 | assertNotNull(oContact.getAddresses().getAddress());
|
---|
442 | assertEquals(2, oContact.getAddresses().getAddress().size());
|
---|
443 |
|
---|
444 | assertNotNull(oContact.getAddresses().getAddress().get(0).getAddressLine());
|
---|
445 | assertEquals(2, oContact.getAddresses().getAddress().get(0).getAddressLine().size());
|
---|
446 | assertEquals("AddressLine.2.2.1.1", oContact.getAddresses().getAddress().get(0).getAddressLine().get(0));
|
---|
447 | assertEquals("AddressLine.2.2.1.2", oContact.getAddresses().getAddress().get(0).getAddressLine().get(1));
|
---|
448 |
|
---|
449 | assertNotNull(oContact.getAddresses().getAddress().get(1).getAddressLine());
|
---|
450 | assertEquals(2, oContact.getAddresses().getAddress().get(1).getAddressLine().size());
|
---|
451 | assertEquals("AddressLine.2.2.2.1", oContact.getAddresses().getAddress().get(1).getAddressLine().get(0));
|
---|
452 | assertEquals("AddressLine.2.2.2.2", oContact.getAddresses().getAddress().get(1).getAddressLine().get(1));
|
---|
453 | }
|
---|
454 | else
|
---|
455 | {
|
---|
456 | fail("Found unexpected contact: " + oContact.getPersonNames().getPersonName().get(0));
|
---|
457 | }
|
---|
458 | } // for (CMContact oContact : oEntity.getContacts().getContact())
|
---|
459 | assertTrue(baFoundContact[0]);
|
---|
460 | assertTrue(baFoundContact[1]);
|
---|
461 |
|
---|
462 | assertNotNull(oEntity.getStates());
|
---|
463 | assertEquals(2, oEntity.getStates().getState().size());
|
---|
464 | assertEquals("State.2.1", oEntity.getStates().getState().get(0));
|
---|
465 | assertEquals("State.2.2", oEntity.getStates().getState().get(1));
|
---|
466 |
|
---|
467 | assertEquals(true, oEntity.isFederalHIE());
|
---|
468 |
|
---|
469 | assertEquals("http://www.thekey.com.2", oEntity.getPublicKeyURI());
|
---|
470 |
|
---|
471 | assertNotNull(oEntity.getPublicKey());
|
---|
472 | assertEquals(6, oEntity.getPublicKey().length);
|
---|
473 | assertEquals(100, (int) oEntity.getPublicKey()[0]);
|
---|
474 | assertEquals(100, (int) oEntity.getPublicKey()[1]);
|
---|
475 | assertEquals(100, (int) oEntity.getPublicKey()[2]);
|
---|
476 | assertEquals(100, (int) oEntity.getPublicKey()[3]);
|
---|
477 | assertEquals(100, (int) oEntity.getPublicKey()[4]);
|
---|
478 | assertEquals(100, (int) oEntity.getPublicKey()[5]);
|
---|
479 |
|
---|
480 | assertNotNull(oEntity.getBusinessServices());
|
---|
481 | assertNotNull(oEntity.getBusinessServices().getBusinessService());
|
---|
482 |
|
---|
483 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
484 | {
|
---|
485 | assertEquals(4, oEntity.getBusinessServices().getBusinessService().size());
|
---|
486 | }
|
---|
487 | else
|
---|
488 | {
|
---|
489 | assertEquals(1, oEntity.getBusinessServices().getBusinessService().size());
|
---|
490 | }
|
---|
491 |
|
---|
492 | boolean baFoundService[] = {false, false, false, false};
|
---|
493 | boolean bMatchedService = false; // Used when we are looking just for one service.
|
---|
494 | for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
495 | {
|
---|
496 | if (oService.getUniformServiceName().equals("Service 5 Name"))
|
---|
497 | {
|
---|
498 | baFoundService[0] = true;
|
---|
499 | assertNotNull(oService.getDescriptions());
|
---|
500 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
501 | assertEquals(1, oService.getDescriptions().getDescription().size());
|
---|
502 | assertEquals("Service 5 Description", oService.getDescriptions().getDescription().get(0));
|
---|
503 |
|
---|
504 | assertEquals(false, oService.isInternalWebService());
|
---|
505 |
|
---|
506 | assertNotNull(oService.getBindingTemplates());
|
---|
507 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
508 | assertEquals(1, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
509 | assertEquals("http://www.service5.com", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
510 | }
|
---|
511 | else if (oService.getUniformServiceName().equals("Service 6 Name"))
|
---|
512 | {
|
---|
513 | baFoundService[1] = true;
|
---|
514 | assertNotNull(oService.getDescriptions());
|
---|
515 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
516 | assertEquals(1, oService.getDescriptions().getDescription().size());
|
---|
517 | assertEquals("Service 6 Description", oService.getDescriptions().getDescription().get(0));
|
---|
518 |
|
---|
519 | assertEquals(true, oService.isInternalWebService());
|
---|
520 |
|
---|
521 | assertNotNull(oService.getBindingTemplates());
|
---|
522 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
523 | assertEquals(1, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
524 | assertEquals("http://www.service6.com", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
525 | }
|
---|
526 | else if (oService.getServiceKey().equals("ServiceKey.2.1"))
|
---|
527 | {
|
---|
528 | baFoundService[2] = true;
|
---|
529 |
|
---|
530 | assertNotNull(oService.getNames());
|
---|
531 | assertNotNull(oService.getNames().getName());
|
---|
532 | assertEquals(2, oService.getNames().getName().size());
|
---|
533 | assertEquals("BindingName.2.1.1", oService.getNames().getName().get(0));
|
---|
534 | assertEquals("BindingName.2.1.2", oService.getNames().getName().get(1));
|
---|
535 |
|
---|
536 | assertNotNull(oService.getDescriptions());
|
---|
537 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
538 | assertEquals(2, oService.getDescriptions().getDescription().size());
|
---|
539 | assertEquals("BindingDescription.2.1.1", oService.getDescriptions().getDescription().get(0));
|
---|
540 | assertEquals("BindingDescription.2.1.2", oService.getDescriptions().getDescription().get(1));
|
---|
541 |
|
---|
542 | assertEquals("ServiceName.2.1", oService.getUniformServiceName());
|
---|
543 | assertEquals("1.0", oService.getServiceVersion());
|
---|
544 | assertEquals(true, oService.isInternalWebService());
|
---|
545 |
|
---|
546 | assertNotNull(oService.getBindingTemplates());
|
---|
547 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
548 | assertEquals(2, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
549 |
|
---|
550 | assertEquals("BindingKey.2.1.1", oService.getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
|
---|
551 | assertEquals("EndpointURL.2.1.1", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
552 | assertEquals("WSDLURL.2.1.1", oService.getBindingTemplates().getBindingTemplate().get(0).getWsdlURL());
|
---|
553 |
|
---|
554 | assertEquals("BindingKey.2.1.2", oService.getBindingTemplates().getBindingTemplate().get(1).getBindingKey());
|
---|
555 | assertEquals("EndpointURL.2.1.2", oService.getBindingTemplates().getBindingTemplate().get(1).getEndpointURL());
|
---|
556 | assertEquals("WSDLURL.2.1.2", oService.getBindingTemplates().getBindingTemplate().get(1).getWsdlURL());
|
---|
557 | }
|
---|
558 | else if (oService.getServiceKey().equals("ServiceKey.2.2"))
|
---|
559 | {
|
---|
560 | baFoundService[3] = true;
|
---|
561 |
|
---|
562 | assertNotNull(oService.getNames());
|
---|
563 | assertNotNull(oService.getNames().getName());
|
---|
564 | assertEquals(2, oService.getNames().getName().size());
|
---|
565 | assertEquals("BindingName.2.2.1", oService.getNames().getName().get(0));
|
---|
566 | assertEquals("BindingName.2.2.2", oService.getNames().getName().get(1));
|
---|
567 |
|
---|
568 | assertNotNull(oService.getDescriptions());
|
---|
569 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
570 | assertEquals(2, oService.getDescriptions().getDescription().size());
|
---|
571 | assertEquals("BindingDescription.2.2.1", oService.getDescriptions().getDescription().get(0));
|
---|
572 | assertEquals("BindingDescription.2.2.2", oService.getDescriptions().getDescription().get(1));
|
---|
573 |
|
---|
574 | assertEquals("ServiceName.2.2", oService.getUniformServiceName());
|
---|
575 | assertEquals("1.0", oService.getServiceVersion());
|
---|
576 | assertEquals(true, oService.isInternalWebService());
|
---|
577 |
|
---|
578 | assertNotNull(oService.getBindingTemplates());
|
---|
579 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
580 | assertEquals(2, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
581 |
|
---|
582 | assertEquals("BindingKey.2.2.1", oService.getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
|
---|
583 | assertEquals("EndpointURL.2.2.1", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
584 | assertEquals("WSDLURL.2.2.1", oService.getBindingTemplates().getBindingTemplate().get(0).getWsdlURL());
|
---|
585 |
|
---|
586 | assertEquals("BindingKey.2.2.2", oService.getBindingTemplates().getBindingTemplate().get(1).getBindingKey());
|
---|
587 | assertEquals("EndpointURL.2.2.2", oService.getBindingTemplates().getBindingTemplate().get(1).getEndpointURL());
|
---|
588 | assertEquals("WSDLURL.2.2.2", oService.getBindingTemplates().getBindingTemplate().get(1).getWsdlURL());
|
---|
589 | }
|
---|
590 | else
|
---|
591 | {
|
---|
592 | fail("Found an unexpected service: " + oService.getUniformServiceName());
|
---|
593 | }
|
---|
594 |
|
---|
595 | // We can check this here because if it does not match either of the two specified, we will
|
---|
596 | // get an error. So we are guaranteed that we will either fail before we are done, or
|
---|
597 | // that everything is in order.
|
---|
598 | //------------------------------------------------------------------------------------------
|
---|
599 | if ((sUniformServiceName != null) && (sUniformServiceName.equals(oService.getUniformServiceName())))
|
---|
600 | {
|
---|
601 | bMatchedService = true;
|
---|
602 | }
|
---|
603 |
|
---|
604 |
|
---|
605 | } // for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
606 |
|
---|
607 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
608 | {
|
---|
609 | assertTrue(baFoundService[0]);
|
---|
610 | assertTrue(baFoundService[1]);
|
---|
611 | assertTrue(baFoundService[2]);
|
---|
612 | assertTrue(baFoundService[3]);
|
---|
613 | }
|
---|
614 | else
|
---|
615 | {
|
---|
616 | assertTrue(bMatchedService);
|
---|
617 | }
|
---|
618 | }
|
---|
619 |
|
---|
620 | /**
|
---|
621 | * This method validates the entire contents of a business entity for
|
---|
622 | * HomeCommunity 1111.1111.1111.1111..1
|
---|
623 | *
|
---|
624 | * @param oEntity The business entity for this home community.
|
---|
625 | * @param sUniformServiceName If this is passed, then it will validate all of the
|
---|
626 | * general stuff and only the one specific service and that
|
---|
627 | * the service is the only one that exists.
|
---|
628 | */
|
---|
629 | private void validateEntity_1111_1111_1111_1111__1(CMBusinessEntity oEntity, String sUniformServiceName)
|
---|
630 | {
|
---|
631 | assertNotNull(oEntity);
|
---|
632 | assertEquals("1111.1111.1111.1111..1", oEntity.getHomeCommunityId());
|
---|
633 |
|
---|
634 | assertEquals("BusinessKey.1", oEntity.getBusinessKey());
|
---|
635 |
|
---|
636 | assertNotNull(oEntity.getDiscoveryURLs());
|
---|
637 | assertEquals(2, oEntity.getDiscoveryURLs().getDiscoveryURL().size());
|
---|
638 | assertEquals("URL.1.1", oEntity.getDiscoveryURLs().getDiscoveryURL().get(0));
|
---|
639 | assertEquals("URL.1.2", oEntity.getDiscoveryURLs().getDiscoveryURL().get(1));
|
---|
640 |
|
---|
641 | assertNotNull(oEntity.getNames());
|
---|
642 | assertEquals(2, oEntity.getNames().getBusinessName().size());
|
---|
643 | assertEquals("BusinessName.1.1", oEntity.getNames().getBusinessName().get(0));
|
---|
644 | assertEquals("BusinessName.1.2", oEntity.getNames().getBusinessName().get(1));
|
---|
645 |
|
---|
646 | assertNotNull(oEntity.getDescriptions());
|
---|
647 | assertEquals(2, oEntity.getDescriptions().getBusinessDescription().size());
|
---|
648 | assertEquals("BusinessDescription.1.1", oEntity.getDescriptions().getBusinessDescription().get(0));
|
---|
649 | assertEquals("BusinessDescription.1.2", oEntity.getDescriptions().getBusinessDescription().get(1));
|
---|
650 |
|
---|
651 | assertNotNull(oEntity.getContacts());
|
---|
652 | assertNotNull(oEntity.getContacts().getContact());
|
---|
653 | assertEquals(2, oEntity.getContacts().getContact().size());
|
---|
654 | boolean baFoundContact[] = {false, false};
|
---|
655 | for (CMContact oContact : oEntity.getContacts().getContact())
|
---|
656 | {
|
---|
657 | assertNotNull(oContact.getPersonNames());
|
---|
658 | assertNotNull(oContact.getPersonNames().getPersonName());
|
---|
659 | assertEquals(2, oContact.getPersonNames().getPersonName().size());
|
---|
660 | if (oContact.getPersonNames().getPersonName().get(0).equals("ContactPersonName.1.1.1"))
|
---|
661 | {
|
---|
662 | baFoundContact[0] = true;
|
---|
663 | assertEquals("ContactPersonName.1.1.1", oContact.getPersonNames().getPersonName().get(0));
|
---|
664 | assertEquals("ContactPersonName.1.1.2", oContact.getPersonNames().getPersonName().get(1));
|
---|
665 |
|
---|
666 | assertNotNull(oContact.getDescriptions());
|
---|
667 | assertNotNull(oContact.getDescriptions().getDescription());
|
---|
668 | assertEquals(2, oContact.getDescriptions().getDescription().size());
|
---|
669 | assertEquals("ContactDescription.1.1.1", oContact.getDescriptions().getDescription().get(0));
|
---|
670 | assertEquals("ContactDescription.1.1.2", oContact.getDescriptions().getDescription().get(1));
|
---|
671 |
|
---|
672 | assertNotNull(oContact.getPhones());
|
---|
673 | assertNotNull(oContact.getPhones().getPhone());
|
---|
674 | assertEquals(2, oContact.getPhones().getPhone().size());
|
---|
675 | assertEquals("ContactPhone.1.1.1", oContact.getPhones().getPhone().get(0));
|
---|
676 | assertEquals("ContactPhone.1.1.2", oContact.getPhones().getPhone().get(1));
|
---|
677 |
|
---|
678 | assertNotNull(oContact.getEmails());
|
---|
679 | assertNotNull(oContact.getEmails().getEmail());
|
---|
680 | assertEquals(2, oContact.getEmails().getEmail().size());
|
---|
681 | assertEquals("Email.1.1.1", oContact.getEmails().getEmail().get(0));
|
---|
682 | assertEquals("Email.1.1.2", oContact.getEmails().getEmail().get(1));
|
---|
683 |
|
---|
684 | assertNotNull(oContact.getAddresses());
|
---|
685 | assertNotNull(oContact.getAddresses().getAddress());
|
---|
686 | assertEquals(2, oContact.getAddresses().getAddress().size());
|
---|
687 |
|
---|
688 | assertNotNull(oContact.getAddresses().getAddress().get(0).getAddressLine());
|
---|
689 | assertEquals(2, oContact.getAddresses().getAddress().get(0).getAddressLine().size());
|
---|
690 | assertEquals("AddressLine.1.1.1.1", oContact.getAddresses().getAddress().get(0).getAddressLine().get(0));
|
---|
691 | assertEquals("AddressLine.1.1.1.2", oContact.getAddresses().getAddress().get(0).getAddressLine().get(1));
|
---|
692 |
|
---|
693 | assertNotNull(oContact.getAddresses().getAddress().get(1).getAddressLine());
|
---|
694 | assertEquals(2, oContact.getAddresses().getAddress().get(1).getAddressLine().size());
|
---|
695 | assertEquals("AddressLine.1.1.2.1", oContact.getAddresses().getAddress().get(1).getAddressLine().get(0));
|
---|
696 | assertEquals("AddressLine.1.1.2.2", oContact.getAddresses().getAddress().get(1).getAddressLine().get(1));
|
---|
697 | }
|
---|
698 | else if (oContact.getPersonNames().getPersonName().get(0).equals("ContactPersonName.1.2.1"))
|
---|
699 | {
|
---|
700 | baFoundContact[1] = true;
|
---|
701 |
|
---|
702 | assertEquals("ContactPersonName.1.2.1", oContact.getPersonNames().getPersonName().get(0));
|
---|
703 | assertEquals("ContactPersonName.1.2.2", oContact.getPersonNames().getPersonName().get(1));
|
---|
704 |
|
---|
705 | assertNotNull(oContact.getDescriptions());
|
---|
706 | assertNotNull(oContact.getDescriptions().getDescription());
|
---|
707 | assertEquals(2, oContact.getDescriptions().getDescription().size());
|
---|
708 | assertEquals("ContactDescription.1.2.1", oContact.getDescriptions().getDescription().get(0));
|
---|
709 | assertEquals("ContactDescription.1.2.2", oContact.getDescriptions().getDescription().get(1));
|
---|
710 |
|
---|
711 | assertNotNull(oContact.getPhones());
|
---|
712 | assertNotNull(oContact.getPhones().getPhone());
|
---|
713 | assertEquals(2, oContact.getPhones().getPhone().size());
|
---|
714 | assertEquals("ContactPhone.1.2.1", oContact.getPhones().getPhone().get(0));
|
---|
715 | assertEquals("ContactPhone.1.2.2", oContact.getPhones().getPhone().get(1));
|
---|
716 |
|
---|
717 | assertNotNull(oContact.getEmails());
|
---|
718 | assertNotNull(oContact.getEmails().getEmail());
|
---|
719 | assertEquals(2, oContact.getEmails().getEmail().size());
|
---|
720 | assertEquals("Email.1.2.1", oContact.getEmails().getEmail().get(0));
|
---|
721 | assertEquals("Email.1.2.2", oContact.getEmails().getEmail().get(1));
|
---|
722 |
|
---|
723 | assertNotNull(oContact.getAddresses());
|
---|
724 | assertNotNull(oContact.getAddresses().getAddress());
|
---|
725 | assertEquals(2, oContact.getAddresses().getAddress().size());
|
---|
726 |
|
---|
727 | assertNotNull(oContact.getAddresses().getAddress().get(0).getAddressLine());
|
---|
728 | assertEquals(2, oContact.getAddresses().getAddress().get(0).getAddressLine().size());
|
---|
729 | assertEquals("AddressLine.1.2.1.1", oContact.getAddresses().getAddress().get(0).getAddressLine().get(0));
|
---|
730 | assertEquals("AddressLine.1.2.1.2", oContact.getAddresses().getAddress().get(0).getAddressLine().get(1));
|
---|
731 |
|
---|
732 | assertNotNull(oContact.getAddresses().getAddress().get(1).getAddressLine());
|
---|
733 | assertEquals(2, oContact.getAddresses().getAddress().get(1).getAddressLine().size());
|
---|
734 | assertEquals("AddressLine.1.2.2.1", oContact.getAddresses().getAddress().get(1).getAddressLine().get(0));
|
---|
735 | assertEquals("AddressLine.1.2.2.2", oContact.getAddresses().getAddress().get(1).getAddressLine().get(1));
|
---|
736 | }
|
---|
737 | else
|
---|
738 | {
|
---|
739 | fail("Found unexpected contact: " + oContact.getPersonNames().getPersonName().get(0));
|
---|
740 | }
|
---|
741 | } // for (CMContact oContact : oEntity.getContacts().getContact())
|
---|
742 | assertTrue(baFoundContact[0]);
|
---|
743 | assertTrue(baFoundContact[1]);
|
---|
744 |
|
---|
745 | assertNotNull(oEntity.getStates());
|
---|
746 | assertEquals(2, oEntity.getStates().getState().size());
|
---|
747 | assertEquals("State.1.1", oEntity.getStates().getState().get(0));
|
---|
748 | assertEquals("State.1.2", oEntity.getStates().getState().get(1));
|
---|
749 |
|
---|
750 | assertEquals(true, oEntity.isFederalHIE());
|
---|
751 |
|
---|
752 | assertEquals("http://www.thekey.com.1", oEntity.getPublicKeyURI());
|
---|
753 |
|
---|
754 | assertNotNull(oEntity.getPublicKey());
|
---|
755 | assertEquals(6, oEntity.getPublicKey().length);
|
---|
756 | assertEquals(100, (int) oEntity.getPublicKey()[0]);
|
---|
757 | assertEquals(100, (int) oEntity.getPublicKey()[1]);
|
---|
758 | assertEquals(100, (int) oEntity.getPublicKey()[2]);
|
---|
759 | assertEquals(100, (int) oEntity.getPublicKey()[3]);
|
---|
760 | assertEquals(100, (int) oEntity.getPublicKey()[4]);
|
---|
761 | assertEquals(100, (int) oEntity.getPublicKey()[5]);
|
---|
762 |
|
---|
763 | // Business Services
|
---|
764 | //------------------
|
---|
765 | assertNotNull(oEntity.getBusinessServices());
|
---|
766 | assertNotNull(oEntity.getBusinessServices().getBusinessService());
|
---|
767 |
|
---|
768 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
769 | {
|
---|
770 | assertEquals(2, oEntity.getBusinessServices().getBusinessService().size());
|
---|
771 | }
|
---|
772 | else
|
---|
773 | {
|
---|
774 | assertEquals(1, oEntity.getBusinessServices().getBusinessService().size());
|
---|
775 | }
|
---|
776 |
|
---|
777 | boolean baFoundService[] = {false, false};
|
---|
778 | boolean bMatchedService = false; // Used when we are looking just for one service.
|
---|
779 |
|
---|
780 | for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
781 | {
|
---|
782 | assertNotNull(oService.getServiceKey());
|
---|
783 | if (oService.getServiceKey().equals("ServiceKey.1.1"))
|
---|
784 | {
|
---|
785 | baFoundService[0] = true;
|
---|
786 |
|
---|
787 | assertNotNull(oService.getNames());
|
---|
788 | assertNotNull(oService.getNames().getName());
|
---|
789 | assertEquals(2, oService.getNames().getName().size());
|
---|
790 | assertEquals("BindingName.1.1.1", oService.getNames().getName().get(0));
|
---|
791 | assertEquals("BindingName.1.1.2", oService.getNames().getName().get(1));
|
---|
792 |
|
---|
793 | assertNotNull(oService.getDescriptions());
|
---|
794 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
795 | assertEquals(2, oService.getDescriptions().getDescription().size());
|
---|
796 | assertEquals("BindingDescription.1.1.1", oService.getDescriptions().getDescription().get(0));
|
---|
797 | assertEquals("BindingDescription.1.1.2", oService.getDescriptions().getDescription().get(1));
|
---|
798 |
|
---|
799 | assertEquals("ServiceName.1.1", oService.getUniformServiceName());
|
---|
800 | assertEquals("1.0", oService.getServiceVersion());
|
---|
801 | assertEquals(true, oService.isInternalWebService());
|
---|
802 |
|
---|
803 | assertNotNull(oService.getBindingTemplates());
|
---|
804 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
805 | assertEquals(2, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
806 |
|
---|
807 | assertEquals("BindingKey.1.1.1", oService.getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
|
---|
808 | assertEquals("EndpointURL.1.1.1", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
809 | assertEquals("WSDLURL.1.1.1", oService.getBindingTemplates().getBindingTemplate().get(0).getWsdlURL());
|
---|
810 |
|
---|
811 | assertEquals("BindingKey.1.1.2", oService.getBindingTemplates().getBindingTemplate().get(1).getBindingKey());
|
---|
812 | assertEquals("EndpointURL.1.1.2", oService.getBindingTemplates().getBindingTemplate().get(1).getEndpointURL());
|
---|
813 | assertEquals("WSDLURL.1.1.2", oService.getBindingTemplates().getBindingTemplate().get(1).getWsdlURL());
|
---|
814 | }
|
---|
815 | else if (oService.getServiceKey().equals("ServiceKey.1.2"))
|
---|
816 | {
|
---|
817 | baFoundService[1] = true;
|
---|
818 |
|
---|
819 | assertNotNull(oService.getNames());
|
---|
820 | assertNotNull(oService.getNames().getName());
|
---|
821 | assertEquals(2, oService.getNames().getName().size());
|
---|
822 | assertEquals("BindingName.1.2.1", oService.getNames().getName().get(0));
|
---|
823 | assertEquals("BindingName.1.2.2", oService.getNames().getName().get(1));
|
---|
824 |
|
---|
825 | assertNotNull(oService.getDescriptions());
|
---|
826 | assertNotNull(oService.getDescriptions().getDescription());
|
---|
827 | assertEquals(2, oService.getDescriptions().getDescription().size());
|
---|
828 | assertEquals("BindingDescription.1.2.1", oService.getDescriptions().getDescription().get(0));
|
---|
829 | assertEquals("BindingDescription.1.2.2", oService.getDescriptions().getDescription().get(1));
|
---|
830 |
|
---|
831 | assertEquals("ServiceName.1.2", oService.getUniformServiceName());
|
---|
832 | assertEquals("1.0", oService.getServiceVersion());
|
---|
833 | assertEquals(true, oService.isInternalWebService());
|
---|
834 |
|
---|
835 | assertNotNull(oService.getBindingTemplates());
|
---|
836 | assertNotNull(oService.getBindingTemplates().getBindingTemplate());
|
---|
837 | assertEquals(2, oService.getBindingTemplates().getBindingTemplate().size());
|
---|
838 |
|
---|
839 | assertEquals("BindingKey.1.2.1", oService.getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
|
---|
840 | assertEquals("EndpointURL.1.2.1", oService.getBindingTemplates().getBindingTemplate().get(0).getEndpointURL());
|
---|
841 | assertEquals("WSDLURL.1.2.1", oService.getBindingTemplates().getBindingTemplate().get(0).getWsdlURL());
|
---|
842 |
|
---|
843 | assertEquals("BindingKey.1.2.2", oService.getBindingTemplates().getBindingTemplate().get(1).getBindingKey());
|
---|
844 | assertEquals("EndpointURL.1.2.2", oService.getBindingTemplates().getBindingTemplate().get(1).getEndpointURL());
|
---|
845 | assertEquals("WSDLURL.1.2.2", oService.getBindingTemplates().getBindingTemplate().get(1).getWsdlURL());
|
---|
846 |
|
---|
847 | }
|
---|
848 | else
|
---|
849 | {
|
---|
850 | fail("Found an unexpected service: " + oService.getServiceKey());
|
---|
851 | }
|
---|
852 |
|
---|
853 | // We can check this here because if it does not match either of the two specified, we will
|
---|
854 | // get an error. So we are guaranteed that we will either fail before we are done, or
|
---|
855 | // that everything is in order.
|
---|
856 | //------------------------------------------------------------------------------------------
|
---|
857 | if ((sUniformServiceName != null) && (sUniformServiceName.equals(oService.getUniformServiceName())))
|
---|
858 | {
|
---|
859 | bMatchedService = true;
|
---|
860 | }
|
---|
861 |
|
---|
862 |
|
---|
863 | } // for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService())
|
---|
864 |
|
---|
865 | if ((sUniformServiceName == null) || (sUniformServiceName.length() <= 0))
|
---|
866 | {
|
---|
867 | assertTrue(baFoundService[0]);
|
---|
868 | assertTrue(baFoundService[1]);
|
---|
869 | }
|
---|
870 | else
|
---|
871 | {
|
---|
872 | assertTrue(bMatchedService);
|
---|
873 | }
|
---|
874 | }
|
---|
875 |
|
---|
876 | /**
|
---|
877 | * Test of getAllBusinessEntities method, of class ConnectionManagerCache.
|
---|
878 | */
|
---|
879 | @Test
|
---|
880 | public void testGetAllBusinessEntities() throws Exception
|
---|
881 | {
|
---|
882 | System.out.println("getAllBusinessEntities");
|
---|
883 |
|
---|
884 | try
|
---|
885 | {
|
---|
886 | CMBusinessEntities oEntities = null;
|
---|
887 | oEntities = ConnectionManagerCache.getAllBusinessEntities();
|
---|
888 | assertNotNull(oEntities);
|
---|
889 | assertNotNull(oEntities.getBusinessEntity());
|
---|
890 | assertEquals(4, oEntities.getBusinessEntity().size());
|
---|
891 | boolean baFound[] = {false, false, false, false};
|
---|
892 |
|
---|
893 | for (CMBusinessEntity oEntity : oEntities.getBusinessEntity())
|
---|
894 | {
|
---|
895 | if (oEntity.getHomeCommunityId().equals("1111.1111.1111.1111"))
|
---|
896 | {
|
---|
897 | validateEntity_1111_1111_1111_1111(oEntity, "");
|
---|
898 | baFound[0] = true;
|
---|
899 | }
|
---|
900 | else if (oEntity.getHomeCommunityId().equals("2222.2222.2222.2222"))
|
---|
901 | {
|
---|
902 | validateEntity_2222_2222_2222_2222(oEntity, "");
|
---|
903 | baFound[1] = true;
|
---|
904 | }
|
---|
905 | else if (oEntity.getHomeCommunityId().equals("1111.1111.1111.1111..2"))
|
---|
906 | {
|
---|
907 | validateEntity_1111_1111_1111_1111__2(oEntity, "");
|
---|
908 | baFound[2] = true;
|
---|
909 | }
|
---|
910 | else if (oEntity.getHomeCommunityId().equals("1111.1111.1111.1111..1"))
|
---|
911 | {
|
---|
912 | validateEntity_1111_1111_1111_1111__1(oEntity, "");
|
---|
913 | baFound[3] = true;
|
---|
914 | }
|
---|
915 | else
|
---|
916 | {
|
---|
917 | fail("Found an unexpected entry. HomeCommunityId:" + oEntity.getHomeCommunityId());
|
---|
918 | }
|
---|
919 | }
|
---|
920 | assertTrue(baFound[0]);
|
---|
921 | assertTrue(baFound[1]);
|
---|
922 | assertTrue(baFound[2]);
|
---|
923 | assertTrue(baFound[3]);
|
---|
924 | }
|
---|
925 | catch (Exception e)
|
---|
926 | {
|
---|
927 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
928 | }
|
---|
929 |
|
---|
930 | }
|
---|
931 |
|
---|
932 |
|
---|
933 | /**
|
---|
934 | * Test of getBusinessEntity method, of class ConnectionManagerCache.
|
---|
935 | */
|
---|
936 | @Test
|
---|
937 | public void testGetBusinessEntity() throws Exception
|
---|
938 | {
|
---|
939 | System.out.println("getBusinessEntity");
|
---|
940 |
|
---|
941 | try
|
---|
942 | {
|
---|
943 | CMBusinessEntity oEntity = null;
|
---|
944 | oEntity = ConnectionManagerCache.getBusinessEntity("1111.1111.1111.1111");
|
---|
945 | assertNotNull(oEntity);
|
---|
946 | validateEntity_1111_1111_1111_1111(oEntity, "");
|
---|
947 |
|
---|
948 | oEntity = ConnectionManagerCache.getBusinessEntity("1111.1111.1111.1111..2");
|
---|
949 | assertNotNull(oEntity);
|
---|
950 | validateEntity_1111_1111_1111_1111__2(oEntity, "");
|
---|
951 |
|
---|
952 | oEntity = ConnectionManagerCache.getBusinessEntity("1111.1111.1111.1111..1");
|
---|
953 | assertNotNull(oEntity);
|
---|
954 | validateEntity_1111_1111_1111_1111__1(oEntity, "");
|
---|
955 | }
|
---|
956 | catch (Exception e)
|
---|
957 | {
|
---|
958 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
959 | }
|
---|
960 |
|
---|
961 | }
|
---|
962 |
|
---|
963 | /**
|
---|
964 | * Test of getBusinessEntitySet method, of class ConnectionManagerCache.
|
---|
965 | */
|
---|
966 | @Test
|
---|
967 | public void testGetBusinessEntitySet() throws Exception
|
---|
968 | {
|
---|
969 | System.out.println("getBusinessEntitySet");
|
---|
970 |
|
---|
971 | try
|
---|
972 | {
|
---|
973 | CMBusinessEntities oEntities = null;
|
---|
974 | ArrayList<String> saHomeCommunityId = new ArrayList<String>();
|
---|
975 | saHomeCommunityId.add("1111.1111.1111.1111");
|
---|
976 | saHomeCommunityId.add("1111.1111.1111.1111..2");
|
---|
977 | saHomeCommunityId.add("1111.1111.1111.1111..1");
|
---|
978 |
|
---|
979 | oEntities = ConnectionManagerCache.getBusinessEntitySet(saHomeCommunityId);
|
---|
980 | assertNotNull(oEntities);
|
---|
981 | assertNotNull(oEntities.getBusinessEntity());
|
---|
982 | assertEquals(3, oEntities.getBusinessEntity().size());
|
---|
983 |
|
---|
984 | boolean baFound[] = {false, false, false};
|
---|
985 | for (CMBusinessEntity oEntity: oEntities.getBusinessEntity())
|
---|
986 | {
|
---|
987 | if (oEntity.getHomeCommunityId().equals("1111.1111.1111.1111"))
|
---|
988 | {
|
---|
989 | baFound[0] = true;
|
---|
990 | validateEntity_1111_1111_1111_1111(oEntity, "");
|
---|
991 | }
|
---|
992 | else if (oEntity.getHomeCommunityId().equals("1111.1111.1111.1111..2"))
|
---|
993 | {
|
---|
994 | baFound[1] = true;
|
---|
995 | validateEntity_1111_1111_1111_1111__2(oEntity, "");
|
---|
996 | }
|
---|
997 | else if (oEntity.getHomeCommunityId().equals("1111.1111.1111.1111..1"))
|
---|
998 | {
|
---|
999 | baFound[2] = true;
|
---|
1000 | validateEntity_1111_1111_1111_1111__1(oEntity, "");
|
---|
1001 | }
|
---|
1002 | else
|
---|
1003 | {
|
---|
1004 | fail("Found an unexpected business entity: " + oEntity.getHomeCommunityId());
|
---|
1005 | }
|
---|
1006 | } // for (CMBusinessEntity oEntity: oEntities.getBusinessEntity())
|
---|
1007 |
|
---|
1008 | assertTrue(baFound[0]);
|
---|
1009 | assertTrue(baFound[1]);
|
---|
1010 | assertTrue(baFound[2]);
|
---|
1011 | }
|
---|
1012 | catch (Exception e)
|
---|
1013 | {
|
---|
1014 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
1015 | }
|
---|
1016 |
|
---|
1017 | }
|
---|
1018 |
|
---|
1019 | /**
|
---|
1020 | * Test of getBusinessEntityByServiceName method, of class ConnectionManagerCache.
|
---|
1021 | */
|
---|
1022 | @Test
|
---|
1023 | public void testGetBusinessEntityByServiceName() throws Exception
|
---|
1024 | {
|
---|
1025 | System.out.println("getBusinessEntityByServiceNamet");
|
---|
1026 |
|
---|
1027 | try
|
---|
1028 | {
|
---|
1029 | CMBusinessEntity oEntity = null;
|
---|
1030 | oEntity = ConnectionManagerCache.getBusinessEntityByServiceName("1111.1111.1111.1111..1", "ServiceName.1.2");
|
---|
1031 | assertNotNull(oEntity);
|
---|
1032 | validateEntity_1111_1111_1111_1111__1(oEntity, "ServiceName.1.2");
|
---|
1033 |
|
---|
1034 | oEntity = ConnectionManagerCache.getBusinessEntityByServiceName("2222.2222.2222.2222", "Service 3 Name");
|
---|
1035 | assertNotNull(oEntity);
|
---|
1036 | validateEntity_2222_2222_2222_2222(oEntity, "Service 3 Name");
|
---|
1037 |
|
---|
1038 | oEntity = ConnectionManagerCache.getBusinessEntityByServiceName("1111.1111.1111.1111..2", "Service 6 Name");
|
---|
1039 | assertNotNull(oEntity);
|
---|
1040 | validateEntity_1111_1111_1111_1111__2(oEntity, "Service 6 Name");
|
---|
1041 | }
|
---|
1042 | catch (Exception e)
|
---|
1043 | {
|
---|
1044 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | /**
|
---|
1050 | * Test of getBusinessEntityByServiceName method, of class ConnectionManagerCache.
|
---|
1051 | */
|
---|
1052 | @Test
|
---|
1053 | public void testGetEndpointURLByServiceName() throws Exception
|
---|
1054 | {
|
---|
1055 | System.out.println("getEndpointURLByServiceNamet");
|
---|
1056 |
|
---|
1057 | try
|
---|
1058 | {
|
---|
1059 | String sEndpointURL = "";
|
---|
1060 | sEndpointURL = ConnectionManagerCache.getEndpointURLByServiceName("1111.1111.1111.1111..1", "ServiceName.1.2");
|
---|
1061 | assertEquals("EndpointURL.1.2.1", sEndpointURL);
|
---|
1062 |
|
---|
1063 | sEndpointURL = ConnectionManagerCache.getEndpointURLByServiceName("2222.2222.2222.2222", "Service 3 Name");
|
---|
1064 | assertEquals("http://www.service3.com", sEndpointURL);
|
---|
1065 |
|
---|
1066 | sEndpointURL = ConnectionManagerCache.getEndpointURLByServiceName("1111.1111.1111.1111..2", "Service 6 Name");
|
---|
1067 | assertEquals("http://www.service6.com", sEndpointURL);
|
---|
1068 | }
|
---|
1069 | catch (Exception e)
|
---|
1070 | {
|
---|
1071 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | }
|
---|
1075 |
|
---|
1076 |
|
---|
1077 | /**
|
---|
1078 | * Test of getBusinessEntityByServiceName method, of class ConnectionManagerCache.
|
---|
1079 | */
|
---|
1080 | @Test
|
---|
1081 | public void testGetBusinessEntitySetByServiceName() throws Exception
|
---|
1082 | {
|
---|
1083 | System.out.println("getBusinessEntitySetByServiceNamet");
|
---|
1084 |
|
---|
1085 | try
|
---|
1086 | {
|
---|
1087 | CMBusinessEntities oEntities = null;
|
---|
1088 | ArrayList<String> saHomeCommunityId = new ArrayList<String>();
|
---|
1089 | saHomeCommunityId.add("2222.2222.2222.2222");
|
---|
1090 | saHomeCommunityId.add("1111.1111.1111.1111");
|
---|
1091 | saHomeCommunityId.add("1111.1111.1111.1111..2");
|
---|
1092 | saHomeCommunityId.add("1111.1111.1111.1111..1");
|
---|
1093 |
|
---|
1094 | oEntities = ConnectionManagerCache.getBusinessEntitySetByServiceName(saHomeCommunityId, "Service 3 Name");
|
---|
1095 | assertNotNull(oEntities);
|
---|
1096 | assertNotNull(oEntities.getBusinessEntity());
|
---|
1097 | assertEquals(1, oEntities.getBusinessEntity().size());
|
---|
1098 | validateEntity_2222_2222_2222_2222(oEntities.getBusinessEntity().get(0), "Service 3 Name");
|
---|
1099 |
|
---|
1100 | oEntities = ConnectionManagerCache.getBusinessEntitySetByServiceName(saHomeCommunityId, "ServiceName.1.2");
|
---|
1101 | assertNotNull(oEntities);
|
---|
1102 | assertNotNull(oEntities.getBusinessEntity());
|
---|
1103 | assertEquals(1, oEntities.getBusinessEntity().size());
|
---|
1104 | validateEntity_1111_1111_1111_1111__1(oEntities.getBusinessEntity().get(0), "ServiceName.1.2");
|
---|
1105 |
|
---|
1106 | }
|
---|
1107 | catch (Exception e)
|
---|
1108 | {
|
---|
1109 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
1110 | }
|
---|
1111 | }
|
---|
1112 |
|
---|
1113 | /**
|
---|
1114 | * Test of getAllBusinessEntityByServiceName method, of class ConnectionManagerCache.
|
---|
1115 | */
|
---|
1116 | @Test
|
---|
1117 | public void testGetAllBusinessEntitySetByServiceName() throws Exception
|
---|
1118 | {
|
---|
1119 | System.out.println("getAllBusinessEntitySetByServiceNamet");
|
---|
1120 |
|
---|
1121 | try
|
---|
1122 | {
|
---|
1123 | CMBusinessEntities oEntities = null;
|
---|
1124 | oEntities = ConnectionManagerCache.getAllBusinessEntitySetByServiceName("Service 3 Name");
|
---|
1125 | assertNotNull(oEntities);
|
---|
1126 | assertNotNull(oEntities.getBusinessEntity());
|
---|
1127 | assertEquals(1, oEntities.getBusinessEntity().size());
|
---|
1128 | validateEntity_2222_2222_2222_2222(oEntities.getBusinessEntity().get(0), "Service 3 Name");
|
---|
1129 |
|
---|
1130 | oEntities = ConnectionManagerCache.getAllBusinessEntitySetByServiceName("ServiceName.1.2");
|
---|
1131 | assertNotNull(oEntities);
|
---|
1132 | assertNotNull(oEntities.getBusinessEntity());
|
---|
1133 | assertEquals(1, oEntities.getBusinessEntity().size());
|
---|
1134 | validateEntity_1111_1111_1111_1111__1(oEntities.getBusinessEntity().get(0), "ServiceName.1.2");
|
---|
1135 |
|
---|
1136 | }
|
---|
1137 | catch (Exception e)
|
---|
1138 | {
|
---|
1139 | fail("An unexpected exception occurred: " + e.getMessage());
|
---|
1140 | }
|
---|
1141 | }
|
---|
1142 |
|
---|
1143 | }
|
---|