use of com.reprezen.kaizen.oasparser.model3.Server 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 com.reprezen.kaizen.oasparser.model3.Server 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 com.reprezen.kaizen.oasparser.model3.Server in project webtools.servertools by eclipse.
the class XmlTestCase method testServerInstance3.
/**
* Test behavior of ServerInstance
*/
public void testServerInstance3() {
Server server = getXml40Server("serverxml.test3");
assertNotNull(server);
ServerInstance si = new ServerInstance(server, "Service", null);
Context context = si.getContext("/WebApp1");
assertNotNull(context);
assertEquals(new Path("/Base/relative/host/WebApp1"), si.getContextWorkDirectory(new Path("/Base"), context));
context = si.getContext("WebApp2");
assertNotNull(context);
assertEquals(new Path("/Base/relative/workdir"), si.getContextWorkDirectory(new Path("/Base"), context));
context = si.getContext("WebApp3");
assertNotNull(context);
assertEquals(new Path("/absolute/workdir"), si.getContextWorkDirectory(new Path("/Base"), context));
}
use of com.reprezen.kaizen.oasparser.model3.Server 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 com.reprezen.kaizen.oasparser.model3.Server in project lighty-netconf-simulator by PANTHEONtech.
the class ResetActionProcessor method execute.
@SuppressWarnings({ "rawtypes", "unchecked", "checkstyle:IllegalCatch" })
@Override
protected CompletableFuture<Response> execute(final Element requestXmlElement) {
final XmlNodeConverter xmlNodeConverter = getNetconfDeviceServices().getXmlNodeConverter();
try {
final XmlElement xmlElement = XmlElement.fromDomElement(requestXmlElement);
final Element actionElement = findInputElement(xmlElement, this.definition.getQName());
final Reader readerFromElement = RPCUtil.createReaderFromElement(actionElement);
final Absolute actionInput = getActionInput(this.path, this.definition);
final ContainerNode deserializedNode = (ContainerNode) xmlNodeConverter.deserialize(actionInput, readerFromElement);
final Input input = this.adapterSerializer.fromNormalizedNodeActionInput(Reset.class, deserializedNode);
final String key = findNameElement(xmlElement);
Preconditions.checkNotNull(key);
final Class listItem = Server.class;
final Identifier listKey = new ServerKey(key);
final InstanceIdentifier instanceIdentifier = InstanceIdentifier.builder(listItem, listKey).build();
Preconditions.checkArgument(instanceIdentifier instanceof KeyedInstanceIdentifier);
final KeyedInstanceIdentifier<Server, ServerKey> keydIID = (KeyedInstanceIdentifier<Server, ServerKey>) instanceIdentifier;
final ListenableFuture<RpcResult<Output>> outputFuture = this.resetAction.invoke(keydIID, input);
final CompletableFuture<Response> completableFuture = new CompletableFuture<>();
Futures.addCallback(outputFuture, new FutureCallback<RpcResult<Output>>() {
@Override
public void onSuccess(final RpcResult<Output> result) {
final NormalizedNode domOutput = ResetActionProcessor.this.adapterSerializer.toNormalizedNodeActionOutput(Reset.class, result.getResult());
final List<NormalizedNode> list = new ArrayList<>();
list.add(domOutput);
completableFuture.complete(new ResponseData(list));
}
@Override
public void onFailure(final Throwable throwable) {
}
}, Executors.newSingleThreadExecutor());
return completableFuture;
} catch (final TransformerException | DocumentedException | DeserializationException e) {
throw new RuntimeException(e);
}
}
Aggregations