blob: c7d80866284d38069ddd312aba4c0d7f0be05837 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*******************************************************************************
* Copyright (c) 2007 Versant Corp.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Markus Kuppe (mkuppe <at> versant <dot> com) - initial API and implementation
******************************************************************************/
package org.eclipse.ecf.tests.provider.jslp.identity;
import java.util.Arrays;
import org.eclipse.ecf.discovery.identity.IServiceID;
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
import org.eclipse.ecf.provider.jslp.identity.JSLPNamespace;
import org.eclipse.ecf.tests.discovery.identity.ServiceIDTest;
public class JSLPServiceIDTest extends ServiceIDTest {
private static final String IANA = "iana";
public JSLPServiceIDTest() {
super(JSLPNamespace.NAME);
}
/* (non-Javadoc)
* @see org.eclipse.ecf.tests.discovery.identity.ServiceIDTest#testCreateServiceTypeIDFromInternalString()
*/
public void testCreateServiceTypeIDFromInternalString() {
final String internalRep = "service:foo.eclipse:bar";
final IServiceID sid = (IServiceID) createIDFromString(internalRep);
final IServiceTypeID stid = sid.getServiceTypeID();
assertEquals(internalRep, stid.getInternal());
assertNotSame(internalRep, stid.getName());
assertEquals("eclipse", stid.getNamingAuthority());
assertTrue(Arrays.equals(new String[] {"service", "foo", "bar"}, stid.getServices()));
assertTrue(Arrays.equals(new String[] {"default"}, stid.getScopes()));
assertTrue(Arrays.equals(new String[] {"unknown"}, stid.getProtocols()));
}
/* (non-Javadoc)
* @see org.eclipse.ecf.tests.discovery.identity.ServiceIDTest#testCreateServiceTypeIDFromInternalString()
*/
public void testCreateServiceTypeIDFromInternalStringWithDefaultNamingAuthority() {
final String internalRep = "service:foo." + IANA + ":bar";
final IServiceID sid = (IServiceID) createIDFromString(internalRep);
final IServiceTypeID stid = sid.getServiceTypeID();
// the internalRep contains "iana" but getInternal may not!
final int indexOf = stid.getInternal().toLowerCase().indexOf(IANA.toLowerCase());
assertTrue(indexOf == -1);
assertEquals(IANA, stid.getNamingAuthority().toLowerCase());
assertNotSame(internalRep, stid.getName());
}
}
|