Package org.jboss.services.binding

Examples of org.jboss.services.binding.ServiceBinding


      bindingSets.add(SET_C);
   }
  
   private static ServiceBinding getServiceBinding(ServiceBindingMetadata md, ServiceBindingSet set) throws UnknownHostException
   {
      return new ServiceBinding(md, set.getDefaultHostName(), set.getPortOffset());
   }
View Full Code Here


      ServiceBindingMetadata new1 = new ServiceBindingMetadata(B, A, "192.168.0.22", 1, false, true);
      store.addServiceBinding(new1);
     
      InetAddress address = InetAddress.getByName("192.168.0.22");
     
      ServiceBinding got = store.getServiceBinding(A, B, A);
      assertEquals(getServiceBinding(new1, newSetA), got);   
      assertEquals(11, got.getPort());
      assertEquals("192.168.0.22", got.getHostName());
      assertEquals(address, got.getBindAddress());
     
      got = store.getServiceBinding(B, B, A);
      assertEquals(getServiceBinding(new1, newSetB), got);   
      assertEquals(21, got.getPort());
      assertEquals("192.168.0.22", got.getHostName());
      assertEquals(address, got.getBindAddress());
     
      got = store.getServiceBinding(C, B, A);
      assertEquals(getServiceBinding(new1, newSetC), got);
      assertEquals(31, got.getPort());
      assertEquals("192.168.0.22", got.getHostName());
      assertEquals(address, got.getBindAddress());
     
      ServiceBindingMetadata new2 = new ServiceBindingMetadata(B, A, "localhost", 2, false, false);
      try
      {
         store.addServiceBinding(new2);
         fail("duplicate add succeeded");
      }
      catch (DuplicateServiceException good) {}
     
      ServiceBindingMetadata new3 = new ServiceBindingMetadata(C, C, null, 3, false, false);
      store.addServiceBinding(new3);
     
      got = store.getServiceBinding(A, C, C);
      assertEquals(getServiceBinding(new3, newSetA), got);   
      assertEquals(13, got.getPort());
      assertNull(got.getHostName());
      assertEquals(InetAddress.getByName(null), got.getBindAddress());
     
      got = store.getServiceBinding(B, C, C);
      assertEquals(getServiceBinding(new3, newSetB), got);   
      assertEquals(23, got.getPort());
      assertEquals("localhost", got.getHostName());
      assertEquals(InetAddress.getByName("localhost"), got.getBindAddress());
     
      got = store.getServiceBinding(C, C, C);
      assertEquals(getServiceBinding(new3, newSetC), got);   
      assertEquals(33, got.getPort());
      assertEquals("192.168.0.10", got.getHostName());
      assertEquals(InetAddress.getByName("192.168.0.10"), got.getBindAddress());
     
   }
View Full Code Here

         for (ServiceBinding binding : bindings)
         {
            byFQN.put(binding.getFullyQualifiedName(), binding);
         }
        
         ServiceBinding aa = byFQN.get(updated.getFullyQualifiedName());
         assertNotNull(aa);
         assertEquals(setName + "/updated/serviceName", updated.getServiceName(), aa.getServiceName());
         assertEquals(setName + "/updated/bindingName", updated.getBindingName(), aa.getBindingName());
         assertEquals(setName + "/updated/description", updated.getDescription(), aa.getDescription());
         assertEquals(setName + "/updated/hostName", bindingSet.getDefaultHostName(), aa.getHostName());
         assertEquals(setName + "/updated/port", updated.getPort() + bindingSet.getPortOffset(), aa.getPort());
        
         ServiceBinding ab = byFQN.get(AB.getFullyQualifiedName());
         assertNotNull(aa);
         assertEquals(setName + "/AB/serviceName", AB.getServiceName(), ab.getServiceName());
         assertEquals(setName + "/AB/bindingName", AB.getBindingName(), ab.getBindingName());
         assertEquals(setName + "/AB/description", AB.getDescription(), ab.getDescription());
         assertEquals(setName + "/AB/hostName", bindingSet.getDefaultHostName(), ab.getHostName());
         assertEquals(setName + "/AB/port", AB.getPort() + bindingSet.getPortOffset(), ab.getPort());
        
         ServiceBinding anull = byFQN.get(Anull.getFullyQualifiedName());
         assertNotNull(anull);
         assertEquals(setName + "/Anull/serviceName", Anull.getServiceName(), anull.getServiceName());
         assertEquals(setName + "/Anull/bindingName", Anull.getBindingName(), anull.getBindingName());
         assertEquals(setName + "/Anull/description", Anull.getDescription(), anull.getDescription());
         assertEquals(setName + "/Anull/hostName", bindingSet.getDefaultHostName(), anull.getHostName());
         assertEquals(setName + "/Anull/port", Anull.getPort() + bindingSet.getPortOffset(), anull.getPort());
        
         ServiceBinding newOne = byFQN.get(BA.getFullyQualifiedName());
         assertNotNull(newOne);
         assertEquals(setName + "/BA/serviceName", BA.getServiceName(), newOne.getServiceName());
         assertEquals(setName + "/BA/bindingName", BA.getBindingName(), newOne.getBindingName());
         assertEquals(setName + "/BA/description", BA.getDescription(), newOne.getDescription());
         assertEquals(setName + "/BA/hostName", bindingSet.getDefaultHostName(), newOne.getHostName());
         assertEquals(setName + "/BA/port", BA.getPort() + bindingSet.getPortOffset(), newOne.getPort());
      }
   }
View Full Code Here

      for (ServiceBinding binding : bindings)
      {
         byFQN.put(binding.getFullyQualifiedName(), binding);
      }
     
      ServiceBinding aa = byFQN.get(AA.getFullyQualifiedName());
      assertNotNull(aa);
      assertEquals(AA.getServiceName(), aa.getServiceName());
      assertEquals(AA.getBindingName(), aa.getBindingName());
      assertEquals(AA.getDescription(), aa.getDescription());
      assertEquals("192.168.0.10", aa.getHostName());
      assertEquals(AA.getPort() + 30, aa.getPort());
     
      ServiceBinding ab = byFQN.get(AB.getFullyQualifiedName());
      assertNotNull(aa);
      assertEquals(AB.getServiceName(), ab.getServiceName());
      assertEquals(AB.getBindingName(), ab.getBindingName());
      assertEquals(AB.getDescription(), ab.getDescription());
      assertEquals("192.168.0.10", ab.getHostName());
      assertEquals(AB.getPort() + 30, ab.getPort());
     
      ServiceBinding anull = byFQN.get(Anull.getFullyQualifiedName());
      assertNotNull(anull);
      assertEquals(Anull.getServiceName(), anull.getServiceName());
      assertEquals(Anull.getBindingName(), anull.getBindingName());
      assertEquals(Anull.getDescription(), anull.getDescription());
      assertEquals("192.168.0.10", anull.getHostName());
      assertEquals(Anull.getPort() + 30, anull.getPort());
     
      ServiceBinding newOne = byFQN.get(BA.getFullyQualifiedName());
      assertNotNull(newOne);
      assertEquals(BA.getServiceName(), newOne.getServiceName());
      assertEquals(BA.getBindingName(), newOne.getBindingName());
      assertEquals(BA.getDescription(), newOne.getDescription());
      assertEquals("192.168.0.10", newOne.getHostName());
      assertEquals(BA.getPort() + 30, newOne.getPort());
     
      bindings = store.getServiceBindings(B);
      assertNotNull(bindings);
      byFQN = new HashMap<String, ServiceBinding>();
      for (ServiceBinding binding : bindings)
View Full Code Here

TOP

Related Classes of org.jboss.services.binding.ServiceBinding

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.