Skip to content

Commit

Permalink
FORGE-1729: Added Furnace.isTestMode() and supporting functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthree committed Apr 7, 2014
1 parent f76f7e1 commit 45425e7
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,9 @@ public ListenerRegistration<ContainerLifecycleListener> addContainerLifecycleLis
*/
public String[] getArgs();

/**
* Returns <code>true</code> or <code>false</code> if this this is running in a test environment.
*/
public boolean isTestMode();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright 2014 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 test.org.jboss.forge.furnace.api;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.forge.arquillian.services.LocalServices;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
@RunWith(Arquillian.class)
public class TestModeTest
{
@Deployment
public static ForgeArchive getDeployment()
{
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class)
.addAsLocalServices(TestModeTest.class);

return archive;
}

@Test
public void testAssumptionShouldBeSkipped()
{
Assert.assertTrue(LocalServices.getFurnace(TestModeTest.class.getClassLoader()).isTestMode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -482,4 +482,10 @@ private AddonLifecycleManager getLifecycleManager()
manager = new AddonLifecycleManager(this);
return manager;
}

@Override
public boolean isTestMode()
{
return Boolean.getBoolean("org.jboss.forge.furnace.test");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ public void run()
@Override
public Object call() throws Exception
{
System.setProperty("org.jboss.forge.furnace.test", "true");

furnace.setServerMode(true);
furnace.start(loader);

Expand Down

0 comments on commit 45425e7

Please sign in to comment.