Search in sources :

Example 16 with HostAndPort

use of com.sun.enterprise.util.HostAndPort in project Payara by payara.

the class MiniXmlParserTest method findTwoAdminPorts.

/*
     * Exercise the parsing of asadmin virtual server, network-listener and port numbers
     * this one tests for TWO listeners
     */
@Test
public void findTwoAdminPorts() {
    try {
        MiniXmlParser instance = new MiniXmlParser(adminport2, "server");
        List<HostAndPort> addrs = instance.getAdminAddresses();
        assertEquals(2, addrs.size());
        boolean saw3333 = false, saw4444 = false, sawSecure = false;
        for (HostAndPort addr : addrs) {
            if (addr.getPort() == 3333)
                saw3333 = true;
            if (addr.getPort() == 4444) {
                saw4444 = true;
                if (addr.isSecure())
                    sawSecure = true;
            }
        }
        assertTrue("Saw port 3333", saw3333);
        assertTrue("Saw port 4444", saw4444);
        assertTrue("Saw port 4444 security-enabled", sawSecure);
    } catch (MiniXmlParserException ex) {
        Logger.getLogger(MiniXmlParserTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : HostAndPort(com.sun.enterprise.util.HostAndPort) Test(org.junit.Test)

Aggregations

HostAndPort (com.sun.enterprise.util.HostAndPort)16 CommandException (org.glassfish.api.admin.CommandException)4 MiniXmlParser (com.sun.enterprise.universal.xml.MiniXmlParser)3 MiniXmlParserException (com.sun.enterprise.universal.xml.MiniXmlParserException)3 File (java.io.File)3 Test (org.junit.Test)3 Config (com.sun.enterprise.config.serverbeans.Config)2 VirtualServer (com.sun.enterprise.config.serverbeans.VirtualServer)2 IOException (java.io.IOException)2 RestEndpoint (org.glassfish.api.admin.RestEndpoint)2 NetworkListener (org.glassfish.grizzly.config.dom.NetworkListener)2 Protocol (org.glassfish.grizzly.config.dom.Protocol)2 GFLauncherException (com.sun.enterprise.admin.launcher.GFLauncherException)1 DomainConfig (com.sun.enterprise.admin.servermgmt.DomainConfig)1 PEDomainsManager (com.sun.enterprise.admin.servermgmt.pe.PEDomainsManager)1 ApplicationRef (com.sun.enterprise.config.serverbeans.ApplicationRef)1 HttpService (com.sun.enterprise.config.serverbeans.HttpService)1 SmartFile (com.sun.enterprise.universal.io.SmartFile)1 ProcessStreamDrainer (com.sun.enterprise.universal.process.ProcessStreamDrainer)1 MalformedURLException (java.net.MalformedURLException)1