[seam-commits] Seam SVN: r13537 - in modules/xml/trunk/impl: src/main/java/org/jboss/seam/xml/model and 6 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Jul 30 21:13:10 EDT 2010
Author: swd847
Date: 2010-07-30 21:13:09 -0400 (Fri, 30 Jul 2010)
New Revision: 13537
Added:
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/AbstractFieldXmlItem.java
Removed:
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldValueXmlItem.java
Modified:
modules/xml/trunk/impl/pom.xml
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/PropertyXmlItem.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetArrayFieldValueBeanTest.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetCollectionFieldValueBeanTest.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetMapFieldValueBeanTest.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/injection/QualifierAttributesTest.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/stereotype/StereotypeTest.java
modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/types/TypesTest.java
modules/xml/trunk/impl/src/test/resources/org/jboss/seam/xml/test/stereotype/stereotype-beans.xml
Log:
refactor field value settting, update to latest weld-se SNAPSHOT for testing
Modified: modules/xml/trunk/impl/pom.xml
===================================================================
--- modules/xml/trunk/impl/pom.xml 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/pom.xml 2010-07-31 01:13:09 UTC (rev 13537)
@@ -36,6 +36,7 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-se</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@@ -48,7 +49,6 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-extensions</artifactId>
- <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
Added: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/AbstractFieldXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/AbstractFieldXmlItem.java (rev 0)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/AbstractFieldXmlItem.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -0,0 +1,161 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.xml.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.seam.xml.core.BeanResult;
+import org.jboss.seam.xml.fieldset.ArrayFieldSet;
+import org.jboss.seam.xml.fieldset.CollectionFieldSet;
+import org.jboss.seam.xml.fieldset.FieldValueObject;
+import org.jboss.seam.xml.fieldset.FieldValueSetter;
+import org.jboss.seam.xml.fieldset.InlineBeanFieldValue;
+import org.jboss.seam.xml.fieldset.MapFieldSet;
+import org.jboss.seam.xml.fieldset.SimpleFieldValue;
+import org.jboss.seam.xml.util.TypeOccuranceInformation;
+import org.jboss.seam.xml.util.XmlConfigurationException;
+
+/**
+ * represents either a field or a property of a bean
+ *
+ * @author stuart
+ *
+ */
+public abstract class AbstractFieldXmlItem extends AbstractXmlItem
+{
+
+ protected FieldValueSetter fieldSetter;
+ protected FieldValueObject fieldValue;
+ protected HashSet<TypeOccuranceInformation> allowed = new HashSet<TypeOccuranceInformation>();
+ List<BeanResult<?>> inlineBeans = new ArrayList<BeanResult<?>>();
+
+ public AbstractFieldXmlItem(XmlItemType type, XmlItem parent, Class<?> javaClass, String innerText, Map<String, String> attributes, String document, int lineno)
+ {
+ super(type, parent, javaClass, innerText, attributes, document, lineno);
+ }
+
+ public FieldValueObject getFieldValue()
+ {
+ return fieldValue;
+ }
+
+ @Override
+ public boolean resolveChildren(BeanManager manager)
+ {
+ List<EntryXmlItem> mapEntries = new ArrayList<EntryXmlItem>();
+ List<ValueXmlItem> valueEntries = new ArrayList<ValueXmlItem>();
+ if (fieldValue == null)
+ {
+ for (XmlItem i : children)
+ {
+ if (i.getType() == XmlItemType.VALUE)
+ {
+ valueEntries.add((ValueXmlItem) i);
+ }
+ else if (i.getType() == XmlItemType.ENTRY)
+ {
+ mapEntries.add((EntryXmlItem) i);
+ }
+
+ }
+ }
+ if (!mapEntries.isEmpty() || !valueEntries.isEmpty())
+ {
+ if (Map.class.isAssignableFrom(getFieldType()))
+ {
+ if (!valueEntries.isEmpty())
+ {
+ throw new XmlConfigurationException("Map fields cannot have <value> elements as children,only <entry> elements Field:" + getDeclaringClass().getName() + '.' + getFieldName(), getDocument(), getLineno());
+ }
+ if (!mapEntries.isEmpty())
+ {
+ fieldValue = new MapFieldSet(fieldSetter, mapEntries);
+ }
+ }
+ else if (Collection.class.isAssignableFrom(getFieldType()) || getFieldType().isArray())
+ {
+ if (!mapEntries.isEmpty())
+ {
+ throw new XmlConfigurationException("Collection fields must be set using <value> not <entry> Field:" + getDeclaringClass().getName() + '.' + getFieldName(), getDocument(), getLineno());
+ }
+ if (!valueEntries.isEmpty())
+ {
+ if (getFieldType().isArray())
+ {
+ fieldValue = new ArrayFieldSet(fieldSetter, valueEntries);
+ }
+ else
+ {
+ fieldValue = new CollectionFieldSet(fieldSetter, valueEntries);
+ }
+ }
+ }
+ else
+ {
+ if (!mapEntries.isEmpty())
+ {
+ throw new XmlConfigurationException("Only Map fields can be set using <entry> Field:" + getDeclaringClass().getName() + '.' + getFieldName(), getDocument(), getLineno());
+ }
+ if (valueEntries.size() != 1)
+ {
+ throw new XmlConfigurationException("Non collection fields can only have a single <value> element Field:" + getDeclaringClass().getName() + '.' + getFieldName(), getDocument(), getLineno());
+ }
+ ValueXmlItem value = valueEntries.get(0);
+ BeanResult<?> result = value.getBeanResult(manager);
+ if (result == null)
+ {
+ fieldValue = new SimpleFieldValue(parent.getJavaClass(), fieldSetter, valueEntries.get(0).getInnerText());
+ }
+ else
+ {
+ inlineBeans.add(result);
+ fieldValue = new InlineBeanFieldValue(getFieldType(), value.getSyntheticQualifierId(), fieldSetter, manager);
+ }
+ }
+ }
+ return true;
+ }
+
+ public Set<TypeOccuranceInformation> getAllowedItem()
+ {
+ return allowed;
+ }
+
+ public abstract Class<?> getFieldType();
+
+ public abstract String getFieldName();
+
+ public abstract Class<?> getDeclaringClass();
+
+ public Collection<? extends BeanResult> getInlineBeans()
+ {
+ return inlineBeans;
+ }
+
+}
\ No newline at end of file
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -65,9 +65,9 @@
return allowed;
}
- public Set<FieldValueXmlItem> getShorthandFieldValues()
+ public Set<AbstractFieldXmlItem> getShorthandFieldValues()
{
- Set<FieldValueXmlItem> values = new HashSet<FieldValueXmlItem>();
+ Set<AbstractFieldXmlItem> values = new HashSet<AbstractFieldXmlItem>();
for (Entry<String, String> e : attributes.entrySet())
{
@@ -122,7 +122,7 @@
// get all the field values from the bean
Set<String> configuredFields = new HashSet<String>();
List<FieldValueObject> fields = new ArrayList<FieldValueObject>();
- for (FieldValueXmlItem xi : getChildrenOfType(FieldValueXmlItem.class))
+ for (AbstractFieldXmlItem xi : getChildrenOfType(AbstractFieldXmlItem.class))
{
inlineBeans.addAll(xi.getInlineBeans());
FieldValueObject f = xi.getFieldValue();
@@ -133,7 +133,7 @@
}
}
- for (FieldValueXmlItem f : getShorthandFieldValues())
+ for (AbstractFieldXmlItem f : getShorthandFieldValues())
{
if (configuredFields.contains(f.getFieldName()))
{
Deleted: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldValueXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldValueXmlItem.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldValueXmlItem.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.xml.model;
-
-import java.util.Collection;
-
-import org.jboss.seam.xml.core.BeanResult;
-import org.jboss.seam.xml.fieldset.FieldValueObject;
-
-public interface FieldValueXmlItem
-{
- public FieldValueObject getFieldValue();
-
- public String getFieldName();
-
- public Collection<? extends BeanResult> getInlineBeans();
-}
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -23,36 +23,17 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.seam.xml.core.BeanResult;
-import org.jboss.seam.xml.fieldset.ArrayFieldSet;
-import org.jboss.seam.xml.fieldset.CollectionFieldSet;
import org.jboss.seam.xml.fieldset.DirectFieldSetter;
-import org.jboss.seam.xml.fieldset.FieldValueObject;
import org.jboss.seam.xml.fieldset.FieldValueSetter;
-import org.jboss.seam.xml.fieldset.InlineBeanFieldValue;
-import org.jboss.seam.xml.fieldset.MapFieldSet;
import org.jboss.seam.xml.fieldset.MethodFieldSetter;
import org.jboss.seam.xml.fieldset.SimpleFieldValue;
import org.jboss.seam.xml.util.TypeOccuranceInformation;
-import org.jboss.seam.xml.util.XmlConfigurationException;
-public class FieldXmlItem extends AbstractXmlItem implements FieldValueXmlItem
+public class FieldXmlItem extends AbstractFieldXmlItem
{
- FieldValueSetter fieldSetter;
- FieldValueObject fieldValue;
- Field field;
- HashSet<TypeOccuranceInformation> allowed = new HashSet<TypeOccuranceInformation>();
- List<BeanResult<?>> inlineBeans = new ArrayList<BeanResult<?>>();
+ private final Field field;
public FieldXmlItem(XmlItem parent, Field c, String innerText, String document, int lineno)
{
@@ -73,95 +54,8 @@
return field;
}
- public FieldValueObject getFieldValue()
+ private FieldValueSetter getFieldValueSetter(Field field)
{
- return fieldValue;
- }
-
- @Override
- public boolean resolveChildren(BeanManager manager)
- {
- List<EntryXmlItem> mapEntries = new ArrayList<EntryXmlItem>();
- List<ValueXmlItem> valueEntries = new ArrayList<ValueXmlItem>();
- if (fieldValue == null)
- {
- for (XmlItem i : children)
- {
- if (i.getType() == XmlItemType.VALUE)
- {
- valueEntries.add((ValueXmlItem) i);
- }
- else if (i.getType() == XmlItemType.ENTRY)
- {
- mapEntries.add((EntryXmlItem) i);
- }
-
- }
- }
- if (!mapEntries.isEmpty() || !valueEntries.isEmpty())
- {
- if (Map.class.isAssignableFrom(field.getType()))
- {
- if (!valueEntries.isEmpty())
- {
- throw new XmlConfigurationException("Map fields cannot have <value> elements as children,only <entry> elements Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
- }
- if (!mapEntries.isEmpty())
- {
- fieldValue = new MapFieldSet(fieldSetter, mapEntries);
- }
- }
- else if (Collection.class.isAssignableFrom(field.getType()) || field.getType().isArray())
- {
- if (!mapEntries.isEmpty())
- {
- throw new XmlConfigurationException("Collection fields must be set using <value> not <entry> Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
- }
- if (!valueEntries.isEmpty())
- {
- if (field.getType().isArray())
- {
- fieldValue = new ArrayFieldSet(fieldSetter, valueEntries);
- }
- else
- {
- fieldValue = new CollectionFieldSet(fieldSetter, valueEntries);
- }
- }
- }
- else
- {
- if (!mapEntries.isEmpty())
- {
- throw new XmlConfigurationException("Only Map fields can be set using <entry> Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
- }
- if (valueEntries.size() != 1)
- {
- throw new XmlConfigurationException("Non collection fields can only have a single <value> element Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
- }
- ValueXmlItem value = valueEntries.get(0);
- BeanResult<?> result = value.getBeanResult(manager);
- if (result == null)
- {
- fieldValue = new SimpleFieldValue(parent.getJavaClass(), fieldSetter, valueEntries.get(0).getInnerText());
- }
- else
- {
- inlineBeans.add(result);
- fieldValue = new InlineBeanFieldValue(field.getType(), value.getSyntheticQualifierId(), fieldSetter, manager);
- }
- }
- }
- return true;
- }
-
- public Set<TypeOccuranceInformation> getAllowedItem()
- {
- return allowed;
- }
-
- FieldValueSetter getFieldValueSetter(Field field)
- {
String fieldName = field.getName();
String methodName = "set" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
Method setter = null;
@@ -184,13 +78,21 @@
return new DirectFieldSetter(field);
}
+ @Override
+ public Class<?> getDeclaringClass()
+ {
+ return field.getDeclaringClass();
+ }
+
+ @Override
public String getFieldName()
{
return field.getName();
}
- public Collection<? extends BeanResult> getInlineBeans()
+ @Override
+ public Class<?> getFieldType()
{
- return inlineBeans;
+ return field.getType();
}
}
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/PropertyXmlItem.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/PropertyXmlItem.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/model/PropertyXmlItem.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -22,49 +22,29 @@
package org.jboss.seam.xml.model;
import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.seam.xml.core.BeanResult;
-import org.jboss.seam.xml.fieldset.ArrayFieldSet;
-import org.jboss.seam.xml.fieldset.CollectionFieldSet;
import org.jboss.seam.xml.fieldset.FieldValueObject;
-import org.jboss.seam.xml.fieldset.FieldValueSetter;
-import org.jboss.seam.xml.fieldset.InlineBeanFieldValue;
-import org.jboss.seam.xml.fieldset.MapFieldSet;
import org.jboss.seam.xml.fieldset.MethodFieldSetter;
import org.jboss.seam.xml.fieldset.SimpleFieldValue;
-import org.jboss.seam.xml.util.TypeOccuranceInformation;
-import org.jboss.seam.xml.util.XmlConfigurationException;
-public class PropertyXmlItem extends AbstractXmlItem implements FieldValueXmlItem
+public class PropertyXmlItem extends AbstractFieldXmlItem
{
- FieldValueSetter fieldSetter;
- FieldValueObject fieldValue;
- String name;
- Class<?> type;
- HashSet<TypeOccuranceInformation> allowed = new HashSet<TypeOccuranceInformation>();
- List<BeanResult<?>> inlineBeans = new ArrayList<BeanResult<?>>();
+ private final String name;
+ private final Class<?> type;
+ private final Class<?> declaringClass;
public PropertyXmlItem(XmlItem parent, String name, Method setter, String innerText, String document, int lineno)
{
super(XmlItemType.FIELD, parent, parent.getJavaClass(), innerText, null, document, lineno);
this.name = name;
this.type = setter.getParameterTypes()[0];
+ this.declaringClass = setter.getDeclaringClass();
this.fieldSetter = new MethodFieldSetter(setter);
if (innerText != null && innerText.length() > 0)
{
fieldValue = new SimpleFieldValue(parent.getJavaClass(), fieldSetter, innerText);
}
- allowed.add(TypeOccuranceInformation.of(XmlItemType.VALUE, null, null));
- allowed.add(TypeOccuranceInformation.of(XmlItemType.ENTRY, null, null));
}
public FieldValueObject getFieldValue()
@@ -73,94 +53,21 @@
}
@Override
- public boolean resolveChildren(BeanManager manager)
+ public Class<?> getDeclaringClass()
{
- List<EntryXmlItem> mapEntries = new ArrayList<EntryXmlItem>();
- List<ValueXmlItem> valueEntries = new ArrayList<ValueXmlItem>();
- if (fieldValue == null)
- {
- for (XmlItem i : children)
- {
- if (i.getType() == XmlItemType.VALUE)
- {
- valueEntries.add((ValueXmlItem) i);
- }
- else if (i.getType() == XmlItemType.ENTRY)
- {
- mapEntries.add((EntryXmlItem) i);
- }
-
- }
- }
- if (!mapEntries.isEmpty() || !valueEntries.isEmpty())
- {
- if (Map.class.isAssignableFrom(type))
- {
- if (!valueEntries.isEmpty())
- {
- throw new XmlConfigurationException("Map fields cannot have <value> elements as children,only <entry> elements Field:" + parent.getJavaClass().getName() + '.' + name, getDocument(), getLineno());
- }
- if (!mapEntries.isEmpty())
- {
- fieldValue = new MapFieldSet(fieldSetter, mapEntries);
- }
- }
- else if (Collection.class.isAssignableFrom(type) || type.isArray())
- {
- if (!mapEntries.isEmpty())
- {
- throw new XmlConfigurationException("Collection fields must be set using <value> not <entry> Field:" + parent.getJavaClass().getName() + '.' + name, getDocument(), getLineno());
- }
- if (!valueEntries.isEmpty())
- {
- if (type.isArray())
- {
- fieldValue = new ArrayFieldSet(fieldSetter, valueEntries);
- }
- else
- {
- fieldValue = new CollectionFieldSet(fieldSetter, valueEntries);
- }
- }
- }
- else
- {
- if (!mapEntries.isEmpty())
- {
- throw new XmlConfigurationException("Only Map fields can be set using <entry> Field:" + parent.getJavaClass().getName() + '.' + name, getDocument(), getLineno());
- }
- if (valueEntries.size() != 1)
- {
- throw new XmlConfigurationException("Non collection fields can only have a single <value> element Field:" + parent.getJavaClass().getName() + '.' + name, getDocument(), getLineno());
- }
- ValueXmlItem value = valueEntries.get(0);
- BeanResult<?> result = value.getBeanResult(manager);
- if (result == null)
- {
- fieldValue = new SimpleFieldValue(parent.getJavaClass(), fieldSetter, valueEntries.get(0).getInnerText());
- }
- else
- {
- inlineBeans.add(result);
- fieldValue = new InlineBeanFieldValue(type, value.getSyntheticQualifierId(), fieldSetter, manager);
- }
- }
- }
- return true;
+ return declaringClass;
}
- public Set<TypeOccuranceInformation> getAllowedItem()
- {
- return allowed;
- }
-
+ @Override
public String getFieldName()
{
return name;
}
- public Collection<? extends BeanResult> getInlineBeans()
+ @Override
+ public Class<?> getFieldType()
{
- return inlineBeans;
+ return type;
}
+
}
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -26,6 +26,7 @@
import junit.framework.Assert;
+import org.jboss.seam.xml.model.AbstractFieldXmlItem;
import org.jboss.seam.xml.model.FieldXmlItem;
import org.jboss.seam.xml.model.MethodXmlItem;
import org.jboss.seam.xml.model.XmlItem;
@@ -73,7 +74,7 @@
Assert.assertTrue("Wrong method was resolved", ((MethodXmlItem) method).getMethod().getParameterTypes().length == 0);
XmlItem field = resolver.getItemForNamespace(new SaxNode("field1", null, null, null, null, 0), item);
- Assert.assertTrue("Element of wrong type returned", ((FieldXmlItem) field).getType() == XmlItemType.FIELD);
+ Assert.assertTrue("Element of wrong type returned", ((AbstractFieldXmlItem) field).getType() == XmlItemType.FIELD);
Assert.assertTrue("field was not set", ((FieldXmlItem) field).getField() != null);
}
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetArrayFieldValueBeanTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetArrayFieldValueBeanTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetArrayFieldValueBeanTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -24,7 +24,6 @@
import junit.framework.Assert;
import org.jboss.seam.xml.test.AbstractXMLTest;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
import org.junit.Test;
public class SetArrayFieldValueBeanTest extends AbstractXMLTest
@@ -39,7 +38,7 @@
@Test
public void arrayFieldSetterTest()
{
- ArrayFieldValue x = WeldManagerUtils.getInstanceByType(manager, ArrayFieldValue.class);
+ ArrayFieldValue x = getReference(ArrayFieldValue.class);
Assert.assertTrue(x.carray.length == 2);
Assert.assertTrue(x.iarray.length == 2);
Assert.assertTrue(x.sarray.length == 2);
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetCollectionFieldValueBeanTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetCollectionFieldValueBeanTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetCollectionFieldValueBeanTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -24,7 +24,6 @@
import junit.framework.Assert;
import org.jboss.seam.xml.test.AbstractXMLTest;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
import org.junit.Test;
public class SetCollectionFieldValueBeanTest extends AbstractXMLTest
@@ -39,7 +38,7 @@
@Test
public void collectionSetFieldValue()
{
- CollectionFieldValue x = WeldManagerUtils.getInstanceByType(manager, CollectionFieldValue.class);
+ CollectionFieldValue x = getReference(CollectionFieldValue.class);
Assert.assertTrue(x.iset.size() == 2);
Assert.assertTrue(x.clist.size() == 2);
Assert.assertTrue(x.sset.size() == 2);
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetMapFieldValueBeanTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetMapFieldValueBeanTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/fieldset/SetMapFieldValueBeanTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -24,7 +24,6 @@
import junit.framework.Assert;
import org.jboss.seam.xml.test.AbstractXMLTest;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
import org.junit.Test;
public class SetMapFieldValueBeanTest extends AbstractXMLTest
@@ -39,7 +38,7 @@
@Test
public void mapSetFieldValue()
{
- MapFieldValue x = WeldManagerUtils.getInstanceByType(manager, MapFieldValue.class);
+ MapFieldValue x = getReference(MapFieldValue.class);
Assert.assertTrue(x.map1.size() == 2);
Assert.assertTrue(x.map2.size() == 2);
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/injection/QualifierAttributesTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/injection/QualifierAttributesTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/injection/QualifierAttributesTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -24,7 +24,6 @@
import junit.framework.Assert;
import org.jboss.seam.xml.test.AbstractXMLTest;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
import org.junit.Test;
/**
@@ -42,7 +41,7 @@
@Test()
public void tstQualifiersWithAttributes()
{
- QualifierTestBean x = WeldManagerUtils.getInstanceByType(manager, QualifierTestBean.class);
+ QualifierTestBean x = getReference(QualifierTestBean.class);
Assert.assertTrue(x.bean1.getBeanNumber() == 1);
Assert.assertTrue(x.bean2.getBeanNumber() == 2);
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/stereotype/StereotypeTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/stereotype/StereotypeTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/stereotype/StereotypeTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -25,7 +25,6 @@
import org.jboss.seam.xml.test.AbstractXMLTest;
import org.jboss.seam.xml.test.interceptor.InterceptedBean;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
import org.junit.Test;
/**
@@ -45,7 +44,7 @@
public void testStereotypes()
{
- InterceptedBean x = WeldManagerUtils.getInstanceByType(manager, InterceptedBean.class);
+ InterceptedBean x = getReference(InterceptedBean.class);
String res = x.method();
Assert.assertTrue(res.equals("hello world"));
Modified: modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/types/TypesTest.java
===================================================================
--- modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/types/TypesTest.java 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/java/org/jboss/seam/xml/test/types/TypesTest.java 2010-07-31 01:13:09 UTC (rev 13537)
@@ -24,7 +24,6 @@
import junit.framework.Assert;
import org.jboss.seam.xml.test.AbstractXMLTest;
-import org.jboss.weld.environment.se.util.WeldManagerUtils;
import org.junit.Test;
/**
@@ -43,7 +42,7 @@
public void testTypeRestriction()
{
- TypeInjectedClass x = WeldManagerUtils.getInstanceByType(manager, TypeInjectedClass.class);
+ TypeInjectedClass x = getReference(TypeInjectedClass.class);
Assert.assertTrue(x.value instanceof AllowedType);
Assert.assertTrue(x.createValue instanceof RestrictedType);
Modified: modules/xml/trunk/impl/src/test/resources/org/jboss/seam/xml/test/stereotype/stereotype-beans.xml
===================================================================
--- modules/xml/trunk/impl/src/test/resources/org/jboss/seam/xml/test/stereotype/stereotype-beans.xml 2010-07-30 21:38:46 UTC (rev 13536)
+++ modules/xml/trunk/impl/src/test/resources/org/jboss/seam/xml/test/stereotype/stereotype-beans.xml 2010-07-31 01:13:09 UTC (rev 13537)
@@ -9,6 +9,7 @@
</test:Stereotype1>
<int:InterceptedBean>
+ <modifies/>
<test:Stereotype1/>
</int:InterceptedBean>
More information about the seam-commits
mailing list