DefaultPackagingService implements Packaging { @Override public JcrPackageDefinition createPackageDefinition(final Node defNode) { return PackagingService.createPackageDefinition(defNode); } @SuppressWarnings("WeakerAccess")  DefaultPackagingService();   DefaultPackagingService(final @NotNull ClassLoader classLoader); @Override PackageManager getPackageManager(); @Override JcrPackageManager getPackageManager(final Session session); @Override JcrPackageDefinition createPackageDefinition(final Node defNode); @Override JcrPackage open(final Node node, final boolean allowInvalid);  }
@Test public void testCreatePackageDefinition() throws Exception { final DefaultPackagingService service = new DefaultPackagingService(); File testPack = TestPackageUtil.prepareTestPackage("test-package-with-etc.zip"); new OakMachine.Builder().build().adminInitAndInspect(session -> { JcrPackageManager manager = service.getPackageManager(session); JcrPackage jcrPackage = null; try { jcrPackage = manager.upload(testPack, false, true, null); JcrPackageDefinition def = service.createPackageDefinition(jcrPackage.getDefNode()); assertTrue("should be real definition", def instanceof JcrPackageDefinitionImpl); } finally { if (jcrPackage != null) { jcrPackage.close(); } } }); }