use of org.jboss.tools.openshift.cdk.server.core.internal.registry.CDKRegistryProvider in project jbosstools-openshift by jbosstools.
the class CDKRegistryTest method testRegistryURL.
@Test
public void testRegistryURL() throws Exception {
ConfigureDependentFrameworksListener configureListener = (ConfigureDependentFrameworksListener) CDKCoreActivator.getDefault().getConfigureDependentFrameworksListener();
configureListener.disable();
CredentialService.getCredentialModel().addDomain("redhat.com", "redhat.com", true);
CredentialService.getCredentialModel().addCredentials(CredentialService.getCredentialModel().getDomain("redhat.com"), "user", "password");
CDKOpenshiftUtility util = new CDKOpenshiftUtility();
createCDKFile("Basic", null, null);
IServer cdkServer = createServer("openshift33");
ServiceManagerEnvironment adb = createLoader(cdkServer);
IConnection con = util.createOpenshiftConnection(adb, ConnectionsRegistrySingleton.getInstance());
assertNotNull(con);
// Can't test the registry provider model bc it hides the internal details
CDKRegistryProvider prov = new CDKRegistryProvider() {
protected ServiceManagerEnvironment getServiceManagerEnvironment(IServer server) {
try {
return createLoader(server);
} catch (Exception e) {
fail(e.getMessage());
}
return null;
}
};
IStatus reg = prov.getRegistryURL(con);
assertNotNull(reg);
assertFalse(reg.isOK());
ControllableServerBehavior beh = (ControllableServerBehavior) cdkServer.loadAdapter(ControllableServerBehavior.class, new NullProgressMonitor());
beh.setServerStarted();
reg = prov.getRegistryURL(con);
assertNotNull(reg);
assertTrue(reg.isOK());
configureListener.enable();
beh.setServerStopped();
}
Aggregations