diff --git a/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/AbstractModularValueConverter.java b/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/AbstractModularValueConverter.java index d28659b92..fd49b3413 100644 --- a/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/AbstractModularValueConverter.java +++ b/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/AbstractModularValueConverter.java @@ -279,7 +279,7 @@ protected Object convertPlainValueToTargetType(Class aTargetType, Class aP aConversionContext, someVisitedValues); } } else { - Class tempCurrentArrayType = aValue.getClass().getComponentType(); + Class tempCurrentArrayType = transformPrimitiveTypes(aValue.getClass().getComponentType()); Class tempTargetArrayType; if (tempCurrentArrayType == Object.class) { diff --git a/de.gebit.integrity.tests/integrity/fixtures/BeanFixture.integrity b/de.gebit.integrity.tests/integrity/fixtures/BeanFixture.integrity index 4c7f321de..b8ff632e2 100644 --- a/de.gebit.integrity.tests/integrity/fixtures/BeanFixture.integrity +++ b/de.gebit.integrity.tests/integrity/fixtures/BeanFixture.integrity @@ -19,5 +19,10 @@ packagedef integrity.fixtures.basic.beans with testdef echoEnumValueFromTestBean uses de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#echoEnumValueFromTestBean calldef echoEnumValueFromTestBeanCall uses de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#echoEnumValueFromTestBean + + testdef echoMap uses de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#echoMap + calldef echoMapCall uses de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#echoMap + + calldef createPrimitiveTypeArrayTestBean uses de.gebit.integrity.tests.fixtures.basic.beans.BeanFixture#createPrimitiveTypeArrayTestBean packageend \ No newline at end of file diff --git a/de.gebit.integrity.tests/integrity/suites/basic/beans/primitiveArrayBeanTest.integrity b/de.gebit.integrity.tests/integrity/suites/basic/beans/primitiveArrayBeanTest.integrity new file mode 100644 index 000000000..8656e95e7 --- /dev/null +++ b/de.gebit.integrity.tests/integrity/suites/basic/beans/primitiveArrayBeanTest.integrity @@ -0,0 +1,16 @@ +import integrity.fixtures.basic.beans.* + +packagedef integrity.basic.beans with + + suitedef primitiveArrayBeanTest with + + variable testvar + + call createPrimitiveTypeArrayTestBean -> testvar + + // This converts the resulting map to a string for inclusion into the results, therefore the map is tested + call echoMapCall bean: testvar -> testvar + + suiteend + +packageend \ No newline at end of file diff --git a/de.gebit.integrity.tests/junit/de/gebit/integrity/tests/junit/basic/beans/PrimitiveArrayBeanTest.java b/de.gebit.integrity.tests/junit/de/gebit/integrity/tests/junit/basic/beans/PrimitiveArrayBeanTest.java new file mode 100644 index 000000000..d4f812877 --- /dev/null +++ b/de.gebit.integrity.tests/junit/de/gebit/integrity/tests/junit/basic/beans/PrimitiveArrayBeanTest.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2013 Rene Schneider, GEBIT Solutions GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package de.gebit.integrity.tests.junit.basic.beans; + +import java.io.IOException; + +import org.jdom.Document; +import org.jdom.JDOMException; +import org.junit.Test; + +import de.gebit.integrity.runner.exceptions.ModelLoadException; +import de.gebit.integrity.tests.junit.IntegrityJUnitTest; + +/** + * JUnit test which checks bean calls. + * + * + * @author Rene Schneider - initial API and implementation + * + */ +public class PrimitiveArrayBeanTest extends IntegrityJUnitTest { + + /** + * Performs a suite which does fixture calls with bean values and checks the resulting XML document. + * + * @throws ModelLoadException + * @throws IOException + * @throws JDOMException + */ + @Test + public void test() throws ModelLoadException, IOException, JDOMException { + Document tempResult = executeIntegritySuite( + new String[] { "integrity/suites/basic/beans/primitiveArrayBeanTest.integrity" }, + "integrity.basic.beans.primitiveArrayBeanTest", null); + assertDocumentMatchesReference(tempResult); + } + +} diff --git a/de.gebit.integrity.tests/results/integrity.basic.beans.primitiveArrayBeanTest.xml b/de.gebit.integrity.tests/results/integrity.basic.beans.primitiveArrayBeanTest.xml new file mode 100644 index 000000000..359e2c682 --- /dev/null +++ b/de.gebit.integrity.tests/results/integrity.basic.beans.primitiveArrayBeanTest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/BeanFixture.java b/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/BeanFixture.java index 64a6517b4..138f58631 100644 --- a/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/BeanFixture.java +++ b/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/BeanFixture.java @@ -110,4 +110,23 @@ public InnerEnum echoEnumValueFromTestBean(@FixtureParameter(name = "bean") Enum return aTestBean.getEnumValue(); } + @FixtureMethod(description = "echoes the input as a map converted by Integrity") + public Map echoMap(@FixtureParameter(name = "bean") Map aBean) { + return aBean; + } + + @FixtureMethod(description = "creates an instance of PrimitiveTypeArrayTestBean") + public PrimitiveTypeArrayTestBean createPrimitiveTypeArrayTestBean() { + PrimitiveTypeArrayTestBean tempBean = new PrimitiveTypeArrayTestBean(); + tempBean.setPrimitiveBoolean(new boolean[] { true, false }); + tempBean.setPrimitiveByte(new byte[] { 1, 2, 3 }); + tempBean.setPrimitiveChar(new char[] { 'a', 'b', 'c' }); + tempBean.setPrimitiveDouble(new double[] { 1.0, 1.1, 1.2 }); + tempBean.setPrimitiveFloat(new float[] { 1.0f, 1.1f, 1.2f }); + tempBean.setPrimitiveInt(new int[] { 1, 2, 3 }); + tempBean.setPrimitiveLong(new long[] { 1, 2, 3 }); + tempBean.setPrimitiveShort(new short[] { 1, 2, 3 }); + + return tempBean; + } } diff --git a/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/PrimitiveTypeArrayTestBean.java b/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/PrimitiveTypeArrayTestBean.java new file mode 100644 index 000000000..d84911207 --- /dev/null +++ b/de.gebit.integrity.tests/src/de/gebit/integrity/tests/fixtures/basic/beans/PrimitiveTypeArrayTestBean.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2013 Rene Schneider, GEBIT Solutions GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package de.gebit.integrity.tests.fixtures.basic.beans; + +//SUPPRESS CHECKSTYLE LONG Javadoc +public class PrimitiveTypeArrayTestBean { + + private int[] primitiveInt; + + private long[] primitiveLong; + + private short[] primitiveShort; + + private byte[] primitiveByte; + + private double[] primitiveDouble; + + private float[] primitiveFloat; + + private char[] primitiveChar; + + private boolean[] primitiveBoolean; + + public int[] getPrimitiveInt() { + return primitiveInt; + } + + public void setPrimitiveInt(int[] primitiveInt) { + this.primitiveInt = primitiveInt; + } + + public long[] getPrimitiveLong() { + return primitiveLong; + } + + public void setPrimitiveLong(long[] primitiveLong) { + this.primitiveLong = primitiveLong; + } + + public short[] getPrimitiveShort() { + return primitiveShort; + } + + public void setPrimitiveShort(short[] primitiveShort) { + this.primitiveShort = primitiveShort; + } + + public byte[] getPrimitiveByte() { + return primitiveByte; + } + + public void setPrimitiveByte(byte[] primitiveByte) { + this.primitiveByte = primitiveByte; + } + + public double[] getPrimitiveDouble() { + return primitiveDouble; + } + + public void setPrimitiveDouble(double[] primitiveDouble) { + this.primitiveDouble = primitiveDouble; + } + + public float[] getPrimitiveFloat() { + return primitiveFloat; + } + + public void setPrimitiveFloat(float[] primitiveFloat) { + this.primitiveFloat = primitiveFloat; + } + + public char[] getPrimitiveChar() { + return primitiveChar; + } + + public void setPrimitiveChar(char[] primitiveChar) { + this.primitiveChar = primitiveChar; + } + + public boolean[] getPrimitiveBoolean() { + return primitiveBoolean; + } + + public void setPrimitiveBoolean(boolean[] primitiveBoolean) { + this.primitiveBoolean = primitiveBoolean; + } + +}