openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r728092 - in /incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition: ./ XMLDefinitionTest.java
Date Fri, 19 Dec 2008 18:27:05 GMT
Author: gerdogdu
Date: Fri Dec 19 10:27:05 2008
New Revision: 728092

URL: http://svn.apache.org/viewvc?rev=728092&view=rev
Log:
Simple XML component test is added.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
  (with props)

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java?rev=728092&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
Fri Dec 19 10:27:05 2008
@@ -0,0 +1,88 @@
+/*
+ *  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.
+ */
+package org.apache.webbeans.test.unittests.xml.definition;
+
+import java.io.InputStream;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.component.xml.XMLComponentImpl;
+import org.apache.webbeans.test.servlet.TestContext;
+import org.apache.webbeans.test.unittests.xml.XMLTest;
+import org.apache.webbeans.test.xml.definition.Definition1;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+import org.apache.webbeans.xml.XMLUtil;
+import org.dom4j.Element;
+import org.junit.Before;
+import org.junit.Test;
+
+public class XMLDefinitionTest extends TestContext
+{
+	public XMLDefinitionTest()
+	{
+		super(XMLDefinitionTest.class.getName());
+	}
+
+	@Before
+	public void init()
+	{
+		initDeploymentTypes();
+	}
+	
+	@Test
+	public void testDefinition1()
+	{
+		Throwable e = null;
+		try
+		{
+			InputStream stream = XMLTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/definition/definition1.xml");
		
+			Assert.assertNotNull(stream);
+			
+			clear();
+			
+			Element rootElement = XMLUtil.getRootElement(stream);
+			Element beanElement = (Element)rootElement.elements().get(0);
+			
+			Class<?> clazz = XMLUtil.getElementJavaType(beanElement);
+			
+			defineXMLSimpleWebBeans(clazz, beanElement);
+			
+			Assert.assertEquals(1, getComponents().size());
+			Object def = getComponents().get(0);
+			
+			Assert.assertTrue(def instanceof XMLComponentImpl);
+			
+			XMLComponentImpl<?> comp = (XMLComponentImpl<?>)def;
+			
+			Assert.assertEquals("definition1", comp.getName());
+			
+			Object instance = comp.create();
+			
+			Assert.assertNotNull(instance);
+			Assert.assertTrue(instance instanceof Definition1);
+			
+		}catch(Throwable e1)
+		{
+			e1.printStackTrace();
+			e = e1;
+		}
+		
+		Assert.assertNull(e);
+		
+		
+	}
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message