Package org.apache.geronimo.system.configuration.condition

Examples of org.apache.geronimo.system.configuration.condition.JexlExpressionParser


        AttributeType attributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
        assertNull(attributeType.getPropertyEditor());
    }
   
    public void testPropertyEditorIsNotDefinedForCollectionSubClasses() throws Exception {
        GBeanOverride override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setAttribute(collectionInfo, Collections.singleton("test"), classLoader);
       
        GbeanType copiedGBeanType = override.writeXml();
        assertEquals(1, copiedGBeanType.getAttributeOrReference().size());
        AttributeType attributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
View Full Code Here


    }
   
    public void testReferences() throws Exception {
        GBeanOverride override;
       
        override = new GBeanOverride(gbeanType, new JexlExpressionParser());       
        override.setClearReference("foo");
        override.setReferencePatterns("foo", new ReferencePatterns(new AbstractName(new URI("/foo/bar/car?foo=bar"))));
        override.writeXml();
       
        assertFalse(override.isClearReference("foo"));
        assertFalse(override.getClearReferences().contains("foo"));       
        assertTrue(override.getReferencePatterns("foo") != null);
        assertTrue(override.getReferences().containsKey("foo"));
       
        override = new GBeanOverride(gbeanType, new JexlExpressionParser());  
        override.setReferencePatterns("foo", new ReferencePatterns(new AbstractName(new URI("/foo/bar/car?foo=bar"))));       
        override.setClearReference("foo");
        override.writeXml();
       
        assertTrue(override.isClearReference("foo"));
View Full Code Here

    }
   
    public void testAttributes() throws Exception {
        GBeanOverride override;
       
        override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setNullAttribute("foo");
        override.setClearAttribute("foo");
        override.setAttribute(fooInfo, "bar", classLoader);
        override.writeXml();
       
        assertFalse(override.isNullAttribute("foo"));
        assertFalse(override.getNullAttributes().contains("foo"));   
        assertFalse(override.isClearAttribute("foo"));
        assertFalse(override.getClearAttributes().contains("foo"))
        assertTrue(override.getAttribute("foo") != null);
        assertTrue(override.getAttributes().containsKey("foo"));
           
        override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setAttribute(fooInfo, "bar", classLoader);
        override.setNullAttribute("foo");
        override.setClearAttribute("foo");
        override.writeXml();
       
        assertFalse(override.isNullAttribute("foo"));
        assertFalse(override.getNullAttributes().contains("foo"));   
        assertFalse(override.getAttribute("foo") != null);
        assertFalse(override.getAttributes().containsKey("foo"));       
        assertTrue(override.isClearAttribute("foo"));
        assertTrue(override.getClearAttributes().contains("foo"))
       
        override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setClearAttribute("foo");
        override.setAttribute(fooInfo, "bar", classLoader);
        override.setNullAttribute("foo");
        override.writeXml();
           
        assertFalse(override.getAttribute("foo") != null);
        assertFalse(override.getAttributes().containsKey("foo"));       
        assertFalse(override.isClearAttribute("foo"));
        assertFalse(override.getClearAttributes().contains("foo"));        
        assertTrue(override.isNullAttribute("foo"));
        assertTrue(override.getNullAttributes().contains("foo"));
       
        override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setAttribute(gbeanInfo.getAttribute("bar1"), "foo", classLoader);
        override.setAttribute(gbeanInfo.getAttribute("bar2"), "foo", classLoader);
        override.getAttributes().put("foo", null);
        GbeanType gbean = override.writeXml();
        assertEquals(3, gbean.getAttributeOrReference().size());
View Full Code Here

        HashMap<String, String> subs = new HashMap<String, String>();
        subs.put("host", "localhost");
        subs.put("port", "8080");
        subs.put("portOffset", "1");
        ParserUtils.addDefaultVariables(subs);
        expressionParser = new JexlExpressionParser(subs);
    }
View Full Code Here

                    "    <ns2:module name=\"org.apache.geronimo.plugins/plancreator-jetty/2.1-SNAPSHOT/car\"/>\n" +
                    "</ns2:attributes>\n";
   
    public void testReadWrite() throws Exception {
        Reader reader = new StringReader(CONFIG);
        JexlExpressionParser parser = new JexlExpressionParser();
        ServerOverride serverOverride = LocalAttributeManager.read(reader, parser);
        StringWriter writer = new StringWriter();
        LocalAttributeManager.write(serverOverride, writer);
        String result = writer.toString();
       
View Full Code Here

    public void testCopyConfig() throws Exception {
        InputStream in = new ByteArrayInputStream(CONFIG.getBytes());
        PluginType pluginType = PluginXmlUtil.loadPluginMetadata(in);
        List<GbeanType> gbeans = pluginType.getPluginArtifact().get(0).getConfigXmlContent().get(0).getGbean();
        assertEquals(2, gbeans.size());
        GBeanOverride override = new GBeanOverride(gbeans.get(0), new JexlExpressionParser());
        String attributeValue = override.getAttribute("defaultEnvironment");
       
        Document expectedDoc = DOMUtils.load(ATTRIBUTE_VALUE);
        Document actualDoc = DOMUtils.load(attributeValue);
       
View Full Code Here

        gbeanType.getAttributeOrReference().add(attributeType);
        attributeType.setName(attributeName);
        attributeType.getContent().add("value");
        attributeType.setPropertyEditor("myPropertyEditor");
       
        GBeanOverride override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        GbeanType copiedGBeanType = override.writeXml();
        assertEquals(1, copiedGBeanType.getAttributeOrReference().size());
        AttributeType copiedAttributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
        assertEquals(attributeType.getPropertyEditor(), copiedAttributeType.getPropertyEditor());
    }
View Full Code Here

        AttributeType copiedAttributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
        assertEquals(attributeType.getPropertyEditor(), copiedAttributeType.getPropertyEditor());
    }
   
    public void testPropertyEditorIsUsedToGetTextValue() throws Exception {
        GBeanOverride override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setAttribute(attributeName, new Bean(), Bean.class.getName(), getClass().getClassLoader());
       
        assertEquals("bean", override.getAttribute(attributeName));
       
        GbeanType copiedGBeanType = override.writeXml();
View Full Code Here

        AttributeType attributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
        assertEquals("bean", attributeType.getContent().get(0));
    }
   
    public void testPropertyEditorIsDefinedWhenAttributeIsNotAPrimitiveAndItsTypeDoesNotEqualValueType() throws Exception {
        GBeanOverride override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setAttribute(attributeName, new Bean(), Service.class.getName(), getClass().getClassLoader());
       
        GbeanType copiedGBeanType = override.writeXml();
        assertEquals(1, copiedGBeanType.getAttributeOrReference().size());
        AttributeType attributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
View Full Code Here

        AttributeType attributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
        assertEquals(BeanEditor.class.getName(), attributeType.getPropertyEditor());
    }
   
    public void testPropertyEditorIsNotDefinedWhenAttributeTypeEqualsValueType() throws Exception {
        GBeanOverride override = new GBeanOverride(gbeanType, new JexlExpressionParser());
        override.setAttribute(attributeName, new Bean(), Bean.class.getName(), getClass().getClassLoader());
       
        GbeanType copiedGBeanType = override.writeXml();
        assertEquals(1, copiedGBeanType.getAttributeOrReference().size());
        AttributeType attributeType = (AttributeType) copiedGBeanType.getAttributeOrReference().get(0);
View Full Code Here

TOP

Related Classes of org.apache.geronimo.system.configuration.condition.JexlExpressionParser

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.