Package org.apache.felix.ipojo.metadata

Examples of org.apache.felix.ipojo.metadata.Element


    public void testVisitManipulationResult() throws Exception {
        ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter();
        writer.setReporter(reporter);
        writer.setResourceStore(store);

        Element component = new Element("component", null);
        assertNotNull(writer.visitManipulationResult(component));
        verify(store).writeMetadata(same(component));
    }
View Full Code Here


    public void testVisitMetadata() throws Exception {
        ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter();
        writer.setReporter(reporter);
        writer.setResourceStore(store);

        Element instance = new Element("instance", null);
        writer.visitMetadata(instance);
        verify(store).writeMetadata(same(instance));
    }
View Full Code Here

    }

    public void testVisitClassStructure() throws Exception {
        ManipulatedResultWriter writer = new ManipulatedResultWriter(element);

        Element manipulation = new Element("manipulation", null);
        writer.visitClassStructure(manipulation);
        verify(element).addElement(same(manipulation));
    }
View Full Code Here

    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
    }

    public void testVisitClassStructureOK() throws Exception {
        Element component = newComponentElement();
        CheckFieldConsistencyResultVisitor visitor = new CheckFieldConsistencyResultVisitor(delegate);
        visitor.setReporter(reporter);
        visitor.setMetadata(component);

        Element manipulation = newManipulationElement(true);
        visitor.visitClassStructure(manipulation);

        verifyZeroInteractions(reporter);

    }
View Full Code Here

        verifyZeroInteractions(reporter);

    }

    public void testVisitClassStructureWithMissingFields() throws Exception {
        Element component = newComponentElement();
        CheckFieldConsistencyResultVisitor visitor = new CheckFieldConsistencyResultVisitor(delegate);
        visitor.setReporter(reporter);
        visitor.setMetadata(component);

        Element manipulation = newManipulationElement(false);
        visitor.visitClassStructure(manipulation);

        verify(reporter).error(anyString());

    }
View Full Code Here

        verify(reporter).error(anyString());

    }

    private Element newManipulationElement(boolean complete) {
        Element manipulation = new Element("manipulation", null);
        if (complete) {
            Element field = new Element("field", null);
            field.addAttribute(new Attribute("name", "property"));
            manipulation.addElement(field);
        }

        return manipulation;
    }
View Full Code Here

        return manipulation;
    }

    private Element newComponentElement() {
        Element component = new Element("component", null);
        Element requires = new Element("requires", null);
        requires.addAttribute(new Attribute("field", "property"));
        component.addElement(requires);

        return component;
    }
View Full Code Here

        String className = "test.inner.ComponentWithInnerClasses";
        manipulate(className, manipulator);

        assertThat(manipulator.getInnerClasses().size()).isEqualTo(3);

        Element manipulation = manipulator.getManipulationMetadata();
        System.out.println(manipulation);
        Element[] inners = manipulation.getElements("inner");
        assertThat(inners.length).isEqualTo(3);

        Element inner = getInnerClassMetadataByName(inners, "MyInnerWithANativeMethod");
        assertThat(inner).isNotNull();
        assertThat(getMethodByName(inner.getElements("method"), "foo")).isNotNull();

        inner = getInnerClassMetadataByName(inners, "MyInnerClass");
        assertThat(inner).isNotNull();
        assertThat(getMethodByName(inner.getElements("method"), "foo")).isNotNull();

        inner = getInnerClassMetadataByName(inners, "1");
        assertThat(inner).isNotNull();
        assertThat(getMethodByName(inner.getElements("method"), "compute")).isNotNull();
    }
View Full Code Here

        when(store.read(anyString())).thenReturn(from(ClusterDaemon.class));
        when(visitor.visitManipulationResult(any(Element.class))).thenReturn(result);

        String path = Strings.asResourcePath(ClusterDaemon.class.getName());
        Element metadata = new Element("", "");
        ManipulationUnit info = new ManipulationUnit(path, metadata);
        engine.addManipulationUnit(info);

        engine.generate();
View Full Code Here

        when(store.read(innerPath)).thenReturn(from(PojoWithInner.MyInner.class));

        String path = Strings.asResourcePath(PojoWithInner.class.getName());
        when(store.read(path)).thenReturn(from(PojoWithInner.class));

        Element metadata = new Element("", "");
        ManipulationUnit info = new ManipulationUnit(path, metadata);
        engine.addManipulationUnit(info);

        engine.generate();
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.metadata.Element

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.