Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #628 from mbriskar/WINDUP-670
WINDUP-670: Make Rexster more convenient to use
- Loading branch information
Showing
28 changed files
with
356 additions
and
195 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
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
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
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
74 changes: 74 additions & 0 deletions
74
...est/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentDebugTest.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,74 @@ | ||
package org.jboss.windup.graph.rexster.test.debug; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.AddonDependencies; | ||
import org.jboss.forge.arquillian.AddonDependency; | ||
import org.jboss.forge.arquillian.archive.AddonArchive; | ||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.services.Imported; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.windup.config.furnace.FurnaceHolder; | ||
import org.jboss.windup.graph.GraphContext; | ||
import org.jboss.windup.graph.GraphContextFactory; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.io.IOException; | ||
import java.net.Socket; | ||
|
||
/** | ||
* Tests that rexster is properly deployed thanks to Arquillian addon | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class RexsterDefaultDeploymentDebugTest | ||
{ | ||
@Deployment | ||
@AddonDependencies({ | ||
@AddonDependency(name = "org.jboss.windup.config:windup-config"), | ||
@AddonDependency(name = "org.jboss.windup.graph:windup-graph"), | ||
@AddonDependency(name = "org.jboss.forge.furnace.container:simple") | ||
}) | ||
public static AddonArchive getDeployment() | ||
{ | ||
System.setProperty("maven.surefire.debug", "true"); | ||
final AddonArchive archive = ShrinkWrap.create(AddonArchive.class) | ||
.addAsLocalServices(RexsterDefaultDeploymentDebugTest.class); | ||
|
||
return archive; | ||
} | ||
|
||
@Test | ||
public void testRexsterProperStart() throws IOException, InstantiationException, IllegalAccessException | ||
{ | ||
Furnace furnace = FurnaceHolder.getFurnace(); | ||
Imported<GraphContextFactory> factory = furnace.getAddonRegistry().getServices(GraphContextFactory.class); | ||
//GraphContext creation will start the rexster | ||
try (GraphContext context = factory.get().create()) | ||
{ | ||
Socket s = null; | ||
try | ||
{ | ||
s = new Socket("localhost", 8182); | ||
} | ||
catch (Exception e) | ||
{ | ||
Assert.fail("Rexster is not listening on localhost:8182"); | ||
} | ||
finally | ||
{ | ||
if (s != null) | ||
try | ||
{ | ||
s.close(); | ||
} | ||
catch (Exception e) | ||
{ | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...t/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentNoDebugTest.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,70 @@ | ||
package org.jboss.windup.graph.rexster.test.debug; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.AddonDependencies; | ||
import org.jboss.forge.arquillian.AddonDependency; | ||
import org.jboss.forge.arquillian.archive.AddonArchive; | ||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.services.Imported; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.windup.config.furnace.FurnaceHolder; | ||
import org.jboss.windup.graph.GraphContext; | ||
import org.jboss.windup.graph.GraphContextFactory; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import java.io.IOException; | ||
import java.net.ConnectException; | ||
import java.net.Socket; | ||
|
||
/** | ||
* Tests that rexster is not deployed by Arquillian addon in case debug mode is OFF. | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class RexsterDefaultDeploymentNoDebugTest | ||
{ | ||
@Deployment | ||
@AddonDependencies({ | ||
@AddonDependency(name = "org.jboss.windup.config:windup-config"), | ||
@AddonDependency(name = "org.jboss.windup.graph:windup-graph"), | ||
@AddonDependency(name = "org.jboss.forge.furnace.container:simple") | ||
}) | ||
public static AddonArchive getDeployment() | ||
{ | ||
final AddonArchive archive = ShrinkWrap.create(AddonArchive.class) | ||
.addAsLocalServices(RexsterDefaultDeploymentNoDebugTest.class); | ||
|
||
return archive; | ||
} | ||
|
||
@Test(expected = ConnectException.class) | ||
public void testRexsterProperStart() throws IOException, InstantiationException, IllegalAccessException | ||
{ | ||
Furnace furnace = FurnaceHolder.getFurnace(); | ||
Imported<GraphContextFactory> factory = furnace.getAddonRegistry().getServices(GraphContextFactory.class); | ||
try (GraphContext context = factory.get().create()) | ||
{ | ||
Socket s = null; | ||
try | ||
{ | ||
s = new Socket("localhost", 8182); | ||
Assert.fail("Rexster should not be registered when not in debug mode."); | ||
} | ||
finally | ||
{ | ||
if (s != null) | ||
try | ||
{ | ||
s.close(); | ||
} | ||
catch (Exception e) | ||
{ | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
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
Oops, something went wrong.