/*
 *  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;

import java.io.InputStream;

import javax.servlet.ServletContext;
import javax.webbeans.manager.Manager;

import junit.framework.Assert;

import org.apache.webbeans.container.ManagerImpl;
import org.apache.webbeans.test.servlet.TestContext;
import org.junit.Before;
import org.junit.Test;


public class XMLFieldTest extends TestContext
{
	Manager container = null;

	public XMLFieldTest()
	{
		super(XMLFieldTest.class.getSimpleName());
	}

	public void endTests(ServletContext ctx)
	{
		
	}

	@Before
	public void init()
	{
		super.init();
		this.container = ManagerImpl.getManager();
	}

	public void startTests(ServletContext ctx)
	{
		
	}
	
	
	@Test
	public void nameSpacesNotDeclared()
	{
		Throwable e = null;
		try
		{
			InputStream stream = XMLFieldTest.class.getClassLoader().getResourceAsStream("org/apache/webbeans/test/xml/fieldTest.xml");			
			Assert.assertNotNull(stream);
			
			this.xmlConfigurator.configure(stream,"fieldTest.xml");
			
		}catch(Throwable e1)
		{
			e = e1;
		}
		
		Assert.assertNull(e);
	}
	
}

@@ -1096,24 +1096,79 @@
 estContext;%0A
+import org.apache.webbeans.test.xml.ComponentForField;%0A
 import org.j
@@ -1180,16 +1180,16 @@
 Before;%0A
-
 import o
@@ -1815,63 +1815,1034 @@
 %0A%09%09%09
-this.xmlConfigurator.configure(stream,%22fieldTest.xml%22);
+/*Clear the manager component list*/%0A%09%09%09clear();%0A%09%09%09%09%09%09%0A%09%09%09this.xmlConfigurator.configure(stream,%22fieldTest.xml%22);%0A%09%09%09%0A%09%09%09ComponentForField cff = (ComponentForField) container.getInstanceByName(%22componentForField%22);%0A%09%09%09%0A%09%09%09Assert.assertNotNull(cff);%0A%09%09%09Assert.assertEquals(35, cff.getIntField());%0A%09%09%09Assert.assertEquals(35.3f, cff.getFloatField());%0A%09%09%09Assert.assertEquals(35.5d, cff.getDoubleField());%0A%09%09%09Assert.assertEquals('a', cff.getCharField());%0A%09%09%09Assert.assertEquals(37, cff.getLongField());%0A%09%09%09Assert.assertEquals(1, cff.getByteField());%0A%09%09%09Assert.assertEquals(5, cff.getShortField());%0A%09%09%09Assert.assertEquals(true, cff.isBooleanField());%0A%09%09%09Assert.assertEquals(%22ENUM1%22, cff.getEnum1().name());%0A%09%09%09Assert.assertEquals(%22dskfj%22, cff.getStrField());%0A%09%09%09Assert.assertNotNull(cff.getDateField());%0A%09%09%09Assert.assertNotNull(cff.getCalendarField());%0A%09%09%09Assert.assertEquals(ComponentForField.class, cff.getClazzField());%0A%09%09%09Assert.assertNotNull(cff.getListStrField());%0A%09%09%09Assert.assertNotNull(cff.getListEnumField());%0A%09%09%09%0A%09%09%09%0A%09%09%09
 %0A%09%09%09

Test case update from Mark Struberg. Thanks Mark!