Search in sources :

Example 1 with Listener

use of io.envoyproxy.envoy.config.listener.v3.Listener 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());
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Listener(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener) Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) Host(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host) Engine(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)

Example 2 with Listener

use of io.envoyproxy.envoy.config.listener.v3.Listener 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());
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Listener(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener) Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) Host(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host) Engine(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)

Example 3 with Listener

use of io.envoyproxy.envoy.config.listener.v3.Listener 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());
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Listener(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener) Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) Host(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host) Engine(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)

Example 4 with Listener

use of io.envoyproxy.envoy.config.listener.v3.Listener 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);
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Listener(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener) Server(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) Host(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host) ServerInstance(org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance) Engine(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)

Example 5 with Listener

use of io.envoyproxy.envoy.config.listener.v3.Listener in project org.alloytools.alloy by AlloyTools.

the class VizCustomizationPanel method remakeAll.

// =============================================================================================================//
/**
 * Regenerate all the customization widgets based on the latest settings.
 */
public void remakeAll() {
    // Make the tree
    final OurTree tree = new OurTree(12) {

        private static final long serialVersionUID = 0;

        private final AlloyModel old = vizState.getOriginalModel(), now = vizState.getCurrentModel();

        private final boolean hidePrivate = vizState.hidePrivate(), hideMeta = vizState.hideMeta();

        {
            do_start();
            setRootVisible(false);
            setShowsRootHandles(false);
            listeners.add(new Listener() {

                @Override
                public Object do_action(Object sender, Event event) {
                    return null;
                }

                @Override
                public Object do_action(Object sender, Event event, Object arg) {
                    zoom(arg);
                    return null;
                }
            });
        }

        @Override
        public String convertValueToText(Object value, boolean sel, boolean expand, boolean leaf, int i, boolean focus) {
            if (value == GENERAL)
                return "<html><b>general graph settings</b></html>";
            if (value == NODES)
                return "<html><b>types and sets</b></html>";
            if (value == EDGES)
                return "<html><b>relations</b></html>";
            if (value instanceof AlloyType) {
                AlloyType x = (AlloyType) value;
                if (vizState.getCurrentModel().hasType(x))
                    return "<html><b>sig</b> " + typename(x) + "</html>";
                return "<html><b>sig</b> " + typename(x) + " <font color=\"#808080\">(projected)</font></html>";
            }
            if (value instanceof AlloySet)
                return "<html><b>set</b> " + ((AlloySet) value).getName() + "</html>";
            if (value instanceof AlloyRelation)
                return value.toString();
            else
                return "";
        }

        @Override
        public List<?> do_ask(Object parent) {
            ArrayList<Object> ans = new ArrayList<Object>();
            if (parent == ROOT) {
                ans.add(GENERAL);
                ans.add(NODES);
                ans.add(EDGES);
            } else if (parent == NODES) {
                ans.add(AlloyType.UNIV);
            } else if (parent == EDGES) {
                for (AlloyRelation rel : vizState.getCurrentModel().getRelations()) if (!(hidePrivate && rel.isPrivate) && !(hideMeta && rel.isMeta))
                    ans.add(rel);
            } else if (parent instanceof AlloyType) {
                AlloyType type = (AlloyType) parent;
                for (AlloySet s : now.getSets()) if (!(hidePrivate && s.isPrivate) && !(hideMeta && s.isMeta) && s.getType().equals(type))
                    ans.add(s);
                if (!type.isEnum)
                    for (AlloyType t : old.getDirectSubTypes(type)) if (!(hidePrivate && t.isPrivate) && !(hideMeta && t.isMeta))
                        if (now.hasType(t) || vizState.canProject(t))
                            ans.add(t);
            }
            return ans;
        }

        @Override
        public boolean do_isDouble(Object object) {
            return object == NODES || object == EDGES;
        }

        @Override
        public Object do_root() {
            return ROOT;
        }
    };
    // Pre-expand the entire tree.
    TreePath last = null;
    for (int i = 0; i < tree.getRowCount(); i++) {
        tree.expandRow(i);
        if (lastElement != null && last == null) {
            last = tree.getPathForRow(i);
            if (lastElement != last.getLastPathComponent())
                last = null;
        }
    }
    // Show the current element if found, else show the GENERAL OPTIONS
    if (last != null) {
        zoom(lastElement);
    } else {
        last = tree.getPathForRow(0);
        zoom(GENERAL);
    }
    tree.scrollPathToVisible(last);
    tree.setSelectionPath(last);
    JScrollPane scroll = OurUtil.scrollpane(tree, Color.BLACK, Color.WHITE, new OurBorder(false, false, false, Util.onMac()));
    scroll.setAlignmentX(0f);
    scroll.getVerticalScrollBar().setUnitIncrement(50);
    removeAll();
    add(zoomPane);
    add(scroll);
    validate();
}
Also used : JScrollPane(javax.swing.JScrollPane) ActionListener(java.awt.event.ActionListener) ChangeListener(javax.swing.event.ChangeListener) Listener(edu.mit.csail.sdg.alloy4.Listener) OurBorder(edu.mit.csail.sdg.alloy4.OurBorder) ArrayList(java.util.ArrayList) OurTree(edu.mit.csail.sdg.alloy4.OurTree) TreePath(javax.swing.tree.TreePath) ChangeEvent(javax.swing.event.ChangeEvent) KeyEvent(java.awt.event.KeyEvent) ActionEvent(java.awt.event.ActionEvent) MouseEvent(java.awt.event.MouseEvent) FocusEvent(java.awt.event.FocusEvent)

Aggregations

Listener (io.envoyproxy.envoy.config.listener.v3.Listener)9 Test (org.junit.Test)7 HttpFilter (io.envoyproxy.envoy.extensions.filters.network.http_connection_manager.v3.HttpFilter)5 Filter (io.envoyproxy.envoy.config.listener.v3.Filter)4 FilterChain (io.envoyproxy.envoy.config.listener.v3.FilterChain)4 FilterChainMatch (io.envoyproxy.envoy.config.listener.v3.FilterChainMatch)4 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)4 Engine (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)4 Host (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host)4 Listener (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener)4 Server (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server)4 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)4 ListenerFilter (io.envoyproxy.envoy.config.listener.v3.ListenerFilter)3 ApiListener (io.envoyproxy.envoy.config.listener.v3.ApiListener)2 ArrayList (java.util.ArrayList)2 Any (com.google.protobuf.Any)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Listener (edu.mit.csail.sdg.alloy4.Listener)1 OurBorder (edu.mit.csail.sdg.alloy4.OurBorder)1 OurTree (edu.mit.csail.sdg.alloy4.OurTree)1