Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes some Typos in Chapter 02 #112

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
14 changes: 7 additions & 7 deletions Chapter02-EnablingTechnologies.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ _Prerequisites_

ShrinkWrap may run on any Java5 runtime or higher, but requires at least JDK6 for compilation.

The primary entry point to the ShrinkWrap library is the +org.jboss.shrinkwrap.api.ShrinkWrap+ class. From here you may call the +create+ method to make a new +Archive+, the a generic view of the virtual filesystem which allows the addition of content called +Asset+ s into a location called an +ArchivePath+. The following table more easily shows ShrinkWrap nomenclature next to more common terms:
The primary entry point to the ShrinkWrap library is the +org.jboss.shrinkwrap.api.ShrinkWrap+ class. From here you may call the +create+ method to make a new +Archive+, a generic view of the virtual filesystem which allows the addition of content called +Asset+ s into a location called an +ArchivePath+. The following table more easily shows ShrinkWrap nomenclature next to more common terms:

|=============================
|_Archive Type_|_Description_
|+org.jboss.shrinkwrap.api.GenericArchive+|Simplest type of concrete user-view of an +Archive+; supports generic operations
|+org.jboss.shrinkwrap.api.spec.JavaArchive+|JAR type; allows addition of +Class+ es, +Package+ s, and Manifest operations
|+org.jboss.shrinkwrap.api.spec.EnterpriseArchive+|Java EE EAR type; supports Manifest and related spec operations
|+org.jboss.shrinkwrap.api.spec.WebArchive+|Java EE WAR type; supports operations common to web application deployments
|+org.jboss.shrinkwrap.api.spec.ResourceAdaptorArchive+|Java EE RAR type; supports operations common to resource adaptor deployments
|+org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive+|Java EE RAR type; supports operations common to resource adapter deployments
|=============================

To create an +Archive+, simply choose your desired archive type and optionally supply a name to the static +ShrinkWrap:create+ method:
Expand Down Expand Up @@ -483,7 +483,7 @@ Let's cover some of the most popular use cases for ShrinkWrap Resolver.

===== Resolution of Artifacts Specified by Maven Coordinates

Maven coordinates, in their canonical form, are specified as following +groupId:artifactId:[packagingType:[classifier]]:version+. Often, those are referred as +G+ (groupId), +A+ (artifactId), +P+ (packagingType), +C+ (classifier) and +V+ (version). If you omit +P+ and +C+, they will get their default value, which is packaging of +jar+ and an empty classifier. ShrinWrap Resolver additionally allows you to skip +V+ in case it has version information available, that would be explained later on.
Maven coordinates, in their canonical form, are specified as following +groupId:artifactId:[packagingType:[classifier]]:version+. Often, those are referred as +G+ (groupId), +A+ (artifactId), +P+ (packagingType), +C+ (classifier) and +V+ (version). If you omit +P+ and +C+, they will get their default value, which is packaging of +jar+ and an empty classifier. ShrinkWrap Resolver additionally allows you to skip +V+ in case it has version information available, that would be explained later on.

1. The most simple use case is to resolve a file using coordinates. Here, the resolver locates an artifact defined by +G:A:V+ and resolves it including all transitive dependencies. The result is formatted as array of type +File+.
+
Expand All @@ -493,7 +493,7 @@ File[] = Maven.resolver().resolve("G:A:V").withTransitivity().asFile();
----
+

2. You might want to change default Maven behavior and resolve only artifact specified by +G:A:V+, avoiding its transitive dependencies. For this use case, ShrinkWrap Resolvers provides a shorthand for changing resolution strategy, called +withoutTransitivity()+. Additionally, you might want to return a single +File+ instead of an array.
2. You might want to change the default Maven behavior and resolve only one artifact specified by +G:A:V+, avoiding its transitive dependencies. For this use case, ShrinkWrap Resolvers provides a shorthand for changing resolution strategy, called +withoutTransitivity()+. Additionally, you might want to return a single +File+ instead of an array.
+
[source,java]
----
Expand Down Expand Up @@ -645,9 +645,9 @@ ShrinkWrap Resolvers will not consume settings.xml specified on command line (+-

While previous calls allow you to manually define what you want to resolve, in Maven projects, you have very likely specified this information already in your _pom.xml_ file. ShrinkWrap Resolver allows you to follow _DRY_ principles and it is able to load metadata included there.

ShrinkWrap Resolvers constructs so called effective POM model (simplified, that is your _pom.xml_ file plus parent hierarchy and Super POM, Maven default POM file). In order to construct the model, it uses all local repository, classpath repository and remote repositories. Once the model is loaded, you can use the metadata in there to be automatically added to artifacts to be resolved.
ShrinkWrap Resolvers constructs a so called effective POM model (simplified, that is your _pom.xml_ file plus parent hierarchy and Super POM, Maven default POM file). In order to construct the model, it uses all local repositories, the classpath repository and all remote repositories. Once the model is loaded, you can use the metadata in there to be automatically added to artifacts to be resolved.

1. Resolving an artifact with version defined in effective POM. In case, you want to resolve +G:A:V+, you can simply specify +G:A+ instead. For artifacts with non JAR packaging type or classifier, you must use alternative syntax with question mark '+?+', such as +G:A:P:?+ or +G:A:P:C:?+.
1. Resolving an artifact with the version defined in effective POM. In case, you want to resolve +G:A:V+, you can simply specify +G:A+ instead. For artifacts with non JAR packaging type or classifier, you must use an alternative syntax with question mark '+?+', such as +G:A:P:?+ or +G:A:P:C:?+.
+
[source,java]
----
Expand All @@ -658,7 +658,7 @@ Maven.resolver().loadPomFromClassLoaderResource("/path/to/pom.xml")
.resolve("G:A:P:?").withTransitivity().asFile();
----

2. Resolving artifacts defined in effective POM. ShrinkWrap Resolvers allows you to artifacts defined with specific scope into list of artifacts to be resolved. This way, you don't need to alter your tests if you change dependencies of your application. You can either use +importDependencies(ScopeType...)+ or convenience methods, that cover the most frequent usages (+importRuntimeDependencies()+, +importTestDependencies()+ and +importRuntimeAndTestDependencies()+:
2. Resolving artifacts defined in effective POM. ShrinkWrap Resolvers allows you to import artifacts defined with a specific scope into the list of artifacts to be resolved. This way, you don't need to alter your tests if you change dependencies of your application. You can either use +importDependencies(ScopeType...)+ or convenience methods, that cover the most frequent usages (+importRuntimeDependencies()+, +importTestDependencies()+ and +importRuntimeAndTestDependencies())+:
+
[source,java]
----
Expand Down
2 changes: 1 addition & 1 deletion Chapter04-RequirementsAndExampleApplication.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ image:images/ch04-requirements_example_app/clone.png["GitHub URI to Clone"]
Then simply move to a directory in which you'd like to place your local clone, and issue the +git clone+ command, passing in the URI to your GitHub repository. For instance:

----
$> git clone [email protected]:ALRubinger/continuous-enterprise-development.git
$> git clone [email protected]:arquillian/continuous-enterprise-development.git
Cloning into 'continuous-enterprise-development'...
remote: Counting objects: 2661, done.
remote: Compressing objects: 100% (1170/1170), done.
Expand Down
12 changes: 12 additions & 0 deletions code/application/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>httpmime</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import java.util.concurrent.TimeUnit;

import org.jboss.arquillian.core.spi.LoadableExtension;
import org.jboss.arquillian.drone.spi.Enhancer;
import org.jboss.arquillian.drone.spi.DroneInstanceEnhancer;
import org.jboss.arquillian.drone.spi.InstanceOrCallableInstance;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -16,10 +17,10 @@ public class AngularJSDroneExtension implements LoadableExtension {

@Override
public void register(ExtensionBuilder builder) {
builder.service(Enhancer.class, AngularJSEnhancer.class);
builder.service(DroneInstanceEnhancer.class, AngularJSEnhancer.class);
}

public static class AngularJSEnhancer implements Enhancer<WebDriver> {
public static class AngularJSEnhancer implements DroneInstanceEnhancer<WebDriver> {

private WebDriverEventListener listener;

Expand All @@ -29,8 +30,9 @@ public int getPrecedence() {
}

@Override
public boolean canEnhance(Class<?> type, Class<? extends Annotation> qualifier) {
return WebDriver.class.isAssignableFrom(type);
public boolean canEnhance(InstanceOrCallableInstance instance,
Class<?> droneType, Class<? extends Annotation> qualifier) {
return WebDriver.class.isAssignableFrom(droneType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cedj.geekseek.test.functional.arquillian.ArquillianSuiteExtension
cedj.geekseek.test.functional.arquillian.AngularJSDroneExtension
org.cedj.geekseek.test.functional.arquillian.ArquillianSuiteExtension
org.cedj.geekseek.test.functional.arquillian.AngularJSDroneExtension
8 changes: 4 additions & 4 deletions code/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@

<version.arquillian_core>1.1.1.Final</version.arquillian_core>
<version.arquillian_persistence>1.0.0.Alpha6</version.arquillian_persistence>
<version.arquillian_drone>1.2.0.Beta2</version.arquillian_drone>
<version.arquillian_graphene>2.0.0.Beta2</version.arquillian_graphene>
<version.arquillian_drone>1.2.1.Final</version.arquillian_drone>
<version.arquillian_graphene>2.0.0.Final</version.arquillian_graphene>
<version.arquillian_warp>1.0.0.Beta1-SNAPSHOT</version.arquillian_warp>
<version.arquillian_warp_rest>1.0.0.Final-SNAPSHOT</version.arquillian_warp_rest>
<version.arquillian_qunit>1.0.0.Alpha1</version.arquillian_qunit>
<version.restassured>1.8.1</version.restassured>
<version.wildfly>8.0.0.Beta1</version.wildfly>
<version.restassured>2.3.0</version.restassured>
<version.wildfly>8.0.0.Final</version.wildfly>
<version.jboss_as>7.1.1.Final</version.jboss_as>
<version.jboss_eap>7.2.0.Final</version.jboss_eap>
<version.jboss_eap_managed>eap-6.1.0</version.jboss_eap_managed>
Expand Down
36 changes: 36 additions & 0 deletions code/application/service/security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven-archive</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>httpmime</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.descriptors</groupId>
Expand All @@ -127,6 +145,24 @@
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>httpmime</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpcore</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents</groupId>
</exclusion>
<exclusion>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TwitterAuthLoginTestCase {
@Deployment(testable = false)
public static WebArchive deploy() {
return ShrinkWrap.create(WebArchive.class)
//.addAsResource("auth.properties")
.addAsResource("Twitter.properties")
.addPackages(false,
AuthServlet.class.getPackage(),
OAuthAuthenticator.class.getPackage(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.cedj.geekseek.service.security.test.model.SetupAuth;
import org.cedj.geekseek.service.security.test.model.TestApplication;
import org.cedj.geekseek.service.security.test.model.TestCurrentUserProducer;
import org.cedj.geekseek.service.security.test.model.TestUserRepository;
import org.cedj.geekseek.web.rest.core.test.integration.RestCoreDeployments;
import org.cedj.geekseek.web.rest.user.test.integration.UserRestDeployments;
import org.jboss.arquillian.container.test.api.Deployment;
Expand All @@ -40,7 +41,8 @@ public static WebArchive deploy() {
WhoAmIResource.class,
SetupAuth.class,
TestApplication.class,
TestCurrentUserProducer.class)
TestCurrentUserProducer.class,
TestUserRepository.class)
.addAsLibraries(RestCoreDeployments.root())
.addAsLibraries(UserDeployments.domain())
.addAsLibraries(UserRestDeployments.module())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.cedj.geekseek.service.security.test.model;

import org.cedj.geekseek.domain.Repository;
import org.cedj.geekseek.domain.user.model.User;

public class TestUserRepository implements Repository<User> {

@Override
public Class<User> getType() {
return null;
}

@Override
public User store(User entity) {
return null;
}

@Override
public User get(String id) {
return null;
}

@Override
public void remove(User entity) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.STEPS;

import java.io.File;
import java.net.InetAddress;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
Expand All @@ -22,7 +21,7 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.arquillian.container.ManagementClient;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.operations.common.Util;
import org.jboss.dmr.ModelNode;
Expand Down Expand Up @@ -61,7 +60,8 @@ public static WebArchive getApplicationDeployment() {
addClasses(SMTPMailService.class, MailMessageBuilder.class,
SMTPMailServiceConstants.class, SMTPMessageConsumer.class, SMTPServerService.class)
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsWebInfResource("META-INF/geekseek-smtp-queue-jms.xml");
.addAsWebInfResource("META-INF/geekseek-smtp-queue-jms.xml")
.addClass(ManagementClient.class);
System.out.println(war.toString(true));
return war;
}
Expand Down Expand Up @@ -93,15 +93,15 @@ public static WebArchive getApplicationDeployment() {
@RunAsClient
@InSequence(value = 1)
@Test
public void configureAppServer() throws Exception {
public void configureAppServer(@ArquillianResource ManagementClient managementClient) throws Exception {

/*
* First configure a JavaMail Session for the Server to bind into JNDI; this
* will be used by our MailService EJB. In a production environment, we'll likely have configured
* the server before it was started to point to a real SMTP server
*/

final ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getLoopbackAddress(), 9999);
final ModelControllerClient client = managementClient.getControllerClient();

final ModelNode composite = Util.getEmptyOperation(COMPOSITE, new ModelNode());
final ModelNode steps = composite.get(STEPS);
Expand Down Expand Up @@ -135,8 +135,6 @@ public void configureAppServer() throws Exception {

System.out.println("Configure mail service :" + client.execute(composite));

client.close();

/*
* With the config all set and dependencies in place, now we can deploy
*/
Expand All @@ -148,9 +146,9 @@ public void configureAppServer() throws Exception {
@RunAsClient
@InSequence(value = 3)
@Test
public void resetAppServerConfig()
public void resetAppServerConfig(@ArquillianResource ManagementClient managementClient)
throws Exception {
final ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getLoopbackAddress(), 9999);
final ModelControllerClient client = managementClient.getControllerClient();

deployer.undeploy(DEPLOYMENT_NAME);

Expand All @@ -175,8 +173,6 @@ public void resetAppServerConfig()
// Find from the WildFly team a better notification mechanism upon which to wait
// https://github.com/arquillian/continuous-enterprise-development/issues/66
//no longer needed since WildFly 8 CR1

client.close();
}

/*
Expand Down