[JBoss Tools] - Test Driven Development (TDD) and Moving Forward with Less Technical Debt
by Brian Fitzpatrick
Brian Fitzpatrick [http://community.jboss.org/people/bfitzpat] modified the document:
"Test Driven Development (TDD) and Moving Forward with Less Technical Debt"
To view the document, visit: http://community.jboss.org/docs/DOC-15096
--------------------------------------------------------------
Note: This is a work in progress, not gospel. So know that it will most likely change over time. :)
h2. Overview
Before we get into TDD and how it will eventually make our lives easier once we adjust to using it, I want to go over a bit of what we do now.
Right now we use the traditional waterfall type of pattern...
Design -> Implement -> Test
And this works, but all too often we skip the last step because we're out of time or have to fix something someone else found. Testing shouldn't be a skippable step, but it ends up that way far too often.
By pushing tests to the end of the process and then not getting them done, we end up with painful test cycles with QA and the field as we've been doing the last few releases. As a result, we end up with a pile of technical debt - bugs start to pile up as QA reports them, incompatibilities with previous releases creep in,and so on...
h2. Test Driven Development (TDD)
Instead, we should be using the TDD model, which changes the pattern a bit...
Design -> Test -> Implement -> Test -> Implement -> and so on
By building the tests into the pattern earlier, we should reduce the frequency of having to go back in and fix bugs later because we're testing as we go and creating more stable code all the way along.
How this works is something like this (for new features):
1) Design: Figure out what you want to do
2) Test: Write a test to express the design
* IT SHOULD FAIL
3) Implement: Write the code
4) Test again
* IT SHOULD PASS
For bug fixes, it's a little different:
1) Get some sample code (that breaks)
2) Turn it into a test
* IT SHOULD FAIL
3) Fix the bug
4) Test again
* IT SHOULD PASS
These patterns should be used for all bug fixes and new features we implement from now on. And it's not going to be easy to get used to this model for some of us, but it will get easier with time and practice.
Hopefully by writing more of this type of focused unit test, we:
* Write tests once
* Keep them somewhere sensible (like a separate plug-in with the name ".test" appended to the end)
* Run frequently (one click) as a developer and run tests as part of every build
* Don't require human input (which makes tests faster)
* And we provide machine-parsable output like JUnit logs that say whether a test passed/failed
The benefits are many, but they boil down to two main ones:
* We get tests as part of the process, rather than an afterthought.
* We get more stable code.
h2. Moving Forward...
Now how are we going to do this in Eclipse?
Well, we're going to use JUnit or testNG (until a decision is made, focus on JUnit) as much as possible to test the underlying code. The tests should be specific to a particular problem and run quickly. Use mock objects where possible to mock up whatever you need, reducing the runtime dependencies.
It's been suggested that we use Mockito, JMock, or testNG + PowerMock to handle testing with mock objects.
Once we've tested as much as we can of the frameworks, APIs, and underlying code with JUnit, we should look at building a suite of SWTBot tests.
The SWTBot tests should not only test individual bits of functionality, such as clicking this button should generate this result, but should also start focusing on specific use cases and doing more end to end testing. These two types of tests should be kept separate.
So we're looking at three types of tests:
* JUnit Tests and Test Suites
* SWTBot functional tests
* SWTBot integration tests
The first two types of tests should be run as a regular part of the nightly builds. And the integration tests should probably be run weekly as part of the weekly integration builds to make sure nothing was broken.
h2. Interesting Testing Resources for Reading...
* TestNG + Eclipse: http://testng.org/eclipse.html http://testng.org/eclipse.html
* TestNG - Migrating from JUnit: http://testng.org/migrating.html http://testng.org/migrating.html
* TestNG + Maven: http://testng.org/maven.html http://testng.org/maven.html
* TestNG + PowerMock: http://blog.jayway.com/2009/12/14/powermock-testng-true/ http://blog.jayway.com/2009/12/14/powermock-testng-true/
* More TestNG Reading: http://testng.org/misc.html http://testng.org/misc.html
* JUnit4 vs. TestNG comparison: http://www.mkyong.com/unittest/junit-4-vs-testng-comparison/ http://www.mkyong.com/unittest/junit-4-vs-testng-comparison/
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15096]
Create a new document in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years
[Beginner's Corner] - Expected 404 got a blank page.
by Nathan Tribble
Nathan Tribble [http://community.jboss.org/people/ntribble] created the discussion
"Expected 404 got a blank page."
To view the discussion, visit: http://community.jboss.org/message/535275#535275
--------------------------------------------------------------
Hi all,
I'm setting up a virtual host everything seems to be working, except, only the default host in the jbossweb.sar/server.xml
<Engine name="jboss.web" defaultHost="host1">
<Host name="host1" autoDeploy="false" deployOnStartup="false" deployXML="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" prefix="host1-" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/>
</Host>
setup thusly is showing any HTTP status pages.
I have another host set up
<Host name="host2" autoDeploy="false" deployOnStartup="false" deployXML="false">
<Valve className="org.apache.catalina.valves.AccessLogValve" prefix="host2-" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/>
</Host>
and when I navigate to a path that doesn't exist on this host all I get is a blank page, no 404 like I get if I navigate to a non existant path on the defaultHost.
I'm running Ubuntu 9.10 in my /etc/hosts file I have
192.168.1.213 host1 host2
I'm using Jboss AS 5.1.0.GA
started with
./run.sh -c dev-web -b 192.168.1.213
keep in mind that applications I have deployed to the two virtual hosts are working fine, just when I navigate to a non existant app on host2 I just get a blank page, where if I navigate to a non existant app on host1 I get the Jboss HTTP Status 404 page.
Did I miss setting something up that would let the non defaultHost display Status Pages? Or is what I'm expecting not possible? Any help would be greatly appreciated. Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535275#535275]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years
[jBPM] - Trouble parsing jbpm.cfg.xml
by Rachel Hodos
Rachel Hodos [http://community.jboss.org/people/rhodos] created the discussion
"Trouble parsing jbpm.cfg.xml"
To view the discussion, visit: http://community.jboss.org/message/535269#535269
--------------------------------------------------------------
Hi,
I'm trying to run jBOSS jBPM 4.3 with the default configuration and am getting the error shown below. It seems to have trouble with jbpm.cfg.xml; but I can't tell if the file is in the wrong place, or if something else is wrong.
log4j:WARN No appenders found for logger (org.jbpm.test.BaseJbpmTestCase).
log4j:WARN Please initialize the log4j system properly
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.jbpm.pvm.internal.cfg.ConfigurationParser.<init>(ConfigurationParser.java:46)
at org.jbpm.pvm.internal.cfg.ConfigurationParser.<clinit>(ConfigurationParser.java:49)
at org.jbpm.pvm.internal.cfg.ConfigurationImpl.parse(ConfigurationImpl.java:139)
at org.jbpm.pvm.internal.cfg.ConfigurationImpl.setResource(ConfigurationImpl.java:118)
at org.jbpm.pvm.internal.cfg.ConfigurationImpl.setResource(ConfigurationImpl.java:52)
at org.jbpm.api.Configuration.setResource(Configuration.java:74)
at org.jbpm.api.Configuration.getProcessEngine(Configuration.java:121)
at org.jbpm.test.JbpmTestCase.initialize(JbpmTestCase.java:83)
at org.jbpm.test.JbpmTestCase.setUp(JbpmTestCase.java:78)
at jpl.mipl.pgs.test.ConcurrencyTest.setUp(ConcurrencyTest.java:21)
at jpl.mipl.pgs.test.ConcurrencyTest.main(ConcurrencyTest.java:57)
Caused by: org.jbpm.api.JbpmException:
error: couldn't parse xml document : org.apache.crimson.tree.DomEx: NAMESPACE_ERR: Attempt to create or change an object in a way which is incorrect with regard to namespaces.
at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:175)
at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:141)
at org.jbpm.pvm.internal.xml.Parse.checkErrors(Parse.java:190)
at org.jbpm.pvm.internal.wire.xml.WireParser.<clinit>(WireParser.java:284)
... 11 more
Caused by: org.jbpm.api.JbpmException
at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:171)
... 14 more
Caused by: org.apache.crimson.tree.DomEx: NAMESPACE_ERR: Attempt to create or change an object in a way which is incorrect with regard to namespaces.
at org.apache.crimson.tree.ElementNode2.checkArguments(ElementNode2.java:182)
at org.apache.crimson.tree.XmlDocument.createElementNS(XmlDocument.java:844)
at org.apache.crimson.tree.DOMImplementationImpl.createDocument(DOMImplementationImpl.java:142)
at org.jbpm.pvm.internal.xml.Parser.buildDom(Parser.java:442)
at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:389)
at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:158)
... 12 more
Has anyone else encountered this?
Thanks!
Rachel
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535269#535269]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years
Re: [jboss-user] [JBoss Messaging Development] - Problem integrating Weblogic 8.1 JMS with Jboss 5.1
by rajsoni
rajsoni [http://community.jboss.org/people/rajsoni] replied to the discussion
"Problem integrating Weblogic 8.1 JMS with Jboss 5.1"
To view the discussion, visit: http://community.jboss.org/message/535265#535265
--------------------------------------------------------------
sure..np....Here you go....:
jms-ds.xml:
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<!-- ==================================================================== -->
<!-- JMS Stuff -->
<!-- ==================================================================== -->
<!--
The JMS provider loader. Currently pointing to a non-clustered ConnectionFactory. Need to
be replaced with a clustered non-load-balanced ConnectionFactory when it becomes available.
See http://jira.jboss.org/jira/browse/JBMESSAGING-843 http://jira.jboss.org/jira/browse/JBMESSAGING-843.
-->
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.messaging:service=JMSProviderLoader,name=JMSProvider">
<attribute name="ProviderName">DefaultJMSProvider</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
<!-- <attribute name="QueueFactoryRef">weblogicjms</attribute>
<attribute name="TopicFactoryRef">weblogicjms</attribute>-->
<attribute name="FactoryRef">XAConnectionFactory</attribute>
<attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
<attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
<attribute name="Properties">
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://linux-soni.dev.themunicenter.com:7001
java.naming.security.authentication=none
</attribute>
</mbean>
<no-tx-connection-factory>
<jndi-name>CFX/ExternalConnectionFactory</jndi-name>
<xa-transaction />
<track-connection-by-tx />
<rar-name>sun-jms-adapter.rar</rar-name>
<!-- <connection-definition>javax.jms.QueueConnectionFactory </connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property> -->
<connection-definition>javax.jms.TopicConnectionFactory </connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<config-property name="Destination" type="java.lang.String">javax.jms.Destination</config-property>
<config-property name="ConnectionURL" type="java.lang.String"><![CDATA[t3://10.9.10.164:7001/?JMSJCA.WLFACTORY=TOPIC.MARKUPMARKET&prefix=jms/destinations;JMSJCA.NoXA=true]]></config-property>
<min-pool-size>1</min-pool-size>
<max-pool-size>200</max-pool-size>
<blocking-timeout-millis>30000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>
</no-tx-connection-factory>
</connection-factories
Change to queue or topic as per your need...above...:
Change in MDB : jboss.xml:
<?xml version="1.0"?>
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 5.0//EN"
" http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd http://www.jboss.org/j2ee/dtd/jboss_5_0.dtd">
<jboss>
<enterprise-beans>
<message-driven>
<ejb-name>MktMessageProcessorMDB</ejb-name>
<destination-jndi-name>java:/CFX/ExternalConnectionFactory</destination-jndi-name>
<local-jndi-name>local/MktMessageProcessorMDB</local-jndi-name>
<resource-adapter-name>sun-jms-adapter.rar</resource-adapter-name>
<configuration-name>JMSJCA Message Driven Bean</configuration-name>
</message-driven>
<invoker-proxy-bindings>
<invoker-proxy-binding>
<name>jmsjca-message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory</proxy-factory>
<proxy-factory-config>
<activation-config>
<activation-config-property>
<activation-config-property-name>providerAdapterJNDI</activation-config-property-name>
<activation-config-property-value>java:/DefaultJMSProvider</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>ConnectionURL</activation-config-property-name>
<activation-config-property-value>t3://linux-soni.dev.themunicenter.com:7001</activation-config-property-value>
</activation-config-property>
</activation-config>
<endpoint-interceptors>
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</endpoint-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
</invoker-proxy-bindings>
<container-configurations>
<container-configuration>
<container-name>JMSJCA Message Driven Bean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>jmsjca-message-driven-bean</invoker-proxy-binding-name>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
<!-- CMT -->
<interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<!-- BMT -->
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
</container-configuration>
</container-configurations>
</jboss>
ejb-jar.xml:
<?xml version="1.0"?>
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>MktMessageProcessorMDB</ejb-name>
<ejb-class>com.muni.core.messaging.mktmessageprocessor.MktMessageProcessorBean</ejb-class>
<transaction-type>Bean</transaction-type>
<acknowledge-mode>auto-acknowledge</acknowledge-mode>
<activation-config>
<activation-config-property>
<activation-config-property-name>concurrencyMode</activation-config-property-name>
<activation-config-property-value>cc</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>endpointPoolMaxSize</activation-config-property-name>
<activation-config-property-value>10</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>TOPIC.MARKUPMARKET</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>contextName</activation-config-property-name>
<activation-config-property-value>XContextName</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535265#535265]
Start a new discussion in JBoss Messaging Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years
[JBoss Tools] - Notes about Tycho on JBoss Tools
by Max Andersen
Max Andersen [http://community.jboss.org/people/max.andersen%40jboss.com] modified the document:
"Notes about Tycho on JBoss Tools"
To view the document, visit: http://community.jboss.org/docs/DOC-15095
--------------------------------------------------------------
h2. History
Devox 2009 - Max made first weird attempt at creating a scala script to generate pom, but bugs in Tycho and cyclic dependencies made it impossible to do "the easy way"
EclipseCon 2010 - Tycho 0.8 came out and we had a hack-a-thon to try break our monolith build.
h2. Status
https://svn.jboss.org/repos/jbosstools/branches/modular_build https://svn.jboss.org/repos/jbosstools/branches/modular_build contains the current work.
Has a parent-pom.xml for setting up Tycho and repositories.
Has scala script genpom.scala which currently automagically generates the proper pom.xml's based on our standard jboss tools plugin layot. Eventually these should be materialized and committed but for now it allows for rapid prototyping until we got it all working.
The build requires maven 3.
After doing scala genpom.xml you should (in theory) be able to run mvn install in any level. Right now only plugins/features works consistently :)
h2. Tidbits
Tycho uses surefire which picks up unittests which has "Test" somewhere in the name. Causing problems since we got Tests that aren't tests and AllTests which includes subtests.
What Maven group id should we be using ? Right now org.jboss.tools.* is the base.
How do we ensure the version in manifest.mf etc. are in sync with reality ? Some way for us to compare against latest JBDS/JBT 3 to ensure at least in sync ?
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15095]
Create a new document in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years