use of org.ovirt.engine.sdk4.Service in project webtools.servertools by eclipse.
the class XmlTestCase method testDefaultServerXml50.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 5.0 release (28).
*/
public void testDefaultServerXml50() {
Server server = getXml40Server("default.serverxml.50");
assertNotNull(server);
// Check contents of XML
String port = server.getPort();
assertEquals("8005", port);
assertEquals(server.getListenerCount(), 2);
Listener listener = server.getListener(0);
assertNotNull(listener);
assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listener.getClassName());
listener = server.getListener(1);
assertNotNull(listener);
assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listener.getClassName());
assertEquals(1, server.getServiceCount());
Service service = server.getService(0);
assertNotNull(service);
assertEquals("Catalina", service.getName());
assertEquals(2, service.getConnectorCount());
Connector connector = service.getConnector(0);
assertNotNull(connector);
assertEquals("8080", connector.getPort());
assertNull(connector.getProtocol());
connector = service.getConnector(1);
assertNotNull(connector);
assertEquals("8009", connector.getPort());
assertEquals("AJP/1.3", connector.getProtocol());
Engine engine = service.getEngine();
assertNotNull(engine);
assertEquals("Catalina", engine.getName());
assertEquals("localhost", engine.getDefaultHost());
assertEquals(engine.getHostCount(), 1);
Host host = engine.getHost(0);
assertNotNull(host);
assertEquals("localhost", host.getName());
assertEquals("webapps", host.getAppBase());
assertEquals("true", host.getAttributeValue("unpackWARs"));
assertEquals("true", host.getAttributeValue("autoDeploy"));
assertEquals(0, host.getContextCount());
}
use of org.ovirt.engine.sdk4.Service in project webtools.servertools by eclipse.
the class XmlTestCase method testDefaultServerXml55.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 5.5 release (20).
*/
public void testDefaultServerXml55() {
Server server = getXml40Server("default.serverxml.55");
assertNotNull(server);
// Check contents of XML
String port = server.getPort();
assertEquals("8005", port);
assertEquals(server.getListenerCount(), 4);
Listener listener = server.getListener(0);
assertNotNull(listener);
assertEquals("org.apache.catalina.core.AprLifecycleListener", listener.getClassName());
listener = server.getListener(1);
assertNotNull(listener);
assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listener.getClassName());
listener = server.getListener(2);
assertNotNull(listener);
assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listener.getClassName());
listener = server.getListener(3);
assertNotNull(listener);
assertEquals("org.apache.catalina.storeconfig.StoreConfigLifecycleListener", listener.getClassName());
assertEquals(server.getServiceCount(), 1);
Service service = server.getService(0);
assertNotNull(service);
assertEquals("Catalina", service.getName());
assertEquals(2, service.getConnectorCount());
Connector connector = service.getConnector(0);
assertNotNull(connector);
assertEquals("8080", connector.getPort());
assertNull(connector.getProtocol());
connector = service.getConnector(1);
assertNotNull(connector);
assertEquals("8009", connector.getPort());
assertEquals("AJP/1.3", connector.getProtocol());
Engine engine = service.getEngine();
assertNotNull(engine);
assertEquals("Catalina", engine.getName());
assertEquals("localhost", engine.getDefaultHost());
assertEquals(1, engine.getHostCount());
Host host = engine.getHost(0);
assertNotNull(host);
assertEquals("localhost", host.getName());
assertEquals("webapps", host.getAppBase());
assertEquals("true", host.getAttributeValue("unpackWARs"));
assertEquals("true", host.getAttributeValue("autoDeploy"));
assertEquals(0, host.getContextCount());
}
use of org.ovirt.engine.sdk4.Service in project webtools.servertools by eclipse.
the class XmlTestCase method testDefaultServerXml60.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 6.0 release.
*/
public void testDefaultServerXml60() {
Server server = getXml40Server("default.serverxml.60");
assertNotNull(server);
// Check contents of XML
String port = server.getPort();
assertEquals("8005", port);
assertEquals(4, server.getListenerCount());
Listener listener = server.getListener(0);
assertNotNull(listener);
assertEquals("org.apache.catalina.core.AprLifecycleListener", listener.getClassName());
listener = server.getListener(1);
assertNotNull(listener);
assertEquals("org.apache.catalina.core.JasperListener", listener.getClassName());
listener = server.getListener(2);
assertNotNull(listener);
assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listener.getClassName());
listener = server.getListener(3);
assertNotNull(listener);
assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listener.getClassName());
assertEquals(1, server.getServiceCount());
Service service = server.getService(0);
assertNotNull(service);
assertEquals("Catalina", service.getName());
assertEquals(2, service.getConnectorCount());
Connector connector = service.getConnector(0);
assertNotNull(connector);
assertEquals("8080", connector.getPort());
assertEquals("HTTP/1.1", connector.getProtocol());
connector = service.getConnector(1);
assertNotNull(connector);
assertEquals("8009", connector.getPort());
assertEquals("AJP/1.3", connector.getProtocol());
Engine engine = service.getEngine();
assertNotNull(engine);
assertEquals("Catalina", engine.getName());
assertEquals("localhost", engine.getDefaultHost());
assertEquals(1, engine.getHostCount());
Host host = engine.getHost(0);
assertNotNull(host);
assertEquals("localhost", host.getName());
assertEquals("webapps", host.getAppBase());
assertEquals("true", host.getAttributeValue("unpackWARs"));
assertEquals("true", host.getAttributeValue("autoDeploy"));
assertEquals(0, host.getContextCount());
}
use of org.ovirt.engine.sdk4.Service in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance50.
/**
* Test reading of the default server.xml provided by the
* current Tomcat 5.0 release using ServerInstance.
*/
public void testServerInstance50() {
Server server = getXml40Server("default.serverxml.50");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, null, null);
assertEquals(2, server.getListenerCount());
Listener[] listeners = si.getListeners();
assertEquals("org.apache.catalina.mbeans.ServerLifecycleListener", listeners[0].getClassName());
assertEquals("org.apache.catalina.mbeans.GlobalResourcesLifecycleListener", listeners[1].getClassName());
Service service = si.getService();
assertNotNull(service);
assertEquals("Catalina", service.getName());
assertEquals("8080", si.getConnector(0).getPort());
assertNull(si.getConnector(0).getProtocol());
assertEquals("8009", si.getConnector(1).getPort());
assertEquals("AJP/1.3", si.getConnector(1).getProtocol());
Connector[] connectors = si.getConnectors();
assertEquals(2, connectors.length);
assertEquals("8080", connectors[0].getPort());
assertNull(connectors[0].getProtocol());
assertEquals("8009", connectors[1].getPort());
assertEquals("AJP/1.3", connectors[1].getProtocol());
Engine engine = si.getEngine();
assertNotNull(engine);
assertEquals("Catalina", engine.getName());
assertEquals("localhost", engine.getDefaultHost());
Host host = si.getHost();
assertNotNull(host);
assertEquals("localhost", host.getName());
assertEquals("webapps", host.getAppBase());
assertEquals("true", host.getAttributeValue("unpackWARs"));
assertEquals("true", host.getAttributeValue("autoDeploy"));
Context[] contexts = si.getContexts();
assertEquals(0, contexts.length);
}
use of org.ovirt.engine.sdk4.Service in project ovirt-engine-sdk-java by oVirt.
the class UpdateDataCenter method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
// Get the reference to the data centers service:
DataCentersService dcsService = connection.systemService().dataCentersService();
// Retrieve the description of the data center:
DataCenter dc = dcsService.list().search("name=mydc").send().dataCenters().get(0);
// In order to update the data center we need a reference to the service that manages it, then we can call the
// "update" method passing the update:
DataCenterService dcService = dcsService.dataCenterService(dc.id());
dc = dcService.update().dataCenter(dataCenter().description("Updated description")).send().dataCenter();
// Print the description of the result of the update:
System.out.printf("%s: %s", dc.name(), dc.description());
// Close the connection to the server:
connection.close();
}
Aggregations