You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2006/04/28 15:15:15 UTC
svn commit: r397892 - in /geronimo/xbean/trunk/xbean-spring/src/test:
java/org/apache/xbean/spring/context/
resources/org/apache/xbean/spring/context/
Author: gnodet
Date: Fri Apr 28 06:15:12 2006
New Revision: 397892
URL: http://svn.apache.org/viewcvs?rev=397892&view=rev
Log:
XBEAN-2: XBean should throw exceptions when a namespace can not be mapped or when an element / attribute can not be mapped
Added:
geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java
geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadElementTest.java
geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java
geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml
geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-element.xml
geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml
Added: geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java?rev=397892&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadAttributeTest.java Fri Apr 28 06:15:12 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ */
+package org.apache.xbean.spring.context;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Guillaume Nodet
+ * @version $Id$
+ * @since 2.3
+ */
+public class BadAttributeTest extends TestCase {
+
+ public void testBadNs() throws Exception {
+ try {
+ new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-attribute.xml");
+ fail("This should have thrown an exception");
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
Added: geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadElementTest.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadElementTest.java?rev=397892&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadElementTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadElementTest.java Fri Apr 28 06:15:12 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ */
+package org.apache.xbean.spring.context;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Guillaume Nodet
+ * @version $Id$
+ * @since 2.3
+ */
+public class BadElementTest extends TestCase {
+
+ public void testBadNs() throws Exception {
+ try {
+ new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-element.xml");
+ fail("This should have thrown an exception");
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
Added: geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java?rev=397892&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java (added)
+++ geronimo/xbean/trunk/xbean-spring/src/test/java/org/apache/xbean/spring/context/BadNamespaceTest.java Fri Apr 28 06:15:12 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ */
+package org.apache.xbean.spring.context;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Guillaume Nodet
+ * @version $Id$
+ * @since 2.3
+ */
+public class BadNamespaceTest extends TestCase {
+
+ public void testBadNs() throws Exception {
+ try {
+ new ClassPathXmlApplicationContext("org/apache/xbean/spring/context/bad-namespace.xml");
+ fail("This should have thrown an exception");
+ } catch (Exception e) {
+ System.out.println(e.getMessage());
+ }
+ }
+
+}
Added: geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml?rev=397892&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml (added)
+++ geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-attribute.xml Fri Apr 28 06:15:12 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
+
+ <b:beer id="123" unknown="Stella" />
+
+</beans>
Added: geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-element.xml
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-element.xml?rev=397892&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-element.xml (added)
+++ geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-element.xml Fri Apr 28 06:15:12 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:b="http://xbean.apache.org/schemas/pizza">
+
+ <b:unknown id="123" name="Stella" />
+
+</beans>
Added: geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml
URL: http://svn.apache.org/viewcvs/geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml?rev=397892&view=auto
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml (added)
+++ geronimo/xbean/trunk/xbean-spring/src/test/resources/org/apache/xbean/spring/context/bad-namespace.xml Fri Apr 28 06:15:12 2006
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns:b="http://bad-namespace">
+
+ <b:beer name="Stella" />
+
+</beans>