-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added JGraphT and a new Example Addon with Version Ranges
- Loading branch information
1 parent
3e87806
commit 1a9a746
Showing
12 changed files
with
269 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jboss.forge</groupId> | ||
<artifactId>forge-parent</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>org.jboss.forge.addon</groupId> | ||
<artifactId>example3</artifactId> | ||
<name>Forge - Example 3 Addon</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.forge.furnace</groupId> | ||
<artifactId>furnace-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.forge.addon</groupId> | ||
<artifactId>example</artifactId> | ||
<version>[2.0.0-SNAPSHOT,3.0.0)</version> | ||
<classifier>forge-addon</classifier> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.forge.addon</groupId> | ||
<artifactId>example2</artifactId> | ||
<version>[2.0.0-SNAPSHOT,3.0.0)</version> | ||
<classifier>forge-addon</classifier> | ||
<optional>true</optional> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>create-forge-addon</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
<inherited>false</inherited> | ||
<configuration> | ||
<classifier>forge-addon</classifier> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
18 changes: 18 additions & 0 deletions
18
addon-manager/example3/src/main/java/org/example/Example3Service.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.example; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.example.other.OtherExampleAddon; | ||
import org.jboss.forge.furnace.services.Exported; | ||
|
||
@Exported | ||
public class Example3Service | ||
{ | ||
@Inject | ||
private OtherExampleAddon service; | ||
|
||
public int getRemoteHashCode() | ||
{ | ||
return service.hashCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
...nager/tests/src/test/java/org/jboss/forge/addon/manager/AddonManagerVersionRangeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.addon.manager; | ||
|
||
import java.io.File; | ||
import java.util.Set; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.Addon; | ||
import org.jboss.forge.arquillian.Dependencies; | ||
import org.jboss.forge.arquillian.archive.ForgeArchive; | ||
import org.jboss.forge.furnace.addons.AddonId; | ||
import org.jboss.forge.furnace.addons.AddonRegistry; | ||
import org.jboss.forge.furnace.repositories.AddonDependencyEntry; | ||
import org.jboss.forge.furnace.repositories.AddonRepository; | ||
import org.jboss.forge.furnace.util.Addons; | ||
import org.jboss.forge.furnace.versions.SingleVersion; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Assert; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* FIXME This test needs to be refactored to be a bit less brittle. It breaks when addon POMs change. | ||
* | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
@Ignore | ||
@RunWith(Arquillian.class) | ||
public class AddonManagerVersionRangeTest | ||
{ | ||
@Deployment | ||
@Dependencies({ | ||
@Addon(name = "org.jboss.forge.addon:addon-manager", version = "2.0.0-SNAPSHOT"), | ||
@Addon(name = "org.jboss.forge.addon:maven", version = "2.0.0-SNAPSHOT") | ||
}) | ||
public static ForgeArchive getDeployment() | ||
{ | ||
ForgeArchive archive = ShrinkWrap | ||
.create(ForgeArchive.class) | ||
.addBeansXML() | ||
.addAsAddonDependencies( | ||
AddonDependencyEntry.create(AddonId.from("org.jboss.forge.addon:addon-manager", "2.0.0-SNAPSHOT")) | ||
); | ||
|
||
return archive; | ||
} | ||
|
||
@Inject | ||
private AddonRegistry registry; | ||
|
||
@Inject | ||
private AddonManager addonManager; | ||
|
||
@Inject | ||
private AddonRepository repository; | ||
|
||
@Test | ||
public void testInstallingAddonWithSingleOptionalAddonDependency() throws InterruptedException | ||
{ | ||
int addonCount = registry.getAddons().size(); | ||
AddonId example = AddonId.fromCoordinates("org.jboss.forge.addon:example3,2.0.0-SNAPSHOT"); | ||
InstallRequest request = addonManager.install(example); | ||
|
||
Assert.assertEquals(0, request.getRequiredAddons().size()); | ||
Assert.assertEquals(1, request.getOptionalAddons().size()); | ||
|
||
request.perform(); | ||
|
||
Assert.assertTrue(repository.isEnabled(example)); | ||
Assert.assertEquals(2, repository.getAddonResources(example).size()); | ||
Assert.assertTrue(repository.getAddonResources(example).contains( | ||
new File(repository.getAddonBaseDir(example), "commons-lang-2.6.jar"))); | ||
Assert.assertTrue(repository.getAddonResources(example).contains( | ||
new File(repository.getAddonBaseDir(example), "example-2.0.0-SNAPSHOT-forge-addon.jar"))); | ||
|
||
Set<AddonDependencyEntry> dependencies = repository.getAddonDependencies(example); | ||
Assert.assertEquals(1, dependencies.size()); | ||
AddonDependencyEntry dependency = dependencies.toArray(new AddonDependencyEntry[dependencies.size()])[0]; | ||
Assert.assertEquals("org.jboss.forge.addon:example2", dependency | ||
.getId().getName()); | ||
Assert.assertEquals(new SingleVersion("2.0.0-SNAPSHOT"), dependency | ||
.getId().getVersion()); | ||
Assert.assertTrue(dependency.isOptional()); | ||
Assert.assertFalse(dependency.isExported()); | ||
|
||
Assert.assertTrue(registry.getAddon(AddonId.from("org.jboss.forge.addon:example2", "2.0.0-SNAPSHOT")) | ||
.getStatus().isMissing()); | ||
|
||
Addons.waitUntilStarted(registry.getAddon(example), 10, TimeUnit.SECONDS); | ||
Assert.assertEquals(addonCount + 2, registry.getAddons().size()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
container/src/main/java/org/jboss/forge/furnace/modules/providers/FurnaceContainerSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
package org.jboss.forge.furnace.modules.providers; | ||
|
||
import java.util.Arrays; | ||
|
65 changes: 65 additions & 0 deletions
65
container/src/main/java/org/jboss/forge/furnace/modules/providers/JGraphTClasspathSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.jboss.forge.furnace.modules.providers; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.jboss.modules.DependencySpec; | ||
import org.jboss.modules.ModuleIdentifier; | ||
import org.jboss.modules.ModuleLoader; | ||
import org.jboss.modules.ModuleSpec.Builder; | ||
import org.jboss.modules.filter.PathFilters; | ||
|
||
public class JGraphTClasspathSpec extends AbstractModuleSpecProvider | ||
{ | ||
public static final ModuleIdentifier ID = ModuleIdentifier.create("org.jgrapht"); | ||
|
||
public static Set<String> paths = new HashSet<String>(); | ||
|
||
static | ||
{ | ||
paths.add("org/jgrapht"); | ||
paths.add("org/jgrapht/alg"); | ||
paths.add("org/jgrapht/alg.util"); | ||
paths.add("org/jgrapht/demo"); | ||
paths.add("org/jgrapht/event"); | ||
paths.add("org/jgrapht/experimental"); | ||
paths.add("org/jgrapht/experimental/alg"); | ||
paths.add("org/jgrapht/experimental/alg/color"); | ||
paths.add("org/jgrapht/experimental/dag"); | ||
paths.add("org/jgrapht/experimental/equivalence"); | ||
paths.add("org/jgrapht/experimental/isomorphism"); | ||
paths.add("org/jgrapht/experimental/permutation"); | ||
paths.add("org/jgrapht/experimental/touchgraph"); | ||
paths.add("org/jgrapht/ext"); | ||
paths.add("org/jgrapht/generate"); | ||
paths.add("org/jgrapht/graph"); | ||
paths.add("org/jgrapht/traverse"); | ||
paths.add("org/jgrapht/util"); | ||
} | ||
|
||
@Override | ||
protected void configure(ModuleLoader loader, Builder builder) | ||
{ | ||
builder.addDependency(DependencySpec.createSystemDependencySpec( | ||
PathFilters.acceptAll(), | ||
PathFilters.any(Arrays.asList( | ||
PathFilters.isChildOf("org/jgrapht"), | ||
PathFilters.is("org/jgrapht") | ||
)), | ||
systemPaths)); | ||
} | ||
|
||
@Override | ||
protected ModuleIdentifier getId() | ||
{ | ||
return ID; | ||
} | ||
|
||
@Override | ||
protected Set<String> getPaths() | ||
{ | ||
return paths; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters