BundleInfoJcrHelper { static String getJcrPath(BundleInfo bundleInfo) { StringBuilder path = new StringBuilder(); path.append(PATH_BUNDLES + '/'); if (StringUtils.isNotEmpty(bundleInfo.getGroupId())) { path.append(bundleInfo.getGroupId().replace('.', '/')).append('/'); } path.append(bundleInfo.getSymbolicName()).append('/').append(bundleInfo.getVersion()).append('/') .append(bundleInfo.getSymbolicName()).append('-').append(bundleInfo.getVersion()).append(".jar"); return path.toString(); } private  BundleInfoJcrHelper(); static void storePersistentStates(Collection<BundlePersistentInfo> bundles); static Collection<BundlePersistentInfo> getPersistentStates(); static JCRNodeWrapper getRootNode(JCRSessionWrapper session); static final String NODE_TYPE_FOLDER; static final String NODE_TYPE_ROOT; static final String NODE_MODULE_MANAGENENT; static final String NODE_BUNDLES; static final String PATH_MODULE_MANAGEMENT; static final String PATH_BUNDLES; static final String PROP_BUNDLES_PERSISTENT_STATE; }
@Test public void testKeyToPath() throws Exception { assertEquals(PATH_BUNDLES + "/org/jahia/modules/article/2.0.0/article-2.0.0.jar", getJcrPath("org.jahia.modules/article/2.0.0")); assertEquals( PATH_BUNDLES + "/org/jahia/modules/advanced-visibility/2.0.1-SNAPSHOT/advanced-visibility-2.0.1-SNAPSHOT.jar", getJcrPath("org.jahia.modules/advanced-visibility/2.0.1-SNAPSHOT")); assertEquals(PATH_BUNDLES + "/info/shyrkov/modules/myTest-module/1.0/myTest-module-1.0.jar", getJcrPath("info.shyrkov.modules/myTest-module/1.0")); assertEquals(PATH_BUNDLES + "/myTest-module/2.1/myTest-module-2.1.jar", getJcrPath("myTest-module/2.1")); }
@Test public void testInfoToPath() throws Exception { assertEquals(PATH_BUNDLES + "/org/jahia/modules/article/2.0.0/article-2.0.0.jar", getJcrPath(new PersistentBundle("org.jahia.modules", "article", "2.0.0"))); assertEquals( PATH_BUNDLES + "/org/jahia/modules/advanced-visibility/2.0.1-SNAPSHOT/advanced-visibility-2.0.1-SNAPSHOT.jar", getJcrPath(new PersistentBundle("org.jahia.modules", "advanced-visibility", "2.0.1-SNAPSHOT"))); assertEquals(PATH_BUNDLES + "/info/shyrkov/modules/myTest-module/1.0/myTest-module-1.0.jar", getJcrPath(new PersistentBundle("info.shyrkov.modules", "myTest-module", "1.0"))); assertEquals(PATH_BUNDLES + "/myTest-module/2.1/myTest-module-2.1.jar", getJcrPath(new PersistentBundle(null, "myTest-module", "2.1"))); }