PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/projects/jboss-5.1.0/varia/src/tests/org/jboss/test/services/binding/test/PojoServiceBindingStoreUnitTestCase.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 609 lines | 474 code | 102 blank | 33 comment | 7 complexity | 3e2e42d62918f692595e7082737ed8b4 MD5 | raw file
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2008, Red Hat Middleware LLC, and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.test.services.binding.test;
  23. import java.net.InetAddress;
  24. import java.net.UnknownHostException;
  25. import java.util.Arrays;
  26. import java.util.HashMap;
  27. import java.util.HashSet;
  28. import java.util.Map;
  29. import java.util.Set;
  30. import junit.framework.TestCase;
  31. import org.jboss.services.binding.DuplicateServiceException;
  32. import org.jboss.services.binding.NoSuchBindingException;
  33. import org.jboss.services.binding.ServiceBinding;
  34. import org.jboss.services.binding.ServiceBindingMetadata;
  35. import org.jboss.services.binding.impl.PojoServiceBindingStore;
  36. import org.jboss.services.binding.impl.ServiceBindingSet;
  37. /**
  38. * Tests of PojoServiceBindingStore.
  39. *
  40. * @author Brian Stansberry
  41. * @version $Revision: 88905 $
  42. */
  43. public class PojoServiceBindingStoreUnitTestCase extends TestCase
  44. {
  45. private static final String A = "A";
  46. private static final String B = "B";
  47. private static final String C = "C";
  48. private static final String D = "D";
  49. private static ServiceBindingMetadata AA;
  50. private static ServiceBindingMetadata AB;
  51. private static ServiceBindingMetadata Anull;
  52. private static ServiceBindingMetadata BA;
  53. private static ServiceBindingSet SET_A;
  54. private static ServiceBindingSet SET_B;
  55. private static ServiceBindingSet SET_C;
  56. private Set<ServiceBindingMetadata> bindings = new HashSet<ServiceBindingMetadata>();
  57. private Set<ServiceBindingSet> bindingSets = new HashSet<ServiceBindingSet>();
  58. /**
  59. * Create a new PojoServiceBindingStoreUnitTestCase.
  60. *
  61. * @param name
  62. */
  63. public PojoServiceBindingStoreUnitTestCase(String name)
  64. {
  65. super(name);
  66. }
  67. @Override
  68. protected void setUp() throws Exception
  69. {
  70. super.setUp();
  71. AA = new ServiceBindingMetadata(A, A, null, 1, false, false);
  72. bindings.add(AA);
  73. AB = new ServiceBindingMetadata(A, B, null, 1, false, false);
  74. bindings.add(AB);
  75. Anull = new ServiceBindingMetadata(A, null, null, 1, false, false);
  76. bindings.add(Anull);
  77. // This one doesn't go in the standard bindings set
  78. BA = new ServiceBindingMetadata(B, A, null, 1, false, false);
  79. SET_A = new ServiceBindingSet(A);
  80. SET_A.setDefaultHostName("localhost");
  81. bindingSets.add(SET_A);
  82. SET_B = new ServiceBindingSet(B);
  83. SET_B.setDefaultHostName("localhost");
  84. bindingSets.add(SET_B);
  85. SET_C = new ServiceBindingSet(C);
  86. SET_C.setDefaultHostName("localhost");
  87. bindingSets.add(SET_C);
  88. }
  89. private static ServiceBinding getServiceBinding(ServiceBindingMetadata md, ServiceBindingSet set) throws UnknownHostException
  90. {
  91. return new ServiceBinding(md, set.getDefaultHostName(), set.getPortOffset());
  92. }
  93. public void testGetServiceBinding() throws Exception
  94. {
  95. PojoServiceBindingStore store = new PojoServiceBindingStore();
  96. store.setServiceBindingSets(bindingSets);
  97. store.setStandardBindings(bindings);
  98. store.start();
  99. assertEquals(getServiceBinding(AA, SET_A), store.getServiceBinding(A, A, A));
  100. assertEquals(getServiceBinding(AA, SET_B), store.getServiceBinding(B, A, A));
  101. assertEquals(getServiceBinding(AA, SET_C), store.getServiceBinding(C, A, A));
  102. assertEquals(getServiceBinding(AB, SET_A), store.getServiceBinding(A, A, B));
  103. assertEquals(getServiceBinding(AB, SET_B), store.getServiceBinding(B, A, B));
  104. assertEquals(getServiceBinding(AB, SET_C), store.getServiceBinding(C, A, B));
  105. assertEquals(getServiceBinding(Anull, SET_A), store.getServiceBinding(A, A, null));
  106. assertEquals(getServiceBinding(Anull, SET_B), store.getServiceBinding(B, A, null));
  107. assertEquals(getServiceBinding(Anull, SET_C), store.getServiceBinding(C, A, null));
  108. try
  109. {
  110. store.getServiceBinding(D, A, A);
  111. fail("invalid");
  112. }
  113. catch (NoSuchBindingException e) {}
  114. try
  115. {
  116. store.getServiceBinding(A, B, A);
  117. fail("invalid");
  118. }
  119. catch (NoSuchBindingException e) {}
  120. try
  121. {
  122. store.getServiceBinding(A, B, null);
  123. fail("invalid");
  124. }
  125. catch (NoSuchBindingException e) {}
  126. }
  127. public void testAddServiceBinding() throws Exception
  128. {
  129. PojoServiceBindingStore store = new PojoServiceBindingStore();
  130. store.setServiceBindingSets(bindingSets);
  131. store.setStandardBindings(bindings);
  132. store.start();
  133. ServiceBindingMetadata new1 = new ServiceBindingMetadata(B, A, "localhost", 1, false, false);
  134. store.addServiceBinding(A, new1);
  135. store.addServiceBinding(B, new1);
  136. store.addServiceBinding(C, new1);
  137. assertEquals(getServiceBinding(new1, SET_A), store.getServiceBinding(A, B, A));
  138. assertEquals(getServiceBinding(new1, SET_B), store.getServiceBinding(B, B, A));
  139. assertEquals(getServiceBinding(new1, SET_C), store.getServiceBinding(C, B, A));
  140. ServiceBindingMetadata new2 = new ServiceBindingMetadata(B, A, "localhost", 2, false, false);
  141. try
  142. {
  143. store.addServiceBinding(D, new2);
  144. fail("add for unknown binding set succeeded");
  145. }
  146. catch (IllegalArgumentException good) {}
  147. try
  148. {
  149. store.addServiceBinding(A, new2);
  150. fail("duplicate add succeeded");
  151. }
  152. catch (DuplicateServiceException good) {}
  153. }
  154. public void testRemoveServiceBinding() throws Exception
  155. {
  156. PojoServiceBindingStore store = new PojoServiceBindingStore();
  157. store.setServiceBindingSets(bindingSets);
  158. store.setStandardBindings(bindings);
  159. store.start();
  160. store.removeServiceBinding(A, AA);
  161. try
  162. {
  163. store.getServiceBinding(A, A, A);
  164. fail("invalid");
  165. }
  166. catch (NoSuchBindingException e) {}
  167. store.removeServiceBinding(B, AA);
  168. try
  169. {
  170. store.getServiceBinding(B, A, A);
  171. fail("invalid");
  172. }
  173. catch (NoSuchBindingException e) {}
  174. store.removeServiceBinding(A, Anull);
  175. try
  176. {
  177. store.getServiceBinding(A, A, null);
  178. fail("invalid");
  179. }
  180. catch (NoSuchBindingException e) {}
  181. store.removeServiceBinding(B, Anull);
  182. try
  183. {
  184. store.getServiceBinding(B, A, null);
  185. fail("invalid");
  186. }
  187. catch (NoSuchBindingException e) {}
  188. ServiceBindingMetadata new1 = new ServiceBindingMetadata(B, A, "localhost", 1, false, false);
  189. store.removeServiceBinding(A, new1);
  190. store.removeServiceBinding(A, BA);
  191. }
  192. public void testAddServiceBindingToAll() throws Exception
  193. {
  194. Set<ServiceBindingMetadata> set = new HashSet<ServiceBindingMetadata>();
  195. set.addAll(Arrays.asList(AA, AB, Anull));
  196. Set<ServiceBindingSet> ourSets = new HashSet<ServiceBindingSet>();
  197. ServiceBindingSet newSetA = new ServiceBindingSet(A, null, 10, set);
  198. ourSets.add(newSetA);
  199. ServiceBindingSet newSetB = new ServiceBindingSet(B, "localhost", 20, set);
  200. ourSets.add(newSetB);
  201. ServiceBindingSet newSetC = new ServiceBindingSet(C, "192.168.0.10", 30, set);
  202. ourSets.add(newSetC);
  203. PojoServiceBindingStore store = new PojoServiceBindingStore();
  204. store.setServiceBindingSets(ourSets);
  205. store.start();
  206. ServiceBindingMetadata new1 = new ServiceBindingMetadata(B, A, "192.168.0.22", 1, false, true);
  207. store.addServiceBinding(new1);
  208. InetAddress address = InetAddress.getByName("192.168.0.22");
  209. ServiceBinding got = store.getServiceBinding(A, B, A);
  210. assertEquals(getServiceBinding(new1, newSetA), got);
  211. assertEquals(11, got.getPort());
  212. assertEquals("192.168.0.22", got.getHostName());
  213. assertEquals(address, got.getBindAddress());
  214. got = store.getServiceBinding(B, B, A);
  215. assertEquals(getServiceBinding(new1, newSetB), got);
  216. assertEquals(21, got.getPort());
  217. assertEquals("192.168.0.22", got.getHostName());
  218. assertEquals(address, got.getBindAddress());
  219. got = store.getServiceBinding(C, B, A);
  220. assertEquals(getServiceBinding(new1, newSetC), got);
  221. assertEquals(31, got.getPort());
  222. assertEquals("192.168.0.22", got.getHostName());
  223. assertEquals(address, got.getBindAddress());
  224. ServiceBindingMetadata new2 = new ServiceBindingMetadata(B, A, "localhost", 2, false, false);
  225. try
  226. {
  227. store.addServiceBinding(new2);
  228. fail("duplicate add succeeded");
  229. }
  230. catch (DuplicateServiceException good) {}
  231. ServiceBindingMetadata new3 = new ServiceBindingMetadata(C, C, null, 3, false, false);
  232. store.addServiceBinding(new3);
  233. got = store.getServiceBinding(A, C, C);
  234. assertEquals(getServiceBinding(new3, newSetA), got);
  235. assertEquals(13, got.getPort());
  236. assertNull(got.getHostName());
  237. assertEquals(InetAddress.getByName(null), got.getBindAddress());
  238. got = store.getServiceBinding(B, C, C);
  239. assertEquals(getServiceBinding(new3, newSetB), got);
  240. assertEquals(23, got.getPort());
  241. assertEquals("localhost", got.getHostName());
  242. assertEquals(InetAddress.getByName("localhost"), got.getBindAddress());
  243. got = store.getServiceBinding(C, C, C);
  244. assertEquals(getServiceBinding(new3, newSetC), got);
  245. assertEquals(33, got.getPort());
  246. assertEquals("192.168.0.10", got.getHostName());
  247. assertEquals(InetAddress.getByName("192.168.0.10"), got.getBindAddress());
  248. }
  249. public void testRemoveServiceBindingFromAll() throws Exception
  250. {
  251. PojoServiceBindingStore store = new PojoServiceBindingStore();
  252. store.setServiceBindingSets(bindingSets);
  253. store.setStandardBindings(bindings);
  254. store.start();
  255. store.removeServiceBinding(AA);
  256. try
  257. {
  258. store.getServiceBinding(A, A, A);
  259. fail("invalid");
  260. }
  261. catch (NoSuchBindingException e) {}
  262. store.removeServiceBinding(B, AA);
  263. try
  264. {
  265. store.getServiceBinding(B, A, A);
  266. fail("invalid");
  267. }
  268. catch (NoSuchBindingException e) {}
  269. try
  270. {
  271. store.getServiceBinding(C, A, A);
  272. fail("invalid");
  273. }
  274. catch (NoSuchBindingException e) {}
  275. String nullA = null;
  276. store.removeServiceBinding(A, nullA);
  277. try
  278. {
  279. store.getServiceBinding(A, A, null);
  280. fail("invalid");
  281. }
  282. catch (NoSuchBindingException e) {}
  283. try
  284. {
  285. store.getServiceBinding(B, A, null);
  286. fail("invalid");
  287. }
  288. catch (NoSuchBindingException e) {}
  289. try
  290. {
  291. store.getServiceBinding(C, A, null);
  292. fail("invalid");
  293. }
  294. catch (NoSuchBindingException e) {}
  295. ServiceBindingMetadata new1 = new ServiceBindingMetadata(B, A, "localhost", 1, false, false);
  296. store.removeServiceBinding(new1);
  297. store.removeServiceBinding(B, A);
  298. }
  299. public void testDefaultDefaults() throws Exception
  300. {
  301. PojoServiceBindingStore store = new PojoServiceBindingStore();
  302. store.setServiceBindingSets(bindingSets);
  303. store.setStandardBindings(bindings);
  304. store.start();
  305. String[] names = {A, B, C};
  306. for (String name :names)
  307. {
  308. assertEquals("localhost", store.getDefaultHostName(name));
  309. assertEquals(0, store.getDefaultPortOffset(name));
  310. }
  311. }
  312. public void testDefaults() throws Exception
  313. {
  314. Set<ServiceBindingMetadata> set = new HashSet<ServiceBindingMetadata>();
  315. set.addAll(Arrays.asList(AA, AB, Anull));
  316. Set<ServiceBindingSet> sbs = new HashSet<ServiceBindingSet>();
  317. sbs.add(new ServiceBindingSet(A, null, 10, set));
  318. sbs.add(new ServiceBindingSet(B, "localhost", 20, set));
  319. sbs.add(new ServiceBindingSet(C, "192.168.0.10", 30, set));
  320. PojoServiceBindingStore store = new PojoServiceBindingStore();
  321. store.setServiceBindingSets(sbs);
  322. store.start();
  323. assertNull(store.getDefaultHostName(A));
  324. assertEquals(10, store.getDefaultPortOffset(A));
  325. assertEquals("localhost", store.getDefaultHostName(B));
  326. assertEquals(20, store.getDefaultPortOffset(B));
  327. assertEquals("192.168.0.10", store.getDefaultHostName(C));
  328. assertEquals(30, store.getDefaultPortOffset(C));
  329. }
  330. public void testGetServiceBindings() throws Exception
  331. {
  332. PojoServiceBindingStore store = new PojoServiceBindingStore();
  333. store.setServiceBindingSets(bindingSets);
  334. store.setStandardBindings(bindings);
  335. store.start();
  336. String[] servers = {A, B, C};
  337. for (String server : servers)
  338. {
  339. Set<ServiceBinding> set = store.getServiceBindings(server);
  340. assertEquals(bindings.size(), set.size());
  341. for (ServiceBinding binding : set)
  342. {
  343. ServiceBindingMetadata metadata = new ServiceBindingMetadata(binding);
  344. assertTrue(server + " includes " + metadata, bindings.contains(metadata));
  345. }
  346. }
  347. }
  348. public void testSetStandardBindings() throws Exception
  349. {
  350. Set<ServiceBindingMetadata> set = new HashSet<ServiceBindingMetadata>();
  351. set.addAll(Arrays.asList(AA, AB, Anull));
  352. Set<ServiceBindingSet> sbs = new HashSet<ServiceBindingSet>();
  353. ServiceBindingSet setB = new ServiceBindingSet(B, "localhost", 20);
  354. sbs.add(setB);
  355. ServiceBindingSet setC = new ServiceBindingSet(C, "192.168.0.10", 30);
  356. sbs.add(setC);
  357. PojoServiceBindingStore store = new PojoServiceBindingStore(sbs, set);
  358. store.start();
  359. Set<ServiceBindingMetadata> updatedSet =
  360. new HashSet<ServiceBindingMetadata>(store.getStandardBindings());
  361. assertEquals(3, updatedSet.size());
  362. ServiceBindingMetadata updated = new ServiceBindingMetadata(AA);
  363. updated.setPort(9999);
  364. updated.setDescription("updated");
  365. updatedSet.remove(AA);
  366. updatedSet.add(updated);
  367. updatedSet.add(BA);
  368. assertEquals(4, updatedSet.size());
  369. store.setStandardBindings(updatedSet);
  370. Set<ServiceBindingMetadata> result = store.getStandardBindings();
  371. assertNotNull(result);
  372. assertTrue("has updated", result.contains(updated));
  373. assertTrue("has AB", result.contains(AB));
  374. assertTrue("has Anull", result.contains(Anull));
  375. assertTrue("has BA", result.contains(BA));
  376. for (ServiceBindingSet bindingSet : sbs)
  377. {
  378. String setName = bindingSet.getName();
  379. Set<ServiceBinding> bindings = store.getServiceBindings(setName);
  380. assertNotNull(bindings);
  381. assertEquals(4, bindings.size());
  382. Map<String, ServiceBinding> byFQN = new HashMap<String, ServiceBinding>();
  383. for (ServiceBinding binding : bindings)
  384. {
  385. byFQN.put(binding.getFullyQualifiedName(), binding);
  386. }
  387. ServiceBinding aa = byFQN.get(updated.getFullyQualifiedName());
  388. assertNotNull(aa);
  389. assertEquals(setName + "/updated/serviceName", updated.getServiceName(), aa.getServiceName());
  390. assertEquals(setName + "/updated/bindingName", updated.getBindingName(), aa.getBindingName());
  391. assertEquals(setName + "/updated/description", updated.getDescription(), aa.getDescription());
  392. assertEquals(setName + "/updated/hostName", bindingSet.getDefaultHostName(), aa.getHostName());
  393. assertEquals(setName + "/updated/port", updated.getPort() + bindingSet.getPortOffset(), aa.getPort());
  394. ServiceBinding ab = byFQN.get(AB.getFullyQualifiedName());
  395. assertNotNull(aa);
  396. assertEquals(setName + "/AB/serviceName", AB.getServiceName(), ab.getServiceName());
  397. assertEquals(setName + "/AB/bindingName", AB.getBindingName(), ab.getBindingName());
  398. assertEquals(setName + "/AB/description", AB.getDescription(), ab.getDescription());
  399. assertEquals(setName + "/AB/hostName", bindingSet.getDefaultHostName(), ab.getHostName());
  400. assertEquals(setName + "/AB/port", AB.getPort() + bindingSet.getPortOffset(), ab.getPort());
  401. ServiceBinding anull = byFQN.get(Anull.getFullyQualifiedName());
  402. assertNotNull(anull);
  403. assertEquals(setName + "/Anull/serviceName", Anull.getServiceName(), anull.getServiceName());
  404. assertEquals(setName + "/Anull/bindingName", Anull.getBindingName(), anull.getBindingName());
  405. assertEquals(setName + "/Anull/description", Anull.getDescription(), anull.getDescription());
  406. assertEquals(setName + "/Anull/hostName", bindingSet.getDefaultHostName(), anull.getHostName());
  407. assertEquals(setName + "/Anull/port", Anull.getPort() + bindingSet.getPortOffset(), anull.getPort());
  408. ServiceBinding newOne = byFQN.get(BA.getFullyQualifiedName());
  409. assertNotNull(newOne);
  410. assertEquals(setName + "/BA/serviceName", BA.getServiceName(), newOne.getServiceName());
  411. assertEquals(setName + "/BA/bindingName", BA.getBindingName(), newOne.getBindingName());
  412. assertEquals(setName + "/BA/description", BA.getDescription(), newOne.getDescription());
  413. assertEquals(setName + "/BA/hostName", bindingSet.getDefaultHostName(), newOne.getHostName());
  414. assertEquals(setName + "/BA/port", BA.getPort() + bindingSet.getPortOffset(), newOne.getPort());
  415. }
  416. }
  417. public void testSetServiceBindingSets() throws Exception
  418. {
  419. Set<ServiceBindingMetadata> set = new HashSet<ServiceBindingMetadata>();
  420. set.addAll(Arrays.asList(AA, AB, Anull));
  421. Set<ServiceBindingSet> sbs = new HashSet<ServiceBindingSet>();
  422. ServiceBindingSet setA = new ServiceBindingSet(A, null, 10);
  423. sbs.add(setA);
  424. ServiceBindingSet setB = new ServiceBindingSet(B, "localhost", 20);
  425. sbs.add(setB);
  426. PojoServiceBindingStore store = new PojoServiceBindingStore(sbs, set);
  427. store.start();
  428. Set<ServiceBindingSet> updated = new HashSet<ServiceBindingSet>(store.getServiceBindingSets());
  429. Set<ServiceBindingMetadata> overrides = new HashSet<ServiceBindingMetadata>();
  430. overrides.add(BA);
  431. ServiceBindingSet newSet = new ServiceBindingSet(C, "192.168.0.10", 30, overrides);
  432. updated.add(newSet);
  433. ServiceBindingSet replaced = new ServiceBindingSet(B, "localhost", 50);
  434. updated.remove(setB);
  435. updated.add(replaced);
  436. assertEquals(3, updated.size());
  437. store.setServiceBindingSets(updated);
  438. Set<ServiceBindingSet> result = store.getServiceBindingSets();
  439. assertNotNull(result);
  440. assertTrue("has setA", result.contains(setA));
  441. assertTrue("has setB", result.contains(replaced));
  442. assertTrue("has newSet", result.contains(newSet));
  443. Set<ServiceBinding> bindings = store.getServiceBindings(C);
  444. assertNotNull(bindings);
  445. Map<String, ServiceBinding> byFQN = new HashMap<String, ServiceBinding>();
  446. for (ServiceBinding binding : bindings)
  447. {
  448. byFQN.put(binding.getFullyQualifiedName(), binding);
  449. }
  450. ServiceBinding aa = byFQN.get(AA.getFullyQualifiedName());
  451. assertNotNull(aa);
  452. assertEquals(AA.getServiceName(), aa.getServiceName());
  453. assertEquals(AA.getBindingName(), aa.getBindingName());
  454. assertEquals(AA.getDescription(), aa.getDescription());
  455. assertEquals("192.168.0.10", aa.getHostName());
  456. assertEquals(AA.getPort() + 30, aa.getPort());
  457. ServiceBinding ab = byFQN.get(AB.getFullyQualifiedName());
  458. assertNotNull(aa);
  459. assertEquals(AB.getServiceName(), ab.getServiceName());
  460. assertEquals(AB.getBindingName(), ab.getBindingName());
  461. assertEquals(AB.getDescription(), ab.getDescription());
  462. assertEquals("192.168.0.10", ab.getHostName());
  463. assertEquals(AB.getPort() + 30, ab.getPort());
  464. ServiceBinding anull = byFQN.get(Anull.getFullyQualifiedName());
  465. assertNotNull(anull);
  466. assertEquals(Anull.getServiceName(), anull.getServiceName());
  467. assertEquals(Anull.getBindingName(), anull.getBindingName());
  468. assertEquals(Anull.getDescription(), anull.getDescription());
  469. assertEquals("192.168.0.10", anull.getHostName());
  470. assertEquals(Anull.getPort() + 30, anull.getPort());
  471. ServiceBinding newOne = byFQN.get(BA.getFullyQualifiedName());
  472. assertNotNull(newOne);
  473. assertEquals(BA.getServiceName(), newOne.getServiceName());
  474. assertEquals(BA.getBindingName(), newOne.getBindingName());
  475. assertEquals(BA.getDescription(), newOne.getDescription());
  476. assertEquals("192.168.0.10", newOne.getHostName());
  477. assertEquals(BA.getPort() + 30, newOne.getPort());
  478. bindings = store.getServiceBindings(B);
  479. assertNotNull(bindings);
  480. byFQN = new HashMap<String, ServiceBinding>();
  481. for (ServiceBinding binding : bindings)
  482. {
  483. byFQN.put(binding.getFullyQualifiedName(), binding);
  484. }
  485. aa = byFQN.get(AA.getFullyQualifiedName());
  486. assertNotNull(aa);
  487. assertEquals(AA.getServiceName(), aa.getServiceName());
  488. assertEquals(AA.getBindingName(), aa.getBindingName());
  489. assertEquals(AA.getDescription(), aa.getDescription());
  490. assertEquals("localhost", aa.getHostName());
  491. assertEquals(AA.getPort() + 50, aa.getPort());
  492. ab = byFQN.get(AB.getFullyQualifiedName());
  493. assertNotNull(aa);
  494. assertEquals(AB.getServiceName(), ab.getServiceName());
  495. assertEquals(AB.getBindingName(), ab.getBindingName());
  496. assertEquals(AB.getDescription(), ab.getDescription());
  497. assertEquals("localhost", ab.getHostName());
  498. assertEquals(AB.getPort() + 50, ab.getPort());
  499. anull = byFQN.get(Anull.getFullyQualifiedName());
  500. assertNotNull(anull);
  501. assertEquals(Anull.getServiceName(), anull.getServiceName());
  502. assertEquals(Anull.getBindingName(), anull.getBindingName());
  503. assertEquals(Anull.getDescription(), anull.getDescription());
  504. assertEquals("localhost", anull.getHostName());
  505. assertEquals(Anull.getPort() + 50, anull.getPort());
  506. }
  507. }