Package org.rhq.plugins.modcluster.model

Examples of org.rhq.plugins.modcluster.model.ProxyInfo


    public void testProxyInfo() throws Exception {
        String[] availableFiles = new String[] { "/proxy_config/proxy_config_1.txt", "/proxy_config/proxy_config_2.txt" };

        for (String testConfigurationFile : availableFiles) {
            String testConfiguration = readConfigFile(testConfigurationFile);
            ProxyInfo proxyInfo = new ProxyInfo(testConfiguration);

            for (ProxyInfo.Context context : proxyInfo.getAvailableContexts()) {
                assert (proxyInfo.getAvailableContexts().indexOf(context) != -1) : "Equals and hash functions not implemented correctly for "
                    + ProxyInfo.Context.class.getCanonicalName();

                assert (context.equals(ProxyInfo.Context.fromString(context.toString())) == true) : "fromString and toString are not equivalent for:"
                    + ProxyInfo.Context.class.getCanonicalName();
            }

            assert (proxyInfo.getAvailableContexts().size() != 0) : "Raw proxy info parsing failed to parse application contexts!";
            assert (proxyInfo.getAvailableVhosts().size() != 0) : "Raw proxy info parsing failed to parse vhosts!";
        }
    }
View Full Code Here


    @Test
    public void testProxyInfoWithEmptyConfig() throws IOException {
        String testConfigurationFile = "/proxy_config/proxy_config_empty.txt";
        String testConfiguration = readConfigFile(testConfigurationFile);
        ProxyInfo proxyInfo = new ProxyInfo(testConfiguration);

        assert (proxyInfo.getAvailableContexts().size() == 0) : "Raw proxy info parsing failed to parse an empty proxy config.";
        assert (proxyInfo.getAvailableVhosts().size() == 0) : "Raw proxy info parsing failed to parse an empty proxy config.";
    }
View Full Code Here

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(getEmsBean().getClass().getClassLoader());
            String rawProxyInfo = JBossHelper.getRawProxyInfo(getEmsBean());

            ProxyInfo proxyInfo = new ProxyInfo(rawProxyInfo);

            ProxyInfo.Context context = ProxyInfo.Context.fromString(resourceContext.getResourceKey());

            int indexOfCurrentContext = proxyInfo.getAvailableContexts().indexOf(context);

            if (indexOfCurrentContext != -1) {
                ProxyInfo.Context currentContext = proxyInfo.getAvailableContexts().get(indexOfCurrentContext);

                if (currentContext.isEnabled()) {
                    return AvailabilityType.UP;
                }
            }
View Full Code Here

        String jvmRoute = this.getJvmRoute(context);

        EmsBean configBean = context.getParentResourceComponent().getEmsBean();
        String rawProxyInfo = JBossHelper.getRawProxyInfo(configBean);

        ProxyInfo proxyInfo = new ProxyInfo(rawProxyInfo);
        Set<DiscoveredResourceDetails> entities = new HashSet<DiscoveredResourceDetails>();

        for (ProxyInfo.Context availableContext : proxyInfo.getAvailableContexts()) {
            if (availableContext.getJvmRoute().equals(jvmRoute)) {
                DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(),
                    availableContext.createKey(), availableContext.createName(), null, "Webapp Context", null, null);
                entities.add(detail);
            }
View Full Code Here

        if (rawProxyInfo == null) {
            return AvailabilityType.DOWN;
        }

        ProxyInfo proxyInfo = new ProxyInfo(rawProxyInfo);
        if (proxyInfo.getAvailableNodes().size() == 0) {
            return AvailabilityType.DOWN;
        }

        return super.getAvailability();
    }
View Full Code Here

TOP

Related Classes of org.rhq.plugins.modcluster.model.ProxyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.