You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2010/09/14 16:40:40 UTC
svn commit: r996921 - in
/incubator/aries/trunk/transaction/transaction-blueprint/src:
main/java/org/apache/aries/transaction/
main/resources/org/apache/aries/transaction/parsing/
test/java/org/apache/aries/transaction/ test/resources/org/apache/aries/...
Author: timothyjward
Date: Tue Sep 14 14:40:40 2010
New Revision: 996921
URL: http://svn.apache.org/viewvc?rev=996921&view=rev
Log:
ARIES-406 - Fix breaking behaviour changes for blueprint transactions (1.0) and schema incompatibility (1.1)
Added:
incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries3.xml
incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries4.xml
incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries5.xml
incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries6.xml
Modified:
incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
incubator/aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/parsing/transactionv11.xsd
incubator/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java
incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries2.xml
Modified: incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java?rev=996921&r1=996920&r2=996921&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java (original)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/main/java/org/apache/aries/transaction/TxComponentMetaDataHelperImpl.java Tue Sep 14 14:40:40 2010
@@ -170,6 +170,9 @@ public class TxComponentMetaDataHelperIm
if (method == null || method.isEmpty()) {
method = "*";
}
+ if(value == null || value.isEmpty()) {
+ value = "Required";
+ }
String[] names = method.split("[, \t]");
Modified: incubator/aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/parsing/transactionv11.xsd
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/parsing/transactionv11.xsd?rev=996921&r1=996920&r2=996921&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/parsing/transactionv11.xsd (original)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/main/resources/org/apache/aries/transaction/parsing/transactionv11.xsd Tue Sep 14 14:40:40 2010
@@ -59,7 +59,7 @@
</xsd:annotation>
<xsd:attribute name="method" type="xsd:string" />
<xsd:attribute name="value" type="TtransactionAttribute"
- use="required" />
+ use="optional" default="Required" />
<xsd:attribute name="bean" type="xsd:string" />
</xsd:complexType>
Modified: incubator/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java?rev=996921&r1=996920&r2=996921&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java (original)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/test/java/org/apache/aries/transaction/NameSpaceHandlerTest.java Tue Sep 14 14:40:40 2010
@@ -88,7 +88,7 @@ public class NameSpaceHandlerTest {
}
@Test
- public void testMultipleElements() throws Exception
+ public void testMultipleElements_100() throws Exception
{
Parser p = new Parser();
@@ -115,7 +115,34 @@ public class NameSpaceHandlerTest {
}
@Test
- public void testOptionalMethodAttribute() throws Exception
+ public void testMultipleElements_110() throws Exception
+ {
+ Parser p = new Parser();
+
+ URL bpxml = this.getClass().getResource("aries4.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 comp = (BeanMetadata) cdr.getComponentDefinition("top");
+
+ BeanMetadata anon = (BeanMetadata) ((BeanProperty) comp.getProperties().get(0)).getValue();
+ BeanMetadata anonToo = (BeanMetadata) ((BeanProperty) comp.getProperties().get(1)).getValue();
+
+ assertEquals("Required", txenhancer.getComponentMethodTxAttribute(anon, "doSomething"));
+ assertEquals("Never", txenhancer.getComponentMethodTxAttribute(anonToo, "doSomething"));
+
+ }
+
+ @Test
+ public void testOptionalMethodAttribute_100() throws Exception
{
Parser p = new Parser();
@@ -142,6 +169,87 @@ public class NameSpaceHandlerTest {
}
@Test
+ public void testOptionalMethodAttribute_110() throws Exception
+ {
+ Parser p = new Parser();
+
+ URL bpxml = this.getClass().getResource("aries5.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 comp = (BeanMetadata) cdr.getComponentDefinition("top");
+
+ BeanMetadata anon = (BeanMetadata) ((BeanProperty) comp.getProperties().get(0)).getValue();
+ BeanMetadata anonToo = (BeanMetadata) ((BeanProperty) comp.getProperties().get(1)).getValue();
+
+ assertEquals("Required", txenhancer.getComponentMethodTxAttribute(anon, "doSomething"));
+ assertEquals("Never", txenhancer.getComponentMethodTxAttribute(anonToo, "doSomething"));
+
+ }
+
+ @Test
+ public void testOptionalValueAttribute_100() throws Exception
+ {
+ Parser p = new Parser();
+
+ URL bpxml = this.getClass().getResource("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 comp = (BeanMetadata) cdr.getComponentDefinition("top");
+
+ BeanMetadata anon = (BeanMetadata) ((BeanProperty) comp.getProperties().get(0)).getValue();
+ BeanMetadata anonToo = (BeanMetadata) ((BeanProperty) comp.getProperties().get(1)).getValue();
+
+ assertEquals("Required", txenhancer.getComponentMethodTxAttribute(anon, "doSomething"));
+ assertEquals("Never", txenhancer.getComponentMethodTxAttribute(anonToo, "doSomething"));
+ assertEquals("Required", txenhancer.getComponentMethodTxAttribute(anonToo, "require"));
+ }
+
+ @Test
+ public void testOptionalValueAttribute_110() throws Exception
+ {
+ Parser p = new Parser();
+
+ URL bpxml = this.getClass().getResource("aries6.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 comp = (BeanMetadata) cdr.getComponentDefinition("top");
+
+ BeanMetadata anon = (BeanMetadata) ((BeanProperty) comp.getProperties().get(0)).getValue();
+ BeanMetadata anonToo = (BeanMetadata) ((BeanProperty) comp.getProperties().get(1)).getValue();
+
+ assertEquals("Required", txenhancer.getComponentMethodTxAttribute(anon, "doSomething"));
+ assertEquals("Never", txenhancer.getComponentMethodTxAttribute(anonToo, "doSomething"));
+ assertEquals("Required", txenhancer.getComponentMethodTxAttribute(anonToo, "require"));
+ }
+
+ @Test
public void testBundleWideAndBeanLevelTx() throws Exception
{
Parser p = new Parser();
Modified: incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries2.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries2.xml?rev=996921&r1=996920&r2=996921&view=diff
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries2.xml (original)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries2.xml Tue Sep 14 14:40:40 2010
@@ -18,7 +18,7 @@
-->
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0">
+ xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0">
<bean id="top" class="org.apache.aries.transaction.TestBean">
Added: incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries3.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries3.xml?rev=996921&view=auto
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries3.xml (added)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries3.xml Tue Sep 14 14:40:40 2010
@@ -0,0 +1,37 @@
+<?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.0.0">
+
+
+ <bean id="top" class="org.apache.aries.transaction.TestBean">
+ <property name="txRequired">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction/>
+ </bean>
+ </property>
+ <property name="txNever">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction value="Never"/>
+ <tx:transaction method="require"/>
+ </bean>
+ </property>
+ </bean>
+</blueprint>
\ No newline at end of file
Added: incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries4.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries4.xml?rev=996921&view=auto
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries4.xml (added)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries4.xml Tue Sep 14 14:40:40 2010
@@ -0,0 +1,36 @@
+<?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">
+
+
+ <bean id="top" class="org.apache.aries.transaction.TestBean">
+ <property name="txRequired">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction method="*" value="Required"/>
+ </bean>
+ </property>
+ <property name="txNever">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction method="*" value="Never"/>
+ </bean>
+ </property>
+ </bean>
+</blueprint>
\ No newline at end of file
Added: incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries5.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries5.xml?rev=996921&view=auto
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries5.xml (added)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries5.xml Tue Sep 14 14:40:40 2010
@@ -0,0 +1,36 @@
+<?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">
+
+
+ <bean id="top" class="org.apache.aries.transaction.TestBean">
+ <property name="txRequired">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction value="Required"/>
+ </bean>
+ </property>
+ <property name="txNever">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction value="Never"/>
+ </bean>
+ </property>
+ </bean>
+</blueprint>
\ No newline at end of file
Added: incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries6.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries6.xml?rev=996921&view=auto
==============================================================================
--- incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries6.xml (added)
+++ incubator/aries/trunk/transaction/transaction-blueprint/src/test/resources/org/apache/aries/transaction/aries6.xml Tue Sep 14 14:40:40 2010
@@ -0,0 +1,37 @@
+<?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">
+
+
+ <bean id="top" class="org.apache.aries.transaction.TestBean">
+ <property name="txRequired">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction/>
+ </bean>
+ </property>
+ <property name="txNever">
+ <bean class="org.apache.aries.transaction.TestTxBean">
+ <tx:transaction value="Never"/>
+ <tx:transaction method="require"/>
+ </bean>
+ </property>
+ </bean>
+</blueprint>
\ No newline at end of file