BAEL-8874 Merge ejb projects
-Merged ejb and spring-ejb modules into spring-ejb
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-ejb-remote</artifactId>
|
||||
<packaging>ejb</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung.spring.ejb</groupId>
|
||||
<artifactId>spring-ejb</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax</groupId>
|
||||
<artifactId>javaee-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>${assertj.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<profiles>
|
||||
<!-- mvn clean package cargo:run -Pwildfly-standalone -->
|
||||
<profile>
|
||||
<id>wildfly-standalone</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>${cargo-maven2-plugin.version}</version>
|
||||
|
||||
<configuration>
|
||||
|
||||
<container>
|
||||
<containerId>wildfly10x</containerId>
|
||||
<zipUrlInstaller>
|
||||
<url>http://download.jboss.org/wildfly/12.0.0.Final/wildfly-12.0.0.Final.zip</url>
|
||||
</zipUrlInstaller>
|
||||
</container>
|
||||
|
||||
<configuration>
|
||||
<properties>
|
||||
<cargo.hostname>127.0.0.1</cargo.hostname>
|
||||
<cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
|
||||
<cargo.jboss.management-http.port>9990</cargo.jboss.management-http.port>
|
||||
<cargo.servlet.users>testUser:admin1234!</cargo.servlet.users>
|
||||
</properties>
|
||||
</configuration>
|
||||
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<!--mvn clean install wildfly:deploy -Pwildfly-runtime -->
|
||||
<profile>
|
||||
<id>wildfly-runtime</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.wildfly.plugins</groupId>
|
||||
<artifactId>wildfly-maven-plugin</artifactId>
|
||||
<version>${wildfly-maven-plugin.version}</version>
|
||||
<configuration>
|
||||
<hostname>127.0.0.1</hostname>
|
||||
<port>9990</port>
|
||||
<username>testUser</username>
|
||||
<password>admin1234!</password>
|
||||
<filename>${project.build.finalName}.jar</filename>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<properties>
|
||||
<assertj.version>3.9.0</assertj.version>
|
||||
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
||||
<wildfly-maven-plugin.version>1.1.0.Alpha5</wildfly-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface HelloStatefulWorld {
|
||||
|
||||
int howManyTimes();
|
||||
String getHelloWorld();
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import javax.ejb.Stateful;
|
||||
|
||||
@Stateful(name = "HelloStatefulWorld")
|
||||
public class HelloStatefulWorldBean implements HelloStatefulWorld {
|
||||
|
||||
private int howManyTimes = 0;
|
||||
|
||||
public int howManyTimes() {
|
||||
return howManyTimes;
|
||||
}
|
||||
|
||||
public String getHelloWorld() {
|
||||
howManyTimes++;
|
||||
return "Hello Stateful World!";
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface HelloStatelessWorld {
|
||||
|
||||
String getHelloWorld();
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
@Stateless(name = "HelloStatelessWorld")
|
||||
public class HelloStatelessWorldBean implements HelloStatelessWorld {
|
||||
|
||||
public String getHelloWorld() {
|
||||
return "Hello Stateless World!";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface HelloWorld {
|
||||
String getHelloWorld();
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.ejb.SessionContext;
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
@Stateless(name = "HelloWorld")
|
||||
public class HelloWorldBean implements HelloWorld {
|
||||
|
||||
@Resource
|
||||
private SessionContext context;
|
||||
|
||||
@Override
|
||||
public String getHelloWorld() {
|
||||
return "Welcome to EJB Tutorial!";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.baeldung.ejb.wildfly;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
@Stateless
|
||||
public class TextProcessorBean implements TextProcessorRemote {
|
||||
public String processText(String text) {
|
||||
return text.toUpperCase();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.baeldung.ejb.wildfly;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
|
||||
@Remote
|
||||
public interface TextProcessorRemote {
|
||||
|
||||
String processText(String text);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ejb-jar xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd"
|
||||
version="3.2">
|
||||
<module-name>spring-ejb-remote</module-name>
|
||||
</ejb-jar>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class HelloStatefulWorldTestUnitTest {
|
||||
|
||||
private HelloStatefulWorldBean statefulBean;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
statefulBean = new HelloStatefulWorldBean();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenGetHelloWorld_thenHelloStatefulWorldIsReturned() {
|
||||
String helloWorld = statefulBean.getHelloWorld();
|
||||
|
||||
assertThat(helloWorld).isEqualTo("Hello Stateful World!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenGetHelloWorldIsCalledTwice_thenCounterIs2() {
|
||||
statefulBean.getHelloWorld();
|
||||
statefulBean.getHelloWorld();
|
||||
|
||||
assertThat(statefulBean.howManyTimes()).isEqualTo(2);
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.baeldung.ejb.tutorial;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class HelloStatelessWorldTestUnitTest {
|
||||
|
||||
private HelloStatelessWorldBean statelessBean;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
statelessBean = new HelloStatelessWorldBean();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenGetHelloWorld_thenHelloStatelessWorldIsReturned() {
|
||||
String helloWorld = statelessBean.getHelloWorld();
|
||||
|
||||
assertThat(helloWorld).isEqualTo("Hello Stateless World!");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user