Package org.apache.felix.ipojo.manipulator

Examples of org.apache.felix.ipojo.manipulator.Reporter


        } else {
            // Check that the metadata are in the jar file
            metadata = findMetadata(jf);
        }

        Reporter reporter = new SystemReporter();
        File out = File.createTempFile("ipojo-", ".jar", m_temp);

        ResourceStore store = new BundleAwareJarFileResourceStore(jf, out, m_context);

        CompositeMetadataProvider composite = new CompositeMetadataProvider(reporter);
View Full Code Here


     *
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public void testDoubleManipulationWithAnnotations() throws IOException, ClassNotFoundException {
        Reporter reporter = mock(Reporter.class);
        // Step 1 - First collection and manipulation
        //1.1 Metadata collection
        byte[] origin = ManipulatorTest.getBytesFromFile(new File("target/test-classes/test/PlentyOfAnnotations.class"));
        MiniStore store = new MiniStore()
                .addClassToStore("test.PlentyOfAnnotations",
View Full Code Here

import static org.mockito.Mockito.mock;

public class FileMetadataProviderTestCase extends TestCase {
    public void testGetMetadatasFromFile() throws Exception {
        File metadata = new File(new File("target", "test-classes"), "metadata.xml");
        Reporter reporter = mock(Reporter.class);
        FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter);
        provider.setValidateUsingLocalSchemas(true);

        List<Element> meta = provider.getMetadatas();
        assertEquals(3, meta.size());
View Full Code Here

        assertEquals(3, meta.size());
    }

    public void testGetMetadatasFromDirectory() throws Exception {
        File metadata = new File("target", "test-classes");
        Reporter reporter = mock(Reporter.class);
        FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter);
        provider.setValidateUsingLocalSchemas(true);

        List<Element> meta = provider.getMetadatas();
        assertEquals(3, meta.size());
View Full Code Here

public class StreamMetadataProviderTestCase extends TestCase {

    public void testGetMetadatas() throws Exception {
        File metadata = new File(new File("target", "test-classes"), "metadata.xml");
        FileInputStream fis = new FileInputStream(metadata);
        Reporter reporter = mock(Reporter.class);

        StreamMetadataProvider provider = new StreamMetadataProvider(fis, reporter);
        provider.setValidateUsingLocalSchemas(true);

        List<Element> meta = provider.getMetadatas();
View Full Code Here

    }

    public void testWithEmptyMetadataXml() throws Exception {
        File metadata = new File(new File("target", "test-classes"), "empty-metadata.xml");
        FileInputStream fis = new FileInputStream(metadata);
        Reporter reporter = mock(Reporter.class);

        StreamMetadataProvider provider = new StreamMetadataProvider(fis, reporter);
        provider.setValidateUsingLocalSchemas(true);

        List<Element> meta = provider.getMetadatas();
View Full Code Here

import static org.mockito.Mockito.mock;

public class AnnotationMetadataProviderTestCase extends TestCase {
    public void testGetMetadatas() throws Exception {
        MiniStore store = new MiniStore(AnnotatedComponent.class, FakeAnnotation.class);
        Reporter reporter = mock(Reporter.class);
        AnnotationMetadataProvider provider = new AnnotationMetadataProvider(store, reporter);

        List<Element> meta = provider.getMetadatas();
        assertEquals(1, meta.size());
View Full Code Here

            }
        }

        File out = new File(m_buildDirectory + File.separator + "_out.jar");

        Reporter reporter = new MavenReporter(getLog());
        Pojoization pojo = new Pojoization(reporter);
        if (m_ignoreAnnotations) {
            pojo.disableAnnotationProcessing();
        }
        if (!m_ignoreEmbeddedXSD) {
            pojo.setUseLocalXSD();
        }

        // Executes the pojoization.
        if (is == null) {
            if (metadata == null) { // No metadata.
                pojo.pojoization(in, out, (File) null, classpath.createClassLoader()); // Only annotations
            } else {
                pojo.pojoization(in, out, metadata, classpath.createClassLoader()); // Metadata set
            }
        } else { // In-Pom metadata.
            pojo.pojoization(in, out, is, classpath.createClassLoader());
        }

        for (int i = 0; i < reporter.getWarnings().size(); i++) {
            getLog().warn((String) reporter.getWarnings().get(i));
        }
        if (reporter.getErrors().size() > 0) {
            throw new MojoExecutionException((String) reporter.getErrors().get(0));
        }

        if (m_classifier != null) {
            // The user want to attach the resulting jar
            // Do not delete in File
View Full Code Here


        bind(HandlerDeclaration.class)
                .to(new AnnotationVisitorFactory() {
                    public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
                        Reporter reporter = context.getReporter();
                        return new HandlerDeclarationVisitor(context.getWorkbench(), getFreshDocumentBuilder(reporter), reporter);
                    }
                });

        bind(Instantiate.class)
View Full Code Here

* To change this template use File | Settings | File Templates.
*/
public class ComponentVisitorTestCase extends TestCase {

    public void testDefaultNameIsClassname() throws Exception {
        Reporter reporter = mock(Reporter.class);
        ComponentWorkbench workbench = new ComponentWorkbench(null, clazz());
        ComponentVisitor visitor = new ComponentVisitor(workbench, reporter);
        visitor.visitEnd();

        Element root = workbench.getRoot();
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.manipulator.Reporter

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.