}
@Test(timeout = BLOCK)
public void testReplaceService() {
if (mutable()) {
IService service1 = new IService(){
public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor )
throws IOException {
return null;
}
public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
throws IOException {
return null;
}
public Map<String, Serializable> getConnectionParams() {
return null;
}
public <T> boolean canResolve( Class<T> adaptee ) {
return false;
}
protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
return null;
}
public Status getStatus() {
return null;
}
public Throwable getMessage() {
return null;
}
public URL getIdentifier() {
try {
return new URL("http://localhost/udig-tests/1"); //$NON-NLS-1$
} catch (MalformedURLException e) {
fail(e.toString());
return null;
}
}
};
IService service2 = new IService(){
public <T> T resolve( Class<T> adaptee, IProgressMonitor monitor )
throws IOException {
return null;
}
public List< ? extends IGeoResource> resources( IProgressMonitor monitor )
throws IOException {
return null;
}
public Map<String, Serializable> getConnectionParams() {
return null;
}
protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
return null;
}
public <T> boolean canResolve( Class<T> adaptee ) {
return false;
}
public Status getStatus() {
return null;
}
public Throwable getMessage() {
return null;
}
public URL getIdentifier() {
try {
return new URL("http://localhost/udig-tests/2"); //$NON-NLS-1$
} catch (MalformedURLException e) {
fail(e.toString());
return null;
}
}
};
getResolve().add(service1);
getResolve().replace(service1.getID(), service2);
List<IResolve> services = getResolve().find(service2.getIdentifier(), null);
assertFalse("Shouldn't contain the service", services.contains(service1)); //$NON-NLS-1$
assertTrue("Should contain the service", services.contains(service2)); //$NON-NLS-1$
}
}