diff --git a/container/src/main/java/org/jboss/forge/furnace/impl/addons/AddonRepositoryImpl.java b/container/src/main/java/org/jboss/forge/furnace/impl/addons/AddonRepositoryImpl.java index 73b844fa..eaa7db4b 100644 --- a/container/src/main/java/org/jboss/forge/furnace/impl/addons/AddonRepositoryImpl.java +++ b/container/src/main/java/org/jboss/forge/furnace/impl/addons/AddonRepositoryImpl.java @@ -127,7 +127,7 @@ public Boolean call() throws Exception File descriptor = getAddonDescriptor(addon); try { - if (resources != null && resources.iterator().hasNext()) + if (resources != null) { for (File resource : resources) { @@ -150,26 +150,29 @@ public Boolean call() throws Exception Node addonXml = getXmlRoot(descriptor); Node dependenciesNode = addonXml.getOrCreate(DEPENDENCIES_TAG_NAME); - for (AddonDependencyEntry dependency : dependencies) + if (dependencies != null) { - String name = dependency.getName(); - Node dep = null; - for (Node node : dependenciesNode.get(DEPENDENCY_TAG_NAME)) + for (AddonDependencyEntry dependency : dependencies) { - if (name.equals(node.getAttribute(ATTR_NAME))) + String name = dependency.getName(); + Node dep = null; + for (Node node : dependenciesNode.get(DEPENDENCY_TAG_NAME)) { - dep = node; - break; + if (name.equals(node.getAttribute(ATTR_NAME))) + { + dep = node; + break; + } } + if (dep == null) + { + dep = dependenciesNode.createChild(DEPENDENCY_TAG_NAME); + dep.attribute(ATTR_NAME, name); + } + dep.attribute(ATTR_VERSION, dependency.getVersionRange()); + dep.attribute(ATTR_EXPORT, dependency.isExported()); + dep.attribute(ATTR_OPTIONAL, dependency.isOptional()); } - if (dep == null) - { - dep = dependenciesNode.createChild(DEPENDENCY_TAG_NAME); - dep.attribute(ATTR_NAME, name); - } - dep.attribute(ATTR_VERSION, dependency.getVersionRange()); - dep.attribute(ATTR_EXPORT, dependency.isExported()); - dep.attribute(ATTR_OPTIONAL, dependency.isOptional()); } FileOutputStream fos = null; @@ -464,9 +467,8 @@ public Boolean call() throws Exception { File addonBaseDir = getAddonBaseDir(addon); File addonDescriptorFile = getAddonDescriptorFile(addon); - List addonResources = getAddonResources(addon); - return addonBaseDir.exists() && addonDescriptorFile.exists() && !addonResources.isEmpty(); + return addonBaseDir.exists() && addonDescriptorFile.exists(); } }); } diff --git a/container/src/test/java/org/jboss/forge/furnace/AddonRepositoryImplTest.java b/container/src/test/java/org/jboss/forge/furnace/AddonRepositoryImplTest.java index 588a7571..933c4a0d 100644 --- a/container/src/test/java/org/jboss/forge/furnace/AddonRepositoryImplTest.java +++ b/container/src/test/java/org/jboss/forge/furnace/AddonRepositoryImplTest.java @@ -108,7 +108,7 @@ public void testDeployAddonEntryNoDependenciesOrResources() throws Exception Assert.assertFalse(repository.isDeployed(addon)); repository.deploy(addon, new ArrayList(), new ArrayList()); - Assert.assertFalse(repository.isDeployed(addon)); + Assert.assertTrue(repository.isDeployed(addon)); Assert.assertFalse(repository.isEnabled(addon)); repository.enable(addon);