BAEL-317 - Added junit and surefire, updated the authentication info so that it fits the article

This commit is contained in:
slavisa-baeldung 2016-11-16 07:21:01 +01:00
parent 35ee1b89bb
commit 0262d2728f
5 changed files with 55 additions and 34 deletions

View File

@ -10,6 +10,10 @@
<artifactId>ejb-client</artifactId> <artifactId>ejb-client</artifactId>
<name>EJB3 Client Maven</name> <name>EJB3 Client Maven</name>
<description>EJB3 Client Maven</description> <description>EJB3 Client Maven</description>
<properties>
<junit.version>4.12</junit.version>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -23,6 +27,28 @@
<artifactId>ejb-remote</artifactId> <artifactId>ejb-remote</artifactId>
<type>ejb</type> <type>ejb</type>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EJBSetupTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -55,8 +55,8 @@ public class EJBClient {
prop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); prop.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
prop.put(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080"); prop.put(Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");
prop.put(Context.SECURITY_PRINCIPAL, "pritamtest"); prop.put(Context.SECURITY_PRINCIPAL, "testUser");
prop.put(Context.SECURITY_CREDENTIALS, "iamtheki9g"); prop.put(Context.SECURITY_CREDENTIALS, "admin1234!");
prop.put("jboss.naming.client.ejb.context", false); prop.put("jboss.naming.client.ejb.context", false);
context = new InitialContext(prop); context = new InitialContext(prop);

View File

@ -4,5 +4,5 @@ remote.connection.default.port=8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT=false
remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=${host.auth:JBOSS-LOCAL-USER} remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=${host.auth:JBOSS-LOCAL-USER}
remote.connection.default.username=pritamtest remote.connection.default.username=testUser
remote.connection.default.password=iamtheki9g remote.connection.default.password=admin1234!

View File

@ -28,8 +28,8 @@
<configuration> <configuration>
<hostname>127.0.0.1</hostname> <hostname>127.0.0.1</hostname>
<port>9990</port> <port>9990</port>
<username>pritamtest</username> <username>testUser</username>
<password>iamtheki9g</password> <password>admin1234!</password>
<filename>${build.finalName}.jar</filename> <filename>${build.finalName}.jar</filename>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -1,15 +1,10 @@
package com.baeldung.ejb.tutorial; package com.baeldung.ejb.tutorial;
import javax.annotation.Resource;
import javax.ejb.SessionContext;
import javax.ejb.Stateless; import javax.ejb.Stateless;
@Stateless(name = "HelloWorld") @Stateless(name = "HelloWorld")
public class HelloWorldBean implements HelloWorld { public class HelloWorldBean implements HelloWorld {
@Resource
private SessionContext context;
@Override @Override
public String getHelloWorld() { public String getHelloWorld() {
return "Welcome to EJB Tutorial!"; return "Welcome to EJB Tutorial!";