[JBoss Portal] - JBoss portal - portlet parallel problem
by Raffaele Shmith
Raffaele Shmith [http://community.jboss.org/people/marcelloBoss] created the discussion
"JBoss portal - portlet parallel problem"
To view the discussion, visit: http://community.jboss.org/message/535940#535940
--------------------------------------------------------------
Hello,
i'm developing a portal using JBoss EPP 4.3 and i noticed that with the browser(firefox, in new tabs) parallel portlet loadings aren't accepted.
I did an experiment:
- i created portlet A that have a doView() method that need a lot of time to finish, for example 1 minute with a long query or a simple Thread.sleep().
- i created a simple hello world portlet B.
- i open the first portlet A that need a lot of time to load
- i opened a new tab with firefox and i choose the second portlet.
The loading of the second portlet start after the end of the first. If the first portlet need a lot of time, i have to wait a lot of time to see my hello world(very simple) result.
This isn't a multithreading problem because with other browser isntances pages are concurrents.
I want know if i can change something to improve my portal and avoid this problem.
I hope that you can help me!
Thank you
RM
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535940#535940]
Start a new discussion in JBoss Portal at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
[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/
h3. Additional Resources
* Making your JUnit Tests run faster in Eclipse: http://community.jboss.org/wiki/HowtoMakeYourJUnitTestsRunFasterinEclipse http://community.jboss.org/wiki/HowtoMakeYourJUnitTestsRunFasterinEclipse
--------------------------------------------------------------
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...]
16 years
Re: [jboss-user] [JBoss Tools] - Custom project templates
by Denis Golovin
Denis Golovin [http://community.jboss.org/people/dgolovin] replied to the discussion
"Custom project templates"
To view the discussion, visit: http://community.jboss.org/message/535920#535920
--------------------------------------------------------------
> Jorge Loja wrote:
>
> But I added my custom template into org.jboss.tools.common.projecttemplates_3.1.0.v201003050540R-H56-GA.jar; but when I start eclipse with -clean option or delete workspace to force to create other, do not works; the Web Developer perspective do not show me.
That's probably because you have problems in your templates version, do you have any exceptions in Error Log View?
> Jorge Loja wrote:
>
> I do not know if compile the source of JBossTools with the templates added works how I need ??
You don't need to compile anithing to get it work. Lets do that again from scratch step by step.
> Jorge Loja wrote:
>
>
> I am trying to update from JBoss Tools 3.0 to JBoss Tools 3.1 to uses JSF 2.0 support; but I have some problems because I have some custom projects templates that we use in my work; with JBoss Tools 3.0 install some custom project templates was easy *I only need to copy and modify some files to org.jboss.tools.common.projecttemplates_XXXXXX into plugins folder of eclipse*; in the JBoss Tools 3.1 I cannot do it because there is not the folder I found that all is bundle into JAR.
What kind of template files did you copy? What files were modified?
You just need to do the same modifications in project.templates bundle archive and next start your templates should be available in eclipse.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535920#535920]
Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years
[jBPM] - timer 4.3 error
by Jas Lam
Jas Lam [http://community.jboss.org/people/lamj1] created the discussion
"timer 4.3 error"
To view the discussion, visit: http://community.jboss.org/message/535918#535918
--------------------------------------------------------------
I modified the org.jbpm.examples.eventlistener jUnit test case slightly to introduce a timer as follow: the red code is the newly insert timer.
<?xml version="1.0" encoding="UTF-8"?>
<process name="EventListener" xmlns="http://jbpm.org/4.2/jpdl">
<on event="start">
<event-listener>
<field name="msg"><string value="start on process definition"/></field>
</event-listener>
</on>
<start g="17,19,48,48">
<transition to="wait"/>
</start>
<state name="wait" g="96,16,104,52">
<on event="start">
<event-listener>
<field name="msg"><string value="start on activity wait"/></field>
</event-listener>
</on>
<on event="NotifyRCP">
<timer duedate="5 seconds"/>
<event-listener>
<field name="msg"><string value="NotifyRCP"/></field>
</event-listener>
</on>
<on event="end">
<event-listener>
<field name="msg"><string value="end on activity wait"/></field>
</event-listener>
</on>
<transition to="park">
<event-listener>
<field name="msg"><string value="take transition"/></field>
</event-listener>
</transition>
</state>
<state name="park" g="231,19,80,52"/>
</process>
In the test case i just add an additional text to the expectedLogs and a sleep
public void testEventListener() {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("EventListener");
List<String> expectedLogs = new ArrayList<String>();
expectedLogs.add("start on process definition");
expectedLogs.add("start on activity wait");
expectedLogs.add("NotifyRCP");
try{ Thread.sleep(6000); } catch(Exception e){}
List<String> logs = (List<String>) executionService.getVariable(processInstance.getId(), "logs");
assertEquals(expectedLogs, logs);
Execution execution = processInstance.findActiveExecutionIn("wait");
executionService.signalExecutionById(execution.getId());
logs = (List<String>) executionService.getVariable(processInstance.getId(), "logs");
expectedLogs.add("end on activity wait");
expectedLogs.add("take transition");
assertEquals(expectedLogs, logs);
}
When I run this code the first time, it always work!!!! BUT after that I kept failing when the timer triggered!!! with the following error trace. Could some one confirm this? i tried this on two separate machine and getting the same behavior. Full source code is attached.
15:09:12,216 FIN | [ExecuteActivity] execution[EventListener.50007.wait] executes activity(wait)
[start on process definition, start on activity wait]
15:09:12,232 FIN | [HibernateSessionResource] ----- committing hibernate tx 23511316 -------------------------------------------------------
15:09:12,240 FIN | [HibernateSessionResource] ----- beginning hibernate tx 31798998 --------------------------------------------------------
15:09:12,241 FIN | [HibernateSessionResource] ----- committing hibernate tx 32102833 -------------------------------------------------------
15:09:12,242 FIN | [HibernateSessionResource] ----- beginning hibernate tx 22677439 --------------------------------------------------------
15:09:12,251 FIN | [HibernateSessionResource] ----- committing hibernate tx 32700170 -------------------------------------------------------
15:09:17,210 FIN | [HibernateSessionResource] ----- beginning hibernate tx 28678425 --------------------------------------------------------
### EXCEPTION ###########################################
15:09:17,217 SEV | [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.pvm.internal.job.TimerImpl#50012]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:56)
at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:107)
at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:64)
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:61)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at org.jbpm.pvm.internal.jobexecutor.DispatcherThread.acquireJobs(DispatcherThread.java:126)
at org.jbpm.pvm.internal.jobexecutor.DispatcherThread.run(DispatcherThread.java:67)
### EXCEPTION ###########################################
15:09:17,219 FIN | [HibernateSessionResource] ----- rolling back hibernate tx 28848200 -----------------------------------------------------
15:09:17,270 FIN | [HibernateSessionResource] ----- beginning hibernate tx 1191324 --------------------------------------------------------
Thank you in advance.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535918#535918]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
16 years