-
1. Re: Deployers Ordering
ropalka Jun 24, 2009 9:16 AM (in response to ropalka)And I'd expect the following test to pass:
---
public void testWebServicesDeployersOrder() throws Exception
{
DeployerClient main = createMainDeployer();
TestFlowDeployer deployer1 = new TestFlowDeployer("FakeDeployer");
deployer1.setOutputs("WebServicesMetaData", "WebServiceDeployment", "JBossWebMetaData" );
addDeployer(main, deployer1);
TestFlowDeployer deployer2 = new TestFlowDeployer("WebServicesDeploymentTypeDeployer");
deployer2.setInputs("WebServicesMetaData", "WebServiceDeployment", "JBossWebMetaData" );
deployer2.setOutputs("DeploymentType", "JBossWebMetaData");
addDeployer(main, deployer2);
TestFlowDeployer deployer3 = new TestFlowDeployer("WebServiceDeployerEJB");
deployer3.setInputs("JBossWebMetaData", "DeploymentType");
deployer3.setOutputs("JBossWebMetaData");
addDeployer(main, deployer3);
TestFlowDeployer deployer4 = new TestFlowDeployer("WebServiceDeployerPreJSE");
deployer4.setInputs("JBossWebMetaData", "DeploymentType");
deployer4.setOutputs("JBossWebMetaData");
addDeployer(main, deployer4);
TestFlowDeployer deployer5 = new TestFlowDeployer("AbstractWarDeployer");
deployer5.setInputs("JBossWebMetaData");
deployer5.setOutputs("WarDeployment");
addDeployer(main, deployer5);
TestFlowDeployer deployer6 = new TestFlowDeployer("ServiceCL");
deployer6.setInputs("DeploymentType", "WarDeployment");
addDeployer(main, deployer6);
Deployment deployment = createSimpleDeployment("testWSDeploymentOrder");
main.addDeployment(deployment);
main.process();
System.out.println("D1: " + deployer1.getDeployOrder());
System.out.println("D2: " + deployer2.getDeployOrder());
System.out.println("D3: " + deployer3.getDeployOrder());
System.out.println("D4: " + deployer4.getDeployOrder());
System.out.println("D5: " + deployer5.getDeployOrder());
System.out.println("D6: " + deployer6.getDeployOrder());
assertEquals(1, deployer1.getDeployOrder());
assertEquals(2, deployer2.getDeployOrder());
assertEquals(3, deployer3.getDeployOrder());
assertEquals(4, deployer4.getDeployOrder());
assertEquals(5, deployer5.getDeployOrder());
assertEquals(6, deployer6.getDeployOrder());
assertEquals(-1, deployer1.getUndeployOrder());
assertEquals(-1, deployer2.getUndeployOrder());
assertEquals(-1, deployer3.getUndeployOrder());
assertEquals(-1, deployer4.getUndeployOrder());
assertEquals(-1, deployer5.getUndeployOrder());
assertEquals(-1, deployer6.getUndeployOrder());
main.removeDeployment(deployment);
main.process();
assertEquals(1, deployer1.getDeployOrder());
assertEquals(2, deployer2.getDeployOrder());
assertEquals(3, deployer3.getDeployOrder());
assertEquals(4, deployer4.getDeployOrder());
assertEquals(5, deployer5.getDeployOrder());
assertEquals(6, deployer6.getDeployOrder());
assertEquals(12, deployer1.getUndeployOrder());
assertEquals(11, deployer2.getUndeployOrder());
assertEquals(10, deployer3.getUndeployOrder());
assertEquals(9, deployer4.getUndeployOrder());
assertEquals(8, deployer5.getUndeployOrder());
assertEquals(7, deployer6.getUndeployOrder());
main.addDeployment(deployment);
main.process();
assertEquals(13, deployer1.getDeployOrder());
assertEquals(14, deployer2.getDeployOrder());
assertEquals(15, deployer3.getDeployOrder());
assertEquals(16, deployer4.getDeployOrder());
assertEquals(17, deployer5.getDeployOrder());
assertEquals(18, deployer6.getDeployOrder());
assertEquals(12, deployer1.getUndeployOrder());
assertEquals(11, deployer2.getUndeployOrder());
assertEquals(10, deployer3.getUndeployOrder());
assertEquals(9, deployer4.getUndeployOrder());
assertEquals(8, deployer5.getUndeployOrder());
assertEquals(7, deployer6.getUndeployOrder());
}
---
The test output is:
---
...
973 DEBUG [DeployersImpl] Fully Deployed testWSDeploymentOrder
D1: 1
D2: 4
D3: 2
D4: 3
D5: 5
D6: 6
... -
2. Re: Deployers Ordering
ropalka Jun 24, 2009 9:20 AM (in response to ropalka)Cross reference: JBDEPLOY-201
-
3. Re: Deployers Ordering
alesj Jun 25, 2009 4:38 AM (in response to ropalka)"richard.opalka@jboss.com" wrote:
I'd expect this test to fail because there's no deployer with "1" output?
Fail?
The order is trivial - 1,2,3,4. -
4. Re: Deployers Ordering
alesj Jun 25, 2009 4:43 AM (in response to ropalka)"richard.opalka@jboss.com" wrote:
And I'd expect the following test to pass:
Your test is wrong.
#2 takes JBWMD as input, where #3,#4 declare that as output.
So, this is properly ordered: 3,4,2 -
5. Re: Deployers Ordering
alesj Jun 25, 2009 4:48 AM (in response to ropalka)"alesj" wrote:
#2 takes JBWMD as input, where #3,#4 declare that as output.
Ah, they all declare JBWMD as input and output.
Then the name comparison kicks in - as the last resort on how to order. -
6. Re: Deployers Ordering
ropalka Jun 25, 2009 4:53 AM (in response to ropalka)"alesj" wrote:
Then the name comparison kicks in - as the last resort on how to order.
This is fundamentally wrong IMHO.
Current deployers ordering algorithm is broken.
You can't implement deployers ordering by just comparing two deployers.
Two deployers are not comparable in general. -
7. Re: Deployers Ordering
ropalka Jun 25, 2009 5:03 AM (in response to ropalka)Current deployers sorting is broken because:
- it doesn't take stages into account
- it doesn't validate inputs
- it sorts deployers on insert, but should sort them after deployers chain initialization
- two deployers are not comparable in general -
8. Re: Deployers Ordering
alesj Jun 25, 2009 5:04 AM (in response to ropalka)What do you propose then?
If we have to resort to name comparison it either means:
* the order of how we process attachments doesn't matter
* you are describing/ordering your deployers wrong == lack of info -
9. Re: Deployers Ordering
ropalka Jun 25, 2009 5:07 AM (in response to ropalka)In order to fix it the following is necessary to be done:
* deployer stages have to be comparable
* deployers have to be sorted on deployers chain retrieval (i.e. in method protected synchronized List getDeployersList(String stageName))
* sorting agorithm have to take stages, inputs, outputs and relative order into account
* different sorting algorithm have to be implemented (domino is wrong because two deployers are not comparable in general) -
10. Re: Deployers Ordering
ropalka Jun 25, 2009 5:14 AM (in response to ropalka)"richard.opalka@jboss.com" wrote:
* sorting agorithm have to take stages, inputs, outputs and relative order into account
And deployers name comparison as last ordering decision ;) -
11. Re: Deployers Ordering
ropalka Jun 25, 2009 5:18 AM (in response to ropalka)Example of use case that shold fail but won't:
Deployer1:
- stage: PRE_REAL
- inputs: output1
Deployer2:
- stage: REAL
- outputs: output1
PRE_REAL is before REAL. Current domino sorting algorithm will not detect it. -
12. Re: Deployers Ordering
alesj Jun 25, 2009 6:25 AM (in response to ropalka)"richard.opalka@jboss.com" wrote:
* deployer stages have to be comparable
Why?
That's why they are called stages and they are already comparable - how else do you think they fit into our state machine. ;-)"richard.opalka@jboss.com" wrote:
* deployers have to be sorted on deployers chain retrieval (i.e. in method protected synchronized List<Deployer> getDeployersList(String stageName))
Why?
Based on what?
This would be complete waste of time/performance."richard.opalka@jboss.com" wrote:
* sorting agorithm have to take stages, inputs, outputs and relative order into account
Why/how stages?
All the rest is already taken into account."richard.opalka@jboss.com" wrote:
* different sorting algorithm have to be implemented (domino is wrong because two deployers are not comparable in general)
Sure.
But re-read my previous post:"alesj" wrote:
If we have to resort to name comparison it either means:
* the order of how we process attachments doesn't matter
* you are describing/ordering your deployers wrong == lack of info -
13. Re: Deployers Ordering
alesj Jun 25, 2009 6:28 AM (in response to ropalka)"richard.opalka@jboss.com" wrote:
- it doesn't validate inputs
Validate how?
Order at runtime based on the actual attachment values?
Too much hassle for something that sounds useless in 99,9%.
Not to mention that it's not deterministic."richard.opalka@jboss.com" wrote:
- it sorts deployers on insert, but should sort them after deployers chain initialization
What would you gain by this? -
14. Re: Deployers Ordering
alesj Jun 25, 2009 6:44 AM (in response to ropalka)"richard.opalka@jboss.com" wrote:
Example of use case that shold fail but won't:
Deployer1:
- stage: PRE_REAL
- inputs: output1
Deployer2:
- stage: REAL
- outputs: output1
PRE_REAL is before REAL. Current domino sorting algorithm will not detect it.
I never said creating a deployer is completely trivial.
I mean, the actual impl with all the existing helpers/abstract deployers, is trivial,
but how to properly set stage and inputs/outputs is more difficult task that it first appears.
But that's why we already provide you with Deployers statistics (off by default),
which show you
* deployer inputs/outputs
* deployer times
See DeployersImpl for more details.