Search in sources :

Example 11 with IServiceTypeID

use of org.eclipse.ecf.discovery.identity.IServiceTypeID in project ecf by eclipse.

the class DiscoveryTestsWithoutRegister method testGetServicesNamespace.

/**
 * Test method for
 * {@link org.eclipse.ecf.discovery.IdiscoveryLocatorAdapter#getServicesNamespace()}.
 */
public void testGetServicesNamespace() {
    testConnect();
    final Namespace namespace = discoveryLocator.getServicesNamespace();
    assertNotNull(namespace);
    final IServiceTypeID serviceTypeID = ServiceIDFactory.getDefault().createServiceTypeID(namespace, serviceInfo.getServiceID().getServiceTypeID());
    assertNotNull("It must be possible to obtain a IServiceTypeID", serviceTypeID);
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 12 with IServiceTypeID

use of org.eclipse.ecf.discovery.identity.IServiceTypeID in project ecf by eclipse.

the class ServiceIDTest method createFromAnother.

/**
 * Creates a new instance of IServiceTypeId with the Namespace of the second parameter and the instance of the first parameter
 * @param aServiceTypeID Used as a prototype
 * @param stid Namespace to use
 */
private void createFromAnother(IServiceTypeID aServiceTypeID, IServiceTypeID stid) {
    final Namespace namespace2 = stid.getNamespace();
    IServiceTypeID instance = null;
    instance = ServiceIDFactory.getDefault().createServiceTypeID(namespace2, aServiceTypeID);
    assertNotNull("it should have been possible to create a new instance of ", instance);
    assertTrue(instance.hashCode() == stid.hashCode());
    // TODO-mkuppe decide if equality should be handled by the namespace for IServiceTypeIDs?
    assertEquals(instance, stid);
    assertEquals(stid, instance);
    assertTrue(instance.hashCode() == aServiceTypeID.hashCode());
    assertEquals(instance, aServiceTypeID);
    assertEquals(aServiceTypeID, instance);
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 13 with IServiceTypeID

use of org.eclipse.ecf.discovery.identity.IServiceTypeID in project ecf by eclipse.

the class ServiceIDTest method createIDFromStringWithEx.

protected IServiceTypeID createIDFromStringWithEx(String serviceType) {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    ServiceTypeID serviceTypeID = new ServiceTypeID(namespaceByName, serviceType);
    return ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, serviceTypeID);
}
Also used : ServiceTypeID(org.eclipse.ecf.discovery.identity.ServiceTypeID) IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 14 with IServiceTypeID

use of org.eclipse.ecf.discovery.identity.IServiceTypeID in project ecf by eclipse.

the class ServiceIDTest method testServiceIDFactory2.

/*
	 * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String, String)
	 */
public void testServiceIDFactory2() {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    ServiceTypeID serviceTypeID = new ServiceTypeID(new TestNamespace(), "_service._ecf._foo._bar._tcp.ecf.eclipse.org._IANA");
    IServiceTypeID aServiceTypeID = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, serviceTypeID);
    assertNotNull(aServiceTypeID);
    // members should be the same
    assertEquals(aServiceTypeID.getNamingAuthority(), serviceTypeID.getNamingAuthority());
    assertTrue(Arrays.equals(aServiceTypeID.getServices(), serviceTypeID.getServices()));
    assertTrue(Arrays.equals(aServiceTypeID.getScopes(), serviceTypeID.getScopes()));
    assertTrue(Arrays.equals(aServiceTypeID.getProtocols(), serviceTypeID.getProtocols()));
    assertSame(namespaceByName, aServiceTypeID.getNamespace());
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) ServiceTypeID(org.eclipse.ecf.discovery.identity.ServiceTypeID) IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) Namespace(org.eclipse.ecf.core.identity.Namespace)

Example 15 with IServiceTypeID

use of org.eclipse.ecf.discovery.identity.IServiceTypeID in project ecf by eclipse.

the class ServiceIDTest method testServiceIDFactoryDefaults.

/*
	 * org.eclipse.ecf.discovery.identity.IServiceIDFactory.createServiceID(Namespace, String[], String)
	 */
public void testServiceIDFactoryDefaults() {
    Namespace namespaceByName = IDFactory.getDefault().getNamespaceByName(namespace);
    IServiceTypeID serviceType = ServiceIDFactory.getDefault().createServiceTypeID(namespaceByName, services, protocols);
    assertNotNull(serviceType);
    assertTrue(Arrays.equals(services, serviceType.getServices()));
    assertEquals(IServiceTypeID.DEFAULT_NA, serviceType.getNamingAuthority());
    assertTrue(Arrays.equals(IServiceTypeID.DEFAULT_SCOPE, serviceType.getScopes()));
    assertTrue(Arrays.equals(protocols, serviceType.getProtocols()));
}
Also used : IServiceTypeID(org.eclipse.ecf.discovery.identity.IServiceTypeID) Namespace(org.eclipse.ecf.core.identity.Namespace)

Aggregations

IServiceTypeID (org.eclipse.ecf.discovery.identity.IServiceTypeID)35 Namespace (org.eclipse.ecf.core.identity.Namespace)10 URI (java.net.URI)9 IServiceInfo (org.eclipse.ecf.discovery.IServiceInfo)9 ServiceInfo (org.eclipse.ecf.discovery.ServiceInfo)5 JSLPNamespace (org.eclipse.ecf.provider.jslp.identity.JSLPNamespace)5 ArrayList (java.util.ArrayList)4 Properties (java.util.Properties)4 IServiceID (org.eclipse.ecf.discovery.identity.IServiceID)4 ServiceURL (ch.ethz.iks.slp.ServiceURL)3 ServiceProperties (org.eclipse.ecf.discovery.ServiceProperties)3 URISyntaxException (java.net.URISyntaxException)2 List (java.util.List)2 Map (java.util.Map)2 IServiceProperties (org.eclipse.ecf.discovery.IServiceProperties)2 ServiceTypeID (org.eclipse.ecf.discovery.identity.ServiceTypeID)2 ServicePropertiesAdapter (org.eclipse.ecf.internal.provider.jslp.ServicePropertiesAdapter)2 ServiceURLAdapter (org.eclipse.ecf.internal.provider.jslp.ServiceURLAdapter)2 JSLPServiceInfo (org.eclipse.ecf.provider.jslp.container.JSLPServiceInfo)2 PTRRecord (org.xbill.DNS.PTRRecord)2