Skip to content

Commit

Permalink
Added addBeansXML() in ForgeArchive
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Feb 25, 2013
1 parent 98b25b2 commit c5f47dd
Show file tree
Hide file tree
Showing 39 changed files with 99 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import org.jboss.forge.container.AddonId;
import org.jboss.forge.container.AddonRegistry;
import org.jboss.forge.container.AddonRepository;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -43,7 +41,7 @@ public static ForgeArchive getDeployment()
{
ForgeArchive archive = ShrinkWrap
.create(ForgeArchive.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
.addBeansXML()
.addAsAddonDependencies(
AddonDependency.create(AddonId.from("org.jboss.forge:addon-manager", "2.0.0-SNAPSHOT"))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import javax.inject.Inject;

import org.jboss.aesh.console.Console;
import org.jboss.forge.aesh.ShellContext;
import org.jboss.forge.ui.UIBuilder;
import org.jboss.forge.ui.UICommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*/
package org.jboss.forge.aesh.commands;

import java.io.File;
import java.util.Iterator;

import javax.inject.Inject;

import org.jboss.aesh.console.Config;
import org.jboss.aesh.console.Console;
import org.jboss.aesh.extensions.less.Less;
Expand All @@ -20,10 +25,6 @@
import org.jboss.forge.ui.result.Results;
import org.jboss.forge.ui.util.Metadata;

import javax.inject.Inject;
import java.io.File;
import java.util.Iterator;

/**
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*/
package org.jboss.forge.aesh.commands;

import java.io.File;
import java.util.Iterator;

import javax.inject.Inject;

import org.jboss.aesh.console.Config;
import org.jboss.aesh.console.Console;
import org.jboss.aesh.extensions.more.More;
Expand All @@ -20,10 +25,6 @@
import org.jboss.forge.ui.result.Results;
import org.jboss.forge.ui.util.Metadata;

import javax.inject.Inject;
import java.io.File;
import java.util.Iterator;

/**
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
*/
package org.jboss.forge.aesh.util;

import java.util.ArrayList;
import java.util.List;

import org.jboss.aesh.cl.CommandLine;
import org.jboss.aesh.cl.CommandLineParser;
import org.jboss.aesh.cl.OptionBuilder;
Expand All @@ -20,9 +23,6 @@
import org.jboss.forge.ui.input.UIInputComponent;
import org.jboss.forge.ui.input.UIInputMany;

import java.util.ArrayList;
import java.util.List;

/**
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a>
*/
Expand Down
22 changes: 10 additions & 12 deletions aesh/src/test/java/org/jboss/forge/aesh/AeshAddonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.forge.container.AddonDependency;
import org.jboss.forge.container.AddonId;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.junit.Ignore;
import org.junit.Test;
Expand Down Expand Up @@ -44,7 +42,7 @@ public static ForgeArchive getDeployment()
.resolve("org.jboss.aesh:aesh:0.33").withTransitivity().asFile())
.addAsLibraries(Maven.resolver().loadPomFromFile("pom.xml")
.resolve("org.jboss.aesh:aesh-extensions:0.33").withTransitivity().asFile())
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
.addBeansXML()
.addAsAddonDependencies(AddonDependency.create(AddonId.from("org.jboss.forge:ui", "2.0.0-SNAPSHOT")));

return archive;
Expand All @@ -61,28 +59,28 @@ public void testContainerInjection()
{
/*
* try {
*
*
* Assert.assertNotNull(shell);
*
*
* PipedOutputStream outputStream = new PipedOutputStream(); PipedInputStream pipedInputStream = new
* PipedInputStream(outputStream); ByteArrayOutputStream out = new ByteArrayOutputStream();
*
*
* setupSettings(pipedInputStream, out);
*
*
* shell.initShell(); shell.addCommand(new ShellCommand(fooCommand));
*
*
* outputStream.write(("foo\n").getBytes()); shell.startShell(); String outString = out.toString();
* assertEquals("boo", outString.substring(shell.getPrompt().length() + "foo\n".length()));
*
*
* outputStream.write("fo".getBytes()); outputStream.write(completeChar.getFirstValue());
* outputStream.write("\n".getBytes()); shell.startShell(); outString = out.toString();
* System.out.println(outString);
*
*
* outputStream.write(("list-services\n").getBytes()); shell.startShell(); // System.out.println("OUT:"+
* out.toString());
*
*
* outputStream.write(("exit\n").getBytes()); shell.startShell();
*
*
* // shell.stopShell(); } catch (Exception ioe) { ioe.printStackTrace(); }
*/
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* Archive representing a Forge Addon deployment.
*
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public interface ForgeArchive extends Archive<ForgeArchive>, LibraryContainer<ForgeArchive>,
Expand All @@ -23,12 +23,22 @@ public interface ForgeArchive extends Archive<ForgeArchive>, LibraryContainer<Fo
ForgeArchive setAsForgeXML(Asset resource) throws IllegalArgumentException;

/**
* Adds the given {@link Dependencies} instances as addon module dependencies for this test deployment.
* Adds the given {@link AddonDependency} instances as addon module dependencies for this test deployment.
*/
ForgeArchive addAsAddonDependencies(AddonDependency... dependencies);

/**
* Get the currently specified {@link Dependencies} instances for this addon test deployment.
* Get the currently specified {@link AddonDependency} instances for this addon test deployment.
*/
List<AddonDependency> getAddonDependencies();

/**
* Adds an empty beans.xml file in this archive
*/
ForgeArchive addBeansXML();

/**
* Adds an beans.xml file in this archive with the specified content
*/
ForgeArchive addBeansXML(Asset resource);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.jboss.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.impl.base.Validate;
import org.jboss.shrinkwrap.impl.base.container.ContainerBase;

Expand Down Expand Up @@ -83,7 +84,7 @@ public class ForgeArchiveImpl extends ContainerBase<ForgeArchive> implements For

/**
* Create a new {@link ForgeArchive} with any type storage engine as backing.
*
*
* @param delegate The storage backing.
*/
public ForgeArchiveImpl(final Archive<?> delegate)
Expand All @@ -97,7 +98,7 @@ public ForgeArchiveImpl(final Archive<?> delegate)

/**
* {@inheritDoc}
*
*
* @see org.jboss.shrinkwrap.impl.base.container.ContainerBase#getManifestPath()
*/
@Override
Expand All @@ -113,7 +114,7 @@ protected ArchivePath getForgeXMLPath()

/**
* {@inheritDoc}
*
*
* @see org.jboss.shrinkwrap.impl.base.container.ContainerBase#getClassesPath()
*/
@Override
Expand All @@ -124,7 +125,7 @@ protected ArchivePath getClassesPath()

/**
* {@inheritDoc}
*
*
* @see org.jboss.shrinkwrap.impl.base.container.ContainerBase#getLibraryPath()
*/
@Override
Expand Down Expand Up @@ -164,4 +165,18 @@ public List<AddonDependency> getAddonDependencies()
{
return addonDependencies;
}

@Override
public ForgeArchive addBeansXML()
{
addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
return this;
}

@Override
public ForgeArchive addBeansXML(Asset resource)
{
addAsManifestResource(resource, ArchivePaths.create("beans.xml"));
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -23,7 +21,7 @@ public static ForgeArchive getDeployment()
{
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class)
.addClasses(ContainerLifecycleEventObserver.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
.addBeansXML();

return archive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
import org.jboss.forge.container.mocks.ImplementingClass1;
import org.jboss.forge.container.mocks.ImplementingClass2;
import org.jboss.forge.container.services.ExportedInstance;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -38,7 +36,7 @@ public static ForgeArchive getDeployment()
ExportedInterface.class,
ImplementingClass1.class,
ImplementingClass2.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
.addBeansXML();

return archive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import org.jboss.forge.container.mocks.ExportedInterface;
import org.jboss.forge.container.mocks.ImplementingClass1;
import org.jboss.forge.container.mocks.ImplementingClass2;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
Expand All @@ -34,7 +32,7 @@ public static ForgeArchive getDeployment()
ImplementingClass1.class,
ImplementingClass2.class
)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
.addBeansXML();

return archive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.forge.container.exception.ContainerException;
import org.jboss.forge.container.mocks.ServiceBean;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -26,7 +24,7 @@ public class RemoteServicesMissingTest
public static ForgeArchive getDeployment()
{
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
.addBeansXML();

return archive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -25,7 +23,7 @@ public static ForgeArchive getDeployment()
{
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class)
.addClasses(TestExtension.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
.addBeansXML()
.addAsServiceProvider(Extension.class, TestExtension.class);

return archive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.forge.container.AddonDependency;
import org.jboss.forge.container.AddonId;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -30,7 +28,7 @@ public static ForgeArchive getDeployment()
ForgeArchive archive = ShrinkWrap
.create(ForgeArchive.class)
.addClasses(ConsumingService.class, TestExtension.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
.addBeansXML()
.addAsServiceProvider(Extension.class, TestExtension.class)
.addAsAddonDependencies(AddonDependency.create(AddonId.from("dependency", "2")));

Expand All @@ -42,7 +40,7 @@ public static ForgeArchive getDependencyDeployment()
{
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class, "dependency.jar")
.addClasses(PublisherService.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
.addBeansXML();

return archive;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import org.jboss.forge.arquillian.archive.ForgeArchive;
import org.jboss.forge.container.AddonDependency;
import org.jboss.forge.container.AddonId;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -29,7 +27,7 @@ public static ForgeArchive getDeployment()
ForgeArchive archive = ShrinkWrap
.create(ForgeArchive.class)
.addClasses(EventService.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
.addBeansXML()
.addAsAddonDependencies(AddonDependency.create(AddonId.from("dependency", "1")));

return archive;
Expand All @@ -40,7 +38,7 @@ public static ForgeArchive getDependencyDeployment()
{
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class, "dependency.jar")
.addClasses(EventResponseService.class, EventPayload2.class)
.addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
.addBeansXML();

return archive;
}
Expand Down
Loading

0 comments on commit c5f47dd

Please sign in to comment.