Package org.cafesip.jiplet.jmxbeans

Examples of org.cafesip.jiplet.jmxbeans.ContextElement


                JipletLogger.debug("Context: " + name + " was not found");
            }
            return null;
        }

        ContextElement element = new ContextElement();
        ArrayList criteria = context.getContextSelectionCriteria();
        ArrayList scriteria = new ArrayList(criteria.size());

        for (int i = 0; i < criteria.size(); i++)
        {
            Pair p = (Pair) criteria.get(i);
            String connector = (String) p.getFirst();
            String exp = (String) p.getSecond();
            scriteria.add(connector + ":" + exp);
        }
        element.setSelectionCriteria(scriteria);
        element.setName(name);
        element.setDisplayName(context.getDisplayName());
        element.setPath(context.getContextRoot().getAbsolutePath());
        element.setTypeDescription(context.getContextTypeDescription());
        return element;
    }
View Full Code Here


            }

            Object[] args = new Object[] { name };
            String[] sig = new String[] { "java.lang.String" };

            ContextElement context = (ContextElement) server.invoke(
                    new ObjectName("org.cafesip.jiplet:type=JipletContainer"),
                    "getContextProperty", args, sig);
            if (context == null)
            {
                throw new Exception("Context '" + name + "' not found");
View Full Code Here

    }

    public org.cafesip.jiplet.console.client.rpc.ContextElement viewContextProperty(
            String name) throws Exception
    {
        ContextElement src = getContextProperty(name);

        org.cafesip.jiplet.console.client.rpc.ContextElement dest = new org.cafesip.jiplet.console.client.rpc.ContextElement();

        dest.setDisplayName(src.getDisplayName());
        dest.setName(src.getName());
        dest.setPath(src.getPath());
        dest.setSelectionCriteriaStringList(src.getSelectionCriteria());
        dest.setTypeDescription(src.getTypeDescription());

        dest
                .setJiplets(new org.cafesip.jiplet.console.client.rpc.JipletElement[0]);

        org.cafesip.jiplet.console.client.rpc.JipletElement[] jiplets = listJipletsProperties(name);
View Full Code Here

                contexts.length);
        assertEquals("Context name does not match", "deploy", contexts[0]);

        // Test: Get the property of the deployed context. Check that the
        // properties match.
        ContextElement element = null;
        try
        {
            element = container.getContextProperty("deploy");
        }
        catch (Exception e)
        {
            fail("Error getting context property");
        }
        assertNotNull(element);
        assertEquals("getContextProperty returned invalid name", "deploy",
                element.getName());
        File f = new File(deploy_dir, "deploy");
        assertEquals("getContextProperty returned invalid path", f.toURL()
                .toString(), (new File(element.getPath())).toURL().toString());
        assertEquals("getDisplayName returned unexpected name",
                "Example TEST Context", element.getDisplayName());
        assertEquals("getTypeDescription returned invalid deployment type",
                "Deployed", element.getTypeDescription());
        ArrayList criteria = element.getSelectionCriteria();
        assertNotNull("The selection criteria for the context does not exist",
                criteria);
        assertEquals("The number of selection criteria do not match", 1,
                criteria.size());
        String criterion = (String) criteria.get(0);
        assertEquals("The criterion does not match",
                "sip-connector:(request.uri subdomain-of \"quik-j.com\")",
                criterion);

        // Test: Get the property of a context that is not deployed.
        try
        {
            element = container.getContextProperty("test-context-1");
            fail("Got properties of nonexistent context");
        }
        catch (Exception e)
        {
        }

        // Test: Delete the context created above. Check that the delete
        // operation is successful.
        try
        {
            container.deleteContext("deploy");
        }
        catch (Exception e)
        {
            fail("The context could not be deleted: " + e.getMessage());
        }

        // Test: Delete a context that has not been created. Check that the
        // delete operation fails.
        try
        {
            container.deleteContext("test-context-2");
            fail("The bogus context was deleted successfully");
        }
        catch (Exception e)
        {
        }

        // Test: Start the example spr application . Check that it is started.
        try
        {
            container.createContext(exampleAppSpr, "my-renamed-context", null);
        }
        catch (Exception e)
        {
            fail("The context could not be added");
        }

        // Test: Get a list of deployed context. Check that the list contains
        // one element
        contexts = container.listContexts();
        assertNotNull("listContexts() returned a null object", contexts);
        assertEquals("listContexts() returned a empty string", 1,
                contexts.length);
        assertEquals("Context name does not match", "my-renamed-context",
                contexts[0]);

        // Test: Get the property of the deployed context. Check that the
        // properties match.
        try
        {
            element = container.getContextProperty("my-renamed-context");
        }
        catch (Exception e)
        {
            fail("Error getting context property");
        }
        assertNotNull(element);
        assertEquals("getContextProperty returned invalid name",
                "my-renamed-context", element.getName());
        f = new File(deploy_dir, "my-renamed-context");
        assertEquals("getContextProperty returned invalid path", f.toURL()
                .toString(), (new File(element.getPath())).toURL().toString());

        // Test: Delete the context created above. Check that the delete
        // operation is successful.
        try
        {
View Full Code Here

TOP

Related Classes of org.cafesip.jiplet.jmxbeans.ContextElement

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.