Skip to content

Commit

Permalink
add one more test for blueprint transaction name space handler
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/incubator/aries/trunk/transaction@982788 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Lin Sun committed Aug 5, 2010
1 parent 4b14780 commit 9238c10
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
Expand Up @@ -147,4 +147,40 @@ public void testMultipleElements2() throws Exception
assertEquals(null, txenhancer.getComponentMethodTxAttribute(compMiddle, "doSomething"));

}

@Test
public void testMultipleElements3() throws Exception
{
Parser p = new Parser();

URL bpxml = this.getClass().getResource("bundlewide-aries3.xml");
List<URL> bpxmlList = new LinkedList<URL>();
bpxmlList.add(bpxml);

p.parse(bpxmlList);
Set<URI> nsuris = p.getNamespaces();
NamespaceHandlerSet nshandlers = nhri.getNamespaceHandlers(nsuris, b);
p.validate(nshandlers.getSchema());

ComponentDefinitionRegistry cdr = new ComponentDefinitionRegistryImpl();
p.populate(nshandlers, cdr);

BeanMetadata compTop = (BeanMetadata) cdr.getComponentDefinition("top2");
BeanMetadata compDown = (BeanMetadata) cdr.getComponentDefinition("down2");
BeanMetadata compMiddle = (BeanMetadata) cdr.getComponentDefinition("middle2");

assertNotNull(compTop);
assertNotNull(compDown);
assertNotNull(compMiddle);

assertEquals("RequiresNew", txenhancer.getComponentMethodTxAttribute(compTop, "update1234"));
assertEquals("Required", txenhancer.getComponentMethodTxAttribute(compTop, "update"));
assertEquals("NotSupported", txenhancer.getComponentMethodTxAttribute(compTop, "doSomething"));

assertEquals("Required", txenhancer.getComponentMethodTxAttribute(compDown, "doSomething"));
assertEquals("NotSupported", txenhancer.getComponentMethodTxAttribute(compDown, "update1234"));

assertEquals("Required", txenhancer.getComponentMethodTxAttribute(compMiddle, "doSomething"));

}
}
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0">
<tx:transaction bean="top*" method="*" value="NotSupported"/>
<tx:transaction bean="down* middle*" method="*" value="Required"/>

<bean id="top2" class="org.apache.aries.transaction.TestBean">
<tx:transaction method="update*" value="Required"/>
<tx:transaction method="update123*" value="RequiresNew"/>
</bean>

<bean id="down2" class="org.apache.aries.transaction.TestBean2">
<tx:transaction method="update*" value="NotSupported"/>
</bean>

<bean id="middle2" class="org.apache.aries.transaction.TestBean3"/>
</blueprint>

0 comments on commit 9238c10

Please sign in to comment.