Lines 21-27
Link Here
|
21 |
import org.eclipse.ecf.core.IContainer; |
21 |
import org.eclipse.ecf.core.IContainer; |
22 |
import org.eclipse.ecf.core.identity.IDFactory; |
22 |
import org.eclipse.ecf.core.identity.IDFactory; |
23 |
import org.eclipse.ecf.core.identity.Namespace; |
23 |
import org.eclipse.ecf.core.identity.Namespace; |
24 |
import org.eclipse.ecf.core.util.ECFException; |
24 |
import org.eclipse.ecf.core.util.CanceledException; |
|
|
25 |
import org.eclipse.ecf.core.util.IFutureStatus; |
25 |
import org.eclipse.ecf.discovery.IDiscoveryContainerAdapter; |
26 |
import org.eclipse.ecf.discovery.IDiscoveryContainerAdapter; |
26 |
import org.eclipse.ecf.discovery.IServiceEvent; |
27 |
import org.eclipse.ecf.discovery.IServiceEvent; |
27 |
import org.eclipse.ecf.discovery.IServiceInfo; |
28 |
import org.eclipse.ecf.discovery.IServiceInfo; |
Lines 162-178
Link Here
|
162 |
|
163 |
|
163 |
protected void registerService() { |
164 |
protected void registerService() { |
164 |
try { |
165 |
try { |
165 |
discoveryContainer.registerService(serviceInfo); |
166 |
IFutureStatus futureStatus = discoveryContainer.registerService(serviceInfo); |
166 |
} catch (final ECFException e) { |
167 |
assertNotNull(futureStatus.getMessage(), futureStatus.get()); |
|
|
168 |
} catch (CanceledException e) { |
169 |
fail("IServiceInfo may be valid with this IDCA"); |
170 |
} catch (InterruptedException e) { |
167 |
fail("IServiceInfo may be valid with this IDCA"); |
171 |
fail("IServiceInfo may be valid with this IDCA"); |
168 |
} |
172 |
} |
169 |
} |
173 |
} |
170 |
|
174 |
|
171 |
protected void unregisterService() { |
175 |
protected void unregisterService() { |
172 |
try { |
176 |
try { |
173 |
discoveryContainer.unregisterService(serviceInfo); |
177 |
IFutureStatus futureStatus = discoveryContainer.unregisterService(serviceInfo); |
174 |
} catch (final ECFException e) { |
178 |
assertNotNull(futureStatus.getMessage(), futureStatus.get()); |
175 |
fail("unregistering of " + serviceInfo + " should just work"); |
179 |
} catch (CanceledException e) { |
|
|
180 |
fail("IServiceInfo may be valid with this IDCA"); |
181 |
} catch (InterruptedException e) { |
182 |
fail("IServiceInfo may be valid with this IDCA"); |
176 |
} |
183 |
} |
177 |
} |
184 |
} |
178 |
|
185 |
|
Lines 302-314
Link Here
|
302 |
public void testRegisterServiceWithNull() { |
309 |
public void testRegisterServiceWithNull() { |
303 |
testConnect(); |
310 |
testConnect(); |
304 |
try { |
311 |
try { |
305 |
discoveryContainer.registerService(null); |
312 |
IFutureStatus futureStatus = discoveryContainer.registerService(null); |
306 |
} catch (final ECFException e) { |
313 |
assertNotNull(futureStatus.getMessage(), futureStatus.get()); |
307 |
fail("null must cause AssertionFailedException"); |
314 |
assertTrue(futureStatus.getException() instanceof AssertionFailedException); |
308 |
} catch (final AssertionFailedException e) { |
315 |
} catch (CanceledException e) { |
309 |
return; |
316 |
fail("IServiceInfo may be valid with this IDCA"); |
|
|
317 |
} catch (InterruptedException e) { |
318 |
fail("IServiceInfo may be valid with this IDCA"); |
310 |
} |
319 |
} |
311 |
fail("null must cause AssertionFailedException"); |
|
|
312 |
} |
320 |
} |
313 |
|
321 |
|
314 |
/** |
322 |
/** |
Lines 334-346
Link Here
|
334 |
public void testUnregisterServiceWithNull() { |
342 |
public void testUnregisterServiceWithNull() { |
335 |
testConnect(); |
343 |
testConnect(); |
336 |
try { |
344 |
try { |
337 |
discoveryContainer.unregisterService(null); |
345 |
IFutureStatus futureStatus = discoveryContainer.unregisterService(null); |
338 |
} catch (final ECFException e) { |
346 |
assertNotNull(futureStatus.getMessage(), futureStatus.get()); |
339 |
fail("null must cause AssertionFailedException"); |
347 |
assertTrue(futureStatus.getException() instanceof AssertionFailedException); |
340 |
} catch (final AssertionFailedException e) { |
348 |
} catch (CanceledException e) { |
341 |
return; |
349 |
fail("IServiceInfo may be valid with this IDCA"); |
|
|
350 |
} catch (InterruptedException e) { |
351 |
fail("IServiceInfo may be valid with this IDCA"); |
342 |
} |
352 |
} |
343 |
fail("null must cause AssertionFailedException"); |
|
|
344 |
} |
353 |
} |
345 |
|
354 |
|
346 |
public void testDispose() { |
355 |
public void testDispose() { |