-
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.
[FORGE-1622] It would be good if Aesh had access to export variables
- Loading branch information
1 parent
2568131
commit e847e86
Showing
3 changed files
with
91 additions
and
0 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
87 changes: 87 additions & 0 deletions
87
shell/tests/src/test/java/org/jboss/forge/addon/shell/command/ShowSystemEnvCommandTest.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,87 @@ | ||
/** | ||
* 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 org.jboss.forge.addon.shell.command; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.addon.resource.DirectoryResource; | ||
import org.jboss.forge.addon.resource.FileResource; | ||
import org.jboss.forge.addon.resource.Resource; | ||
import org.jboss.forge.addon.resource.ResourceFactory; | ||
import org.jboss.forge.addon.shell.test.ShellTest; | ||
import org.jboss.forge.addon.ui.result.Failed; | ||
import org.jboss.forge.addon.ui.result.Result; | ||
import org.jboss.forge.arquillian.AddonDependency; | ||
import org.jboss.forge.arquillian.Dependencies; | ||
import org.jboss.forge.arquillian.archive.ForgeArchive; | ||
import org.jboss.forge.furnace.repositories.AddonDependencyEntry; | ||
import org.jboss.forge.furnace.util.OperatingSystemUtils; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import javax.inject.Inject; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.hamcrest.CoreMatchers.containsString; | ||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.hamcrest.CoreMatchers.instanceOf; | ||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.CoreMatchers.not; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class ShowSystemEnvCommandTest | ||
{ | ||
@Deployment | ||
@Dependencies({ | ||
@AddonDependency(name = "org.jboss.forge.addon:ui"), | ||
@AddonDependency(name = "org.jboss.forge.addon:projects"), | ||
@AddonDependency(name = "org.jboss.forge.addon:shell-test-harness"), | ||
@AddonDependency(name = "org.jboss.forge.addon:resources"), | ||
@AddonDependency(name = "org.jboss.forge.furnace.container:cdi") | ||
}) | ||
public static ForgeArchive getDeployment() | ||
{ | ||
ForgeArchive archive = ShrinkWrap | ||
.create(ForgeArchive.class) | ||
.addBeansXML() | ||
.addAsAddonDependencies(AddonDependencyEntry.create("org.jboss.forge.addon:ui"), | ||
AddonDependencyEntry.create("org.jboss.forge.addon:projects"), | ||
AddonDependencyEntry.create("org.jboss.forge.addon:shell-test-harness"), | ||
AddonDependencyEntry.create("org.jboss.forge.addon:resources"), | ||
AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi") | ||
); | ||
|
||
return archive; | ||
} | ||
|
||
@Inject | ||
private ShellTest shellTest; | ||
|
||
@Test | ||
public void testShowSystemEnv() throws Exception | ||
{ | ||
|
||
if (OperatingSystemUtils.isLinux() || OperatingSystemUtils.isOSX()) | ||
{ | ||
shellTest.execute("echo $PATH", 5, TimeUnit.SECONDS); | ||
String out = shellTest.getStdOut(); | ||
Assert.assertThat(out, containsString("/usr")); | ||
} | ||
else | ||
{ | ||
shellTest.execute("echo %PATH%", 5, TimeUnit.SECONDS); | ||
String out = shellTest.getStdOut(); | ||
Assert.assertThat(out, containsString("System32")); | ||
} | ||
} | ||
} |