Sunday, October 8, 2017

Wildfly quickstarts part 1

git clone https://github.com/wildfly/quickstart

helloworld


https://github.com/wildfly/quickstart/tree/11.x/helloworld technologies=CDI,Servlet

http://localhost:8080/helloworld

@javax.inject.Inject
mvn wildfly:deploy
mvn wildfly:undeploy
mvn dependency:sources


helloworld-ws


https://github.com/wildfly/quickstart/tree/11.x/helloworld-ws technologies=JAX-WS has Arquillan tests

http://localhost:8080/helloworld-ws/

#to run arquillan tests
mvn clean verify -Parq-remote

@javax.jws.WebService
@javax.jws.WebMethod

javax.xml.ws.Service

https://github.com/jboss-developer/jboss-developer-shared-resources/blob/master/guides/RUN_ARQUILLIAN_TESTS.md#run-the-arquillian-tests



helloworld-rs


https://github.com/wildfly/quickstart/tree/11.x/helloworld-rf technologies=CDI,JAX-RS


http://localhost:8080/helloworld-rs/rest/json


javax.ws.rs.core.Application
javax.ws.rs.ApplicationPath @ApplicationPath("rest")
javax.ws.rs.GET
javax.ws.rs.Path
javax.ws.rs.Produces @Produces({ "application/json" }) @Produces({ "application/xml" })
javax.inject.Inject



helloworld-singleton


https://github.com/wildfly/quickstart/tree/11.x/helloworld-singleton technologies=EJB,Singleton,JSF

http://localhost:8080/helloworld-singleton

javax.ejb.Singleton
javax.inject.Named

@Named = @Component in Spring. @Inject = @Autowired in Spring


helloworld-ssl


https://github.com/wildfly/quickstart/tree/11.x/helloworld-ssl technologies: SSL,Undertow


http://localhost:8443/helloworld-ssl/HelloWorld


helloworld-mutual-ssl-secured


https://github.com/wildfly/quickstart/tree/11.x/helloworld-mutual-ssl-secured technologies=Mutual SSL, Security, Undertow

BTW it's very similar to helloworld-mutual-ssl

helloworld-classfiletransformer


https://github.com/wildfly/quickstart/tree/11.x/helloworld-classfiletransformer technologies: EJB, javassist it's about byte code manipulation and intercepting method calls

javax.ejb.Stateless
javax.annotation.security.PermitAll


helloworld-html5


https://github.com/wildfly/quickstart/tree/11.x/helloworld-html5 Technologies: CDI, JAX-RS, HTML5

http://localhost:8080/helloworld-html5/

curl -i -X POST http://localhost:8080/helloworld-html5/hello/json/pierluigi
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    29  100    29    0     0     29      0  0:00:01 --:--:--  0:00:01   142HTTP/1.1 200 OK
Connection: keep-alive
X-Powered-By: Undertow/1
Server: WildFly/11
Content-Type: application/json
Content-Length: 29
Date: Sat, 07 Oct 2017 21:36:41 GMT

JQuery
javax.ws.rs.PathParam


remarkable the Arquillan functional tests to be found in the embedded helloworld-html5-test-webdriver https://github.com/wildfly/quickstart/tree/11.x/helloworld-html5/functional-tests

mvn clean verify -Parq-remote // to run tests on an already started remote server
mvn clean verify -Parq-managed // to start a server and run tests in it

tests will probably fail because they take too long...



helloworld-jms


https://github.com/wildfly/quickstart/tree/11.x/helloworld-jms Technologies: JMS


javax.jms.ConnectionFactory;
javax.jms.Destination;
javax.jms.JMSConsumer;
javax.jms.JMSContext;
javax.naming.Context;
javax.naming.InitialContext;
javax.naming.NamingException;


org.wildfly.naming.client.WildFlyInitialContextFactory

Since the JBoss console doesn't have a tool to browse JMS queues (WebLogic console is sooo much better) one can use HermesJMS or this little tool http://www.mastertheboss.com/jboss-server/jboss-jms/a-jms-browser-for-jboss-wildfly available here https://github.com/fmarchioni/mastertheboss/tree/master/JMSBrowser

git clone https://github.com/fmarchioni/mastertheboss.git
cd mastertheboss/JMSBrowser
mvn clean install wildfly:deploy

and then http://localhost:8080/JMSBrowser/ (in my case, it can't find the test queue, no idea why)

HermesJMS really stinks and I can't make it works (maybe not meant to run with Java 8)... another tools is jmstoolbox https://sourceforge.net/projects/jmstoolbox/files/v4.4/



helloworld-mbean


https://github.com/wildfly/quickstart/tree/11.x/helloworld-mbean Technologies: CDI, JMX, MBean

http://localhost:8080/helloworld-mbean-webapp

javax.enterprise.inject.spi.BeanManager
javax.enterprise.inject.spi.BeforeBeanDiscovery
javax.enterprise.inject.spi.Extension
javax.enterprise.inject.spi.Bean
javax.enterprise.event.Observes

javax.enterprise.context.spi.CreationalContext
java.lang.management.ManagementFactory
javax.annotation.PostConstruct
javax.annotation.PreDestroy
javax.management.MBeanServer
javax.management.ObjectName


helloworld-mdb


http://localhost:8080/helloworld-mdb/HelloWorldMDBServletClient


javax.jms.JMSDestinationDefinition
javax.jms.JMSDestinationDefinitions https://docs.oracle.com/javaee/7/api/javax/jms/JMSDestinationDefinition.html

javax.servlet.annotation.WebServlet http://docs.oracle.com/javaee/7/api/javax/servlet/annotation/WebServlet.html


javax.annotation.Resource
javax.ejb.MessageDriven
javax.jms.Message
javax.jms.MessageListener
javax.ejb.ActivationConfigProperty


helloworld-mdb-propertysubstitution


https://github.com/wildfly/quickstart/tree/11.x/helloworld-mdb-propertysubstitution Technologies: JMS, EJB, MDB

http://localhost:8080/helloworld-mdb-propertysubstitution/HelloWorldMDBServletClient

about "MDB annotation property substitution" :
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.3/html/Development_Guide/Enable_EJB_and_MDB_Property_Substitution_in_an_Application.html



the MDB connection properties are given in the standalone.xml in the system-properties, and you use variable substitution
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "${property.helloworldmdb.queue}")







No comments: