Examples of Skeleton


Examples of org.apache.aries.unittest.mocks.Skeleton

    persistenceBundleContext = persistenceBundle.getBundleContext();
   
    pp = Skeleton.newMock(PersistenceProvider.class);
   
    providerBundleP100 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    Skeleton skel = Skeleton.getSkeleton(providerBundleP100);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.0.0"));

    providerBundleP101 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    skel = Skeleton.getSkeleton(providerBundleP101);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.0.1"));

    providerBundleP110 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    skel = Skeleton.getSkeleton(providerBundleP110);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.1.0"));

    providerBundleP111 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    skel = Skeleton.getSkeleton(providerBundleP111);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.1.1"));

    extenderBundle = Skeleton.newMock(new BundleMock("extender", new Hashtable<String, Object>()), Bundle.class);
//    Skeleton.getSkeleton(extenderBundle).setReturnValue(new MethodCall(Bundle.class, "getResource", "schemas/persistence_1_0.xsd"), new File("unittest/resources/persistence_1_0.xsd").toURI().toURL());
   
  }
View Full Code Here

Examples of org.apache.aries.unittest.mocks.Skeleton

   
    Bundle persistenceBundle2 = Skeleton.newMock(new BundleMock("scrappy.doo", new Hashtable<String, Object>()), Bundle.class);

    persistenceBundle2.getHeaders().put("Meta-Persistence", "");
   
    Skeleton skel = Skeleton.getSkeleton(persistenceBundle2);
   
    skel.setReturnValue(new MethodCall(Bundle.class, "getState"), Bundle.ACTIVE);
   
    URL rootURL = getClass().getClassLoader().getResource("file12");
    URL xml = getClass().getClassLoader().getResource("file12" + "/META-INF/persistence.xml");
   
    skel.setReturnValue(new MethodCall(Bundle.class, "getResource", "/"), rootURL);
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"), xml);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("0.0.0"));
   

    mgr.start(ctx);
   
    mgr.addingBundle(persistenceBundle2, new BundleEvent(BundleEvent.STARTING, persistenceBundle2));
View Full Code Here

Examples of org.apache.aries.unittest.mocks.Skeleton

  }
 
  private void setupPersistenceBundle21() throws Exception {
    persistenceBundle.getHeaders().put("Meta-Persistence", "OSGI-INF/found.xml, jarfile.jar!/jar.xml,persistence/another.xml, does-not-exist.xml");
   
    Skeleton skel = Skeleton.getSkeleton(persistenceBundle);
    skel.setReturnValue(new MethodCall(Bundle.class, "getState"), Bundle.ACTIVE);

    URL xml = getClass().getClassLoader().getResource("file21/META-INF/persistence.xml");
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"), xml);
   
    xml = getClass().getClassLoader().getResource("file21/OSGI-INF/found.xml");
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "OSGI-INF/found.xml"), xml);
   
    URL root = getClass().getClassLoader().getResource("file21");
   
    File f = new File(new File(root.toURI()), "jarfile.jar");
   
    JarOutputStream jos = new JarOutputStream(new FileOutputStream(f));
   
    jos.putNextEntry(new ZipEntry("jar.xml"));
   
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(jos));
    writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    writer.newLine();
    writer.write("<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\"");
    writer.newLine();
    writer.write("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
    writer.newLine();   
    writer.write("xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd\"");
    writer.newLine();
    writer.write("version=\"1.0\">");
    writer.newLine();
    writer.write("<persistence-unit name=\"jar\"/>");
    writer.newLine();
    writer.write("</persistence>");
   
    writer.close();
   
    xml = getClass().getClassLoader().getResource("file21/jarfile.jar");
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "jarfile.jar"), xml);

    xml = getClass().getClassLoader().getResource("file21/persistence/another.xml");
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "persistence/another.xml"), xml);

    xml = getClass().getClassLoader().getResource("file21/OSGI-INF/not-found.xml");
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "OSGI-INF/not-found.xml"), xml);
   
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "does-not-exist.xml"), null);
   
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("0.0.0"));
   
  }
View Full Code Here

Examples of org.apache.aries.unittest.mocks.Skeleton

  private void setupPersistenceBundle(String root, String header) throws MalformedURLException
  {
    persistenceBundle.getHeaders().put("Meta-Persistence", header);
   
    Skeleton skel = Skeleton.getSkeleton(persistenceBundle);
   
    skel.setReturnValue(new MethodCall(Bundle.class, "getState"), Bundle.ACTIVE);
   
    URL rootURL = getClass().getClassLoader().getResource(root);
    URL xml = getClass().getClassLoader().getResource(root + "/META-INF/persistence.xml");
   
    skel.setReturnValue(new MethodCall(Bundle.class, "getResource", "/"), rootURL);
    skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"), xml);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("0.0.0"));
  }
View Full Code Here

Examples of org.apache.aries.unittest.mocks.Skeleton

                Bundle.INSTALLED | Bundle.STARTING | Bundle.ACTIVE | Bundle.STOPPING, customizer);
       
        sut.open();
       
        CompositeBundle cb = Skeleton.newMock(CompositeBundle.class);
        Skeleton cbSkel = Skeleton.getSkeleton(cb);
        cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getSymbolicName"), "test.composite");
        cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getVersion"), new Version("1.0.0"));
       
        assertTrue(BundleTrackerFactory.getAllBundleTracker().isEmpty());
       
        sut.addingBundle(cb, new BundleEvent(BundleEvent.INSTALLED, cb));
        assertEquals(1, BundleTrackerFactory.getAllBundleTracker().size());
View Full Code Here

Examples of org.apache.aries.unittest.mocks.Skeleton

 
  public BundleMock(String name, Dictionary<?, ?> properties, File location) throws Exception
  {
    this(name,properties,location.toURL().toExternalForm());
   
    Skeleton bcSkel = Skeleton.getSkeleton(bc);
    bcSkel.registerMethodCallHandler(
        new MethodCall(BundleContext.class,"getDataFile", new Object[] { String.class }),
        new PrivateDataFileHandler(location)
    );
  }
View Full Code Here

Examples of org.apache.axis.wsdl.Skeleton

            try {
                // Use the getParameterNameStatic method so that we don't have to new up
                // an object.
                Method getParameterName = cls.getMethod("getParameterNameStatic",
                                                         new Class [] {String.class, int.class});
                Skeleton skelObj = null;
                if (getParameterName == null) {
                    // Fall back to getting new instance
                    skelObj = (Skeleton) cls.newInstance();
                    getParameterName = cls.getMethod("getParameterName",
                                                     new Class [] {String.class, int.class});
View Full Code Here

Examples of org.apache.axis.wsdl.Skeleton

            try {
                // Use the getParameterModeStatic method so that we don't have to new up
                // an object.
                Method getParameterMode = cls.getMethod("getParameterModeStatic",
                                                         new Class [] {String.class, int.class});
                Skeleton skelObj = null;
                if (getParameterMode == null) {
                    // Fall back to getting new instance
                    skelObj = (Skeleton) cls.newInstance();
                    getParameterMode = cls.getMethod("getParameterMode",
                                                     new Class [] {String.class, int.class});
View Full Code Here

Examples of org.apache.axis.wsdl.Skeleton

            try {
                // Use the getParameterNameStatic method so that we don't have to new up
                // an object.
                Method getParameterName = cls.getMethod("getParameterNameStatic",
                                                         new Class [] {String.class, int.class});
                Skeleton skelObj = null;
                if (getParameterName == null) {
                    // Fall back to getting new instance
                    skelObj = (Skeleton) cls.newInstance();
                    getParameterName = cls.getMethod("getParameterName",
                                                     new Class [] {String.class, int.class});
View Full Code Here

Examples of org.apache.axis.wsdl.Skeleton

            try {
                // Use the getParameterModeStatic method so that we don't have to new up
                // an object.
                Method getParameterMode = cls.getMethod("getParameterModeStatic",
                                                         new Class [] {String.class, int.class});
                Skeleton skelObj = null;
                if (getParameterMode == null) {
                    // Fall back to getting new instance
                    skelObj = (Skeleton) cls.newInstance();
                    getParameterMode = cls.getMethod("getParameterMode",
                                                     new Class [] {String.class, int.class});
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.