Examples of VerifyEnvironment


Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

public class VerifierTest {
    @Test(groups = { UNIT })
  public void testResolve() throws BundleException {
    VerifierService verifier = new VerifierServiceImpl();
    VerifyEnvironment env = verifier.createEnvironment(new HashMap<String, String>() {
      {
        put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, VerifierService.EE_1_6);
        put(Constants.FRAMEWORK_OS_NAME, "macosx");
        put(Constants.FRAMEWORK_OS_VERSION, "10.5");
      }
    }, new VerifyReporter() {
     
      public void reportWire(BundleRevision importer,
          BundleRequirement reqirement, BundleRevision exporter,
          BundleCapability capability) {
        System.out.println("WIRE: " + importer + " - " + reqirement + " - " + capability + " -> " + exporter);
      }
     
      public void reportLog(LogEntry logEntry) {
        System.out.println("Log(" + logEntry.getTime() + "): " + logEntry.getLevel() + " " + logEntry.getMessage());
        if (logEntry.getException() != null) {
          logEntry.getException().printStackTrace();
        }
      }
     
      public void reportException(Exception ex) {
        ex.printStackTrace();
      }
    });
    Set<BundleRevision> bundles = new HashSet<BundleRevision>();
    bundles.add(env.addBundle(0, new HashMap<String, String>(){
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
        put(Constants.EXPORT_PACKAGE, VerifierService.SYSTEM_PACKAGES + "," + VerifierService.JRE_1_6_PACKAGES);
      }
    }));
    bundles.add(env.addBundle(1, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo");
        put(Constants.IMPORT_PACKAGE, "org.foo, org.osgi.framework");
      }
    }));
    bundles.add(env.addBundle(2, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo2");
        put(Constants.EXPORT_PACKAGE, "org.foo" +
            "");
      }
    }));
    AssertJUnit.assertTrue(" Unable to resolve resolvable state.", env.verifyResolve(bundles, null, null));
  }
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

  }
 
    @Test(groups = { UNIT })
  public void testResolveFail() throws BundleException {
    VerifierService verifier = new VerifierServiceImpl();
    VerifyEnvironment env = verifier.createEnvironment(new HashMap<String, String>(){
      {
        put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, VerifierService.EE_1_6);
        put(Constants.FRAMEWORK_OS_NAME, "macosx");
        put(Constants.FRAMEWORK_OS_VERSION, "10.5");
      }
    }, new VerifyReporter() {
     
      public void reportWire(BundleRevision importer,
          BundleRequirement reqirement, BundleRevision exporter,
          BundleCapability capability) {
        System.out.println("WIRE: " + importer + " - " + reqirement + " - " + capability + " -> " + exporter);
      }
     
      public void reportLog(LogEntry logEntry) {
        System.out.println("Log(" + logEntry.getTime() + "): " + logEntry.getLevel() + " " + logEntry.getMessage());
        if (logEntry.getException() != null) {
          logEntry.getException().printStackTrace();
        }
      }
     
      public void reportException(Exception ex) {
        ex.printStackTrace();
      }
    });
    Set<BundleRevision> bundles = new HashSet<BundleRevision>();
    bundles.add(env.addBundle(0, new HashMap<String, String>(){
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
        put(Constants.EXPORT_PACKAGE, VerifierService.SYSTEM_PACKAGES + "," + VerifierService.JRE_1_6_PACKAGES);
      }
    }));
    bundles.add(env.addBundle(1, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo");
        put(Constants.IMPORT_PACKAGE, "org.foo");
      }
    }));
    bundles.add(env.addBundle(2, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo2");
        put(Constants.EXPORT_PACKAGE, "org.foo2" +
            "");
      }
    }));
    AssertJUnit.assertFalse("Resolving unresolvable", env.verifyResolve(bundles, null, null));
  }
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

        }

        VerificationResult result = new VerificationResult();
        Map<String, String> manifestMap = getManifestEntries(manifestText);

        VerifyEnvironment env = createVerifyEnvironment(manifestMap, result);

        // Add the main entry...
        result.addBundle(env, manifestMap);

        processArtifacts(version.getDeploymentArtifacts(), env, result);

        StringBuilder sb = new StringBuilder();
        if (result.hasCustomizers()) {
            if (!result.allCustomizerMatch()) {
                sb.append("<p><b>Not all bundle customizers match!</b><br/>");
                sb.append("Provided = ").append(result.getCustomizers().toString()).append("<br/>");
                sb.append("Required = ").append(result.getProcessors().toString()).append(".</p>");
            }
            else {
                sb.append("<p>All bundle customizers match!</p>");
            }
        }

        boolean resolves = env.verifyResolve(result.getBundles(), null, null);
        if (resolves) {
            sb.append("<p>Deployment package resolves.<br/>");
        }
        else {
            sb.append("<p>Deployment package does <b>not</b> resolve!<br/>");
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

            ee = VerifierService.EE_1_6;
        }

        Map<String, String> envMap = Collections.singletonMap(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);

        VerifyEnvironment env = m_verifier.createEnvironment(envMap, new VerifyReporter() {
            public void reportException(Exception ex) {
                ex.printStackTrace(verifyResult.m_out);
            }

            public void reportLog(LogEntry logEntry) {
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

@SuppressWarnings({"deprecation"})
public class VerifierTest {
    @Test(groups = { UNIT })
  public void testResolve() throws BundleException {
    VerifierService verifier = new VerifierServiceImpl();
    VerifyEnvironment env = verifier.createEnvironment(new HashMap<String, String>() {
      {
        put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, VerifierService.EE_1_6);
        put(Constants.FRAMEWORK_OS_NAME, "macosx");
        put(Constants.FRAMEWORK_OS_VERSION, "10.5");
      }
    }, new VerifyReporter() {
     
      public void reportWire(BundleRevision importer,
          BundleRequirement reqirement, BundleRevision exporter,
          BundleCapability capability) {
        System.out.println("WIRE: " + importer + " - " + reqirement + " - " + capability + " -> " + exporter);
      }
     
      public void reportLog(LogEntry logEntry) {
        System.out.println("Log(" + logEntry.getTime() + "): " + logEntry.getLevel() + " " + logEntry.getMessage());
        if (logEntry.getException() != null) {
          logEntry.getException().printStackTrace();
        }
      }
     
      public void reportException(Exception ex) {
        ex.printStackTrace();
      }
    });
    Set<BundleRevision> bundles = new HashSet<BundleRevision>();
    bundles.add(env.addBundle(0, new HashMap<String, String>(){
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
        put(Constants.EXPORT_PACKAGE, VerifierService.SYSTEM_PACKAGES + "," + VerifierService.JRE_1_6_PACKAGES);
      }
    }));
    bundles.add(env.addBundle(1, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo");
        put(Constants.IMPORT_PACKAGE, "org.foo, org.osgi.framework");
      }
    }));
    bundles.add(env.addBundle(2, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo2");
        put(Constants.EXPORT_PACKAGE, "org.foo" +
            "");
      }
    }));
    AssertJUnit.assertTrue(" Unable to resolve resolvable state.", env.verifyResolve(bundles, null, null));
  }
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

  }
 
    @Test(groups = { UNIT })
  public void testResolveFail() throws BundleException {
    VerifierService verifier = new VerifierServiceImpl();
    VerifyEnvironment env = verifier.createEnvironment(new HashMap<String, String>(){
      {
        put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, VerifierService.EE_1_6);
        put(Constants.FRAMEWORK_OS_NAME, "macosx");
        put(Constants.FRAMEWORK_OS_VERSION, "10.5");
      }
    }, new VerifyReporter() {
     
      public void reportWire(BundleRevision importer,
          BundleRequirement reqirement, BundleRevision exporter,
          BundleCapability capability) {
        System.out.println("WIRE: " + importer + " - " + reqirement + " - " + capability + " -> " + exporter);
      }
     
      public void reportLog(LogEntry logEntry) {
        System.out.println("Log(" + logEntry.getTime() + "): " + logEntry.getLevel() + " " + logEntry.getMessage());
        if (logEntry.getException() != null) {
          logEntry.getException().printStackTrace();
        }
      }
     
      public void reportException(Exception ex) {
        ex.printStackTrace();
      }
    });
    Set<BundleRevision> bundles = new HashSet<BundleRevision>();
    bundles.add(env.addBundle(0, new HashMap<String, String>(){
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, FelixConstants.SYSTEM_BUNDLE_SYMBOLICNAME);
        put(Constants.EXPORT_PACKAGE, VerifierService.SYSTEM_PACKAGES + "," + VerifierService.JRE_1_6_PACKAGES);
      }
    }));
    bundles.add(env.addBundle(1, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo");
        put(Constants.IMPORT_PACKAGE, "org.foo");
      }
    }));
    bundles.add(env.addBundle(2, new HashMap<String, String>() {
      {
        put(Constants.BUNDLE_MANIFESTVERSION, "2");
        put(Constants.BUNDLE_SYMBOLICNAME, "org.test.foo2");
        put(Constants.EXPORT_PACKAGE, "org.foo2" +
            "");
      }
    }));
    AssertJUnit.assertFalse("Resolving unresolvable", env.verifyResolve(bundles, null, null));
  }
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

        }

        VerificationResult result = new VerificationResult();
        Map<String, String> manifestMap = getManifestEntries(manifestText);

        VerifyEnvironment env = createVerifyEnvironment(manifestMap, result);

        // Add the main entry...
        result.addBundle(env, manifestMap);

        processArtifacts(version.getDeploymentArtifacts(), env, result);

        StringBuilder sb = new StringBuilder();
        if (result.hasCustomizers()) {
            if (!result.allCustomizerMatch()) {
                sb.append("<p><b>Not all bundle customizers match!</b><br/>");
                sb.append("Provided = ").append(result.getCustomizers().toString()).append("<br/>");
                sb.append("Required = ").append(result.getProcessors().toString()).append(".</p>");
            }
            else {
                sb.append("<p>All bundle customizers match!</p>");
            }
        }

        boolean resolves = env.verifyResolve(result.getBundles(), null, null);
        if (resolves) {
            sb.append("<p>Deployment package resolves.<br/>");
        }
        else {
            sb.append("<p>Deployment package does <b>not</b> resolve!<br/>");
View Full Code Here

Examples of org.apache.ace.deployment.verifier.VerifierService.VerifyEnvironment

            ee = VerifierService.EE_1_6;
        }

        Map<String, String> envMap = Collections.singletonMap(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);

        VerifyEnvironment env = m_verifier.createEnvironment(envMap, new VerifyReporter() {
            public void reportException(Exception ex) {
                ex.printStackTrace(verifyResult.m_out);
            }

            public void reportLog(LogEntry logEntry) {
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.