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);
}
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);
}
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);
}
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());
}
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()));
}
Aggregations