Examples of IServiceTypeID


Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

    final IServiceInfo serviceInfo = new JSLPServiceInfo(DiscoveryTestHelper.SERVICENAME, new ServiceURLAdapter(sUrl), DiscoveryTestHelper.PRIORITY, DiscoveryTestHelper.WEIGHT, new ServicePropertiesAdapter(new ArrayList()));
    assertEquals(serviceInfo.getPriority(), DiscoveryTestHelper.PRIORITY);
    assertEquals(serviceInfo.getWeight(), DiscoveryTestHelper.WEIGHT);
    final IServiceID sid = serviceInfo.getServiceID();
    assertEquals(serviceInfo.getServiceName(), DiscoveryTestHelper.SERVICENAME);
    final IServiceTypeID stid = sid.getServiceTypeID();
   
    assertEquals(internalRep, stid.getInternal());
    assertEquals("_service._foo._bar._" + IServiceTypeID.DEFAULT_PROTO[0] + "." + IServiceTypeID.DEFAULT_SCOPE[0] + "._eclipse", stid.getName());
   
    assertEquals("eclipse", stid.getNamingAuthority());
    assertTrue(Arrays.equals(new String[] {"service", "foo", "bar"}, stid.getServices()));
    assertTrue(Arrays.equals(IServiceTypeID.DEFAULT_SCOPE, stid.getScopes()));
    assertTrue(Arrays.equals(IServiceTypeID.DEFAULT_PROTO, stid.getProtocols()));
  }
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

  /* (non-Javadoc)
   * @see org.eclipse.ecf.tests.discovery.identity.ServiceIDTest#testCreateServiceTypeIDFromInternalString()
   */
  public void testCreateServiceTypeIDFromSLPStringWithDefaultNamingAuthority() {
    final String internalRep = "service:foo.iana:bar";
    final IServiceTypeID stid = (IServiceTypeID) new JSLPNamespace().createInstance(new Object[]{internalRep});

    // the internalRep contains "iana" but getInternal may not!
    final int indexOf = stid.getInternal().toLowerCase().indexOf("iana");
    assertTrue(indexOf == -1);
    assertEquals(IServiceTypeID.DEFAULT_NA, stid.getNamingAuthority());
    assertNotSame(internalRep, stid.getName());
  }
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

    assertNotSame(internalRep, stid.getName());
  }

  public void testECFDefaultsTojSLP() {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    IServiceTypeID stid = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, DiscoveryTestHelper.SERVICES, DiscoveryTestHelper.PROTOCOLS);
    assertNotNull(stid);
    assertTrue(Arrays.equals(DiscoveryTestHelper.SERVICES, stid.getServices()));
    assertTrue(Arrays.equals(IServiceTypeID.DEFAULT_SCOPE, stid.getScopes()));
    assertTrue(Arrays.equals(DiscoveryTestHelper.PROTOCOLS, stid.getProtocols()));

    String internal = stid.getInternal();
    assertEquals("service:" + DiscoveryTestHelper.SERVICES[0] + ":" + DiscoveryTestHelper.SERVICES[1] + ":" + DiscoveryTestHelper.SERVICES[2], internal);
  }
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

    assertEquals("service:" + DiscoveryTestHelper.SERVICES[0] + ":" + DiscoveryTestHelper.SERVICES[1] + ":" + DiscoveryTestHelper.SERVICES[2], internal);
  }

  public void testjSLPDefaultsToECF() {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    IServiceTypeID stid = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, DiscoveryTestHelper.SERVICES, new String[]{DiscoveryTestHelper.SCOPE}, DiscoveryTestHelper.PROTOCOLS, DiscoveryTestHelper.NAMINGAUTHORITY);
    assertNotNull(stid);
    assertEquals(DiscoveryTestHelper.NAMINGAUTHORITY, stid.getNamingAuthority());
    assertEquals("_ecf._junit._tests._someProtocol." + DiscoveryTestHelper.SCOPE + "._" + DiscoveryTestHelper.NAMINGAUTHORITY, stid.getName());
  }
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

    assertEquals("_ecf._junit._tests._someProtocol." + DiscoveryTestHelper.SCOPE + "._" + DiscoveryTestHelper.NAMINGAUTHORITY, stid.getName());
  }
 
  public void testjSLPDefaultsToECF2() {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    IServiceTypeID stid = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, DiscoveryTestHelper.SERVICES, DiscoveryTestHelper.PROTOCOLS);
    assertNotNull(stid);
    assertEquals(IServiceTypeID.DEFAULT_NA, stid.getNamingAuthority());
    assertEquals("_ecf._junit._tests._someProtocol." + IServiceTypeID.DEFAULT_SCOPE[0] + "._" + IServiceTypeID.DEFAULT_NA, stid.getName());
  }
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

      final IServiceInfo first = (IServiceInfo) arg0;
      final IServiceInfo second = (IServiceInfo) arg1;
     
      final IServiceID firstID = first.getServiceID();
      final IServiceID secondID = second.getServiceID();
      final IServiceTypeID firstTypeID = firstID.getServiceTypeID();
      final IServiceTypeID secondTypeID = secondID.getServiceTypeID();
     
      final boolean protocolsSame = Arrays.equals(firstTypeID.getProtocols(), secondTypeID.getProtocols());
      final boolean weightSame = first.getWeight() == second.getWeight();
      final boolean prioSame = first.getPriority() == second.getPriority();
      final String firstName = firstID.getName();
      final String secondName = secondID.getName();
      final boolean nameSame = firstName.equals(secondName);
      final String[] firstServices = firstTypeID.getServices();
      final String[] secondServices = secondTypeID.getServices();
      final boolean serviceSame = Arrays.equals(firstServices, secondServices);
      final Namespace firstNamespace = firstID.getNamespace();
      final Namespace secondNamespace = secondID.getNamespace();
      final boolean namespaceSame = firstNamespace.equals(secondNamespace);
      final String firstNA = firstTypeID.getNamingAuthority();
      final String secondsSA = secondTypeID.getNamingAuthority();
      final boolean naSame = firstNA.equals(secondsSA);
      final URI firstLocation = first.getLocation();
      final URI secondLocation = second.getLocation();
      final boolean locationSame = firstLocation.equals(secondLocation);
      final boolean scopesSame = Arrays.equals(firstTypeID.getScopes(), secondTypeID.getScopes());
      final IServiceProperties firstProperty = first.getServiceProperties();
      final IServiceProperties secondProperty = second.getServiceProperties();
      final boolean propertySame = firstProperty.equals(secondProperty);
      final boolean result = protocolsSame && weightSame && prioSame && nameSame && namespaceSame && serviceSame && naSame && locationSame && scopesSame && propertySame;
      if(result == true) {
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

  public static IServiceInfo createServiceInfo(Namespace namespace) {
    final Properties props = new Properties();
    final URI uri = URI.create(SCHEME + "://" + DOMAIN_A_RECORD + ":" + PORT + PATH);
 
    IServiceTypeID serviceTypeID = ServiceIDFactory.getDefault().createServiceTypeID(namespace, new String[]{SCHEME}, new String[]{DOMAIN}, new String[]{PROTO}, NAMING_AUTH);
   
    final ServiceProperties serviceProperties = new ServiceProperties(props);
    serviceProperties.setPropertyString("path", PATH);
    serviceProperties.setPropertyString("dns-sd.ptcl", SCHEME);
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

  public void testGetServiceTypes() throws ContainerConnectException {
    registerService();
    final IServiceTypeID[] serviceTypeIDs = discoveryLocator.getServiceTypes();
    assertTrue("IServiceInfo[] is empty", serviceTypeIDs.length >= 1);
    for (int i = 0; i < serviceTypeIDs.length; i++) {
      IServiceTypeID iServiceTypeId = serviceTypeIDs[i];
      if(serviceInfo.getServiceID().getServiceTypeID().equals(iServiceTypeId)) {
        return;
      }
    }
    fail("Self registered service not found");
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

    final Object object = aFuture.get();
    assertTrue(object instanceof IServiceTypeID[]);
    final IServiceTypeID[] services = (IServiceTypeID[]) object;
    assertTrue("Found: " + services.length + Arrays.asList(services), services.length == 1); // just expect one event as the implementation filters dupes
    for (int i = 0; i < services.length; i++) {
      IServiceTypeID iServiceTypeId = services[i];
      if(serviceInfo.getServiceID().getServiceTypeID().equals(iServiceTypeId)) {
        return;
      }
    }
    fail("Self registered service not found");
View Full Code Here

Examples of org.eclipse.ecf.discovery.identity.IServiceTypeID

   
    // override the service info with a _generic_ service info. Generic in
    // the sense that its namespace if the parent DiscoveryNamespace and not
    // a provider specific one. We need to use the parent DN because users of the
    // whiteboard pattern do not interact with the IDA directly.
    IServiceTypeID serviceTypeID = ServiceIDFactory.getDefault()
        .createServiceTypeID(
            IDFactory.getDefault().getNamespaceByName(
                DiscoveryNamespace.NAME), services,
            new String[] { scope }, new String[] { protocol },
            namingAuthority);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.