Skip to content

Commit

Permalink
Merge branch 'v0.12.x_bugfix' into v0.12.x
Browse files Browse the repository at this point in the history
  • Loading branch information
S1artie committed Jan 23, 2014
2 parents 2b9cfc7 + b065287 commit 9019cf5
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import de.gebit.integrity.dsl.JavaConstantReference;
import de.gebit.integrity.dsl.MethodReference;
import de.gebit.integrity.dsl.Model;
import de.gebit.integrity.dsl.NamedResult;
import de.gebit.integrity.dsl.PackageDefinition;
import de.gebit.integrity.dsl.PackageStatement;
import de.gebit.integrity.dsl.Parameter;
Expand Down Expand Up @@ -379,6 +380,26 @@ public IScope scope_EnumValue_enumValue(Test aTest, EReference aRef) {
return determineDefaultResultEnumValueScope(aTest.getDefinition().getFixtureMethod());
}

/**
* Limit enum values in named test results to actually existent enumeration literals.
*
* @param aNamedResult
* @param aRef
* @return
*/
// SUPPRESS CHECKSTYLE MethodName
public IScope scope_EnumValue_enumValue(NamedResult aNamedResult, EReference aRef) {
ResultName tempResultName = aNamedResult.getName();
if (tempResultName instanceof FixedResultName) {
if (aNamedResult.eContainer() instanceof Test) {
return determineNamedResultEnumValueScope(((Test) aNamedResult.eContainer()).getDefinition()
.getFixtureMethod(), ((FixedResultName) tempResultName).getField());
}
}

return IScope.NULLSCOPE;
}

/**
* Limit named test results to actually existing fields in the result container object.
*
Expand Down
6 changes: 3 additions & 3 deletions de.gebit.integrity.tests/Integrity Single JUnit Test.launch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/de.gebit.integrity.tests/junit/de/gebit/integrity/tests/junit/basic/ConditionalDescriptionText.java"/>
<listEntry value="/de.gebit.integrity.tests/junit/de/gebit/integrity/tests/junit/basic/enums/namedResultEnumStuff.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
Expand All @@ -10,10 +10,10 @@
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.dsl&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.dsl.experimentation&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.dsl.runner.experimentation&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.dsl.ui&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.eclipse&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.jenkins&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.remoting&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.runner&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;javaProject name=&amp;quot;de.gebit.integrity.tests&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.jdt.launching.sourceContainer.javaProject&quot;/&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;default/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value="testTest"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="de.gebit.integrity.tests.junit.basic.ConditionalDescriptionText"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="de.gebit.integrity.tests.junit.basic.enums.namedResultEnumStuff"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="de.gebit.integrity.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DkeepFiles=true"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ packagedef integrity.fixtures.basic.noop with
calldef echoEnum uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#echoEnum
testdef echoEnumTest uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#echoEnum

calldef echoEnumNamedResult uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#echoEnumNamedResult
testdef echoEnumNamedResultTest uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#echoEnumNamedResult

calldef createEnumNamedResult uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#createEnumNamedResult
testdef createEnumNamedResultTest uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#createEnumNamedResult

calldef specificDescriptionTest_call uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#specificDescriptionTest
testdef specificDescriptionTest_test uses de.gebit.integrity.tests.fixtures.basic.NoOpFixture#specificDescriptionTest

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
packagedef integrity.basic.enums with

suitedef namedResultEnumTest with

test integrity.fixtures.basic.noop.createEnumNamedResultTest firstParameter = "foobar" secondParameter = 100 thirdParameter = VALUE1

test integrity.fixtures.basic.noop.createEnumNamedResultTest firstParameter = "foobar" secondParameter = 100 thirdParameter = VALUE2

suiteend


suitedef namedResultEnumTableTest with

tabletest integrity.fixtures.basic.noop.createEnumNamedResultTest
| firstParameter = | secondParameter = | thirdParameter = |
| "foobar" | 100 | VALUE1 |
| "foobar" | 100 | VALUE2 |
| "foobar" | 101 | VALUE1 |
| "footbar" | 100 | VALUE1 |

suiteend

packageend
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*******************************************************************************
* 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.enums;

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 very simple fixture calls.
*
*
* @author Rene Schneider - initial API and implementation
*
*/
public class namedResultEnumStuff extends IntegrityJUnitTest {

/**
* Performs a suite which does simple fixture calls and checks the resulting XML document.
*
* @throws ModelLoadException
* @throws IOException
* @throws JDOMException
*/
@Test
public void testTest() throws ModelLoadException, IOException, JDOMException {
Document tempResult = executeIntegritySuite(
new String[] { "integrity/suites/basic/enums/namedResultEnumTests.integrity" },
"integrity.basic.enums.namedResultEnumTest", null);
assertDocumentMatchesReference(tempResult);
}

/**
* Performs a suite which does simple fixture calls and checks the resulting XML document.
*
* @throws ModelLoadException
* @throws IOException
* @throws JDOMException
*/
@Test
public void testTableTest() throws ModelLoadException, IOException, JDOMException {
Document tempResult = executeIntegritySuite(
new String[] { "integrity/suites/basic/enums/namedResultEnumTests.integrity" },
"integrity.basic.enums.namedResultEnumTableTest", null);
assertDocumentMatchesReference(tempResult);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<integrity name="Integrity JUnit Testing" timestamp="23.01.14 17:20" isotimestamp="2014-01-23T17:20:05" duration="42.171">
<variables />
<suite id="0" name="integrity.basic.enums.namedResultEnumTableTest" timestamp="23.01.14 17:20:05.0303">
<setup />
<variables />
<statements>
<tabletest id="1" line="14" name="createEnumNamedResultTest" description="Creates a named result bean with an enum inside" fixture="de.gebit.integrity.tests.fixtures.basic.NoOpFixture#createEnumNamedResult" timestamp="23.01.14 17:20:05.0319">
<results duration="23.657" successCount="1" failureCount="3" exceptionCount="0">
<result duration="1.257" description="Creates a named result bean with an enum inside" type="success">
<parameters />
<comparisons>
<comparison name="firstParameter" expectedValue="foobar" value="foobar" type="success" />
<comparison name="secondParameter" expectedValue="100" value="100" type="success" />
<comparison name="thirdParameter" expectedValue="VALUE1" value="VALUE1" type="success" />
</comparisons>
</result>
<result duration="0.832" description="Creates a named result bean with an enum inside" type="failure">
<parameters />
<comparisons>
<comparison name="firstParameter" expectedValue="foobar" value="foobar" type="success" />
<comparison name="secondParameter" expectedValue="100" value="100" type="success" />
<comparison name="thirdParameter" expectedValue="VALUE2" value="VALUE1" type="failure" />
</comparisons>
</result>
<result duration="0.800" description="Creates a named result bean with an enum inside" type="failure">
<parameters />
<comparisons>
<comparison name="firstParameter" expectedValue="foobar" value="foobar" type="success" />
<comparison name="secondParameter" expectedValue="101" value="100" type="failure" />
<comparison name="thirdParameter" expectedValue="VALUE1" value="VALUE1" type="success" />
</comparisons>
</result>
<result duration="0.836" description="Creates a named result bean with an enum inside" type="failure">
<parameters />
<comparisons>
<comparison name="firstParameter" expectedValue="footbar" value="foobar" type="failure" />
<comparison name="secondParameter" expectedValue="100" value="100" type="success" />
<comparison name="thirdParameter" expectedValue="VALUE1" value="VALUE1" type="success" />
</comparisons>
</result>
</results>
</tabletest>
</statements>
<teardown />
<result duration="34.151" successCount="1" failureCount="3" exceptionCount="0" testExceptionCount="0" callExceptionCount="0" />
</suite>
</integrity>

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<integrity name="Integrity JUnit Testing" timestamp="23.01.14 17:20" isotimestamp="2014-01-23T17:20:19" duration="27.017">
<variables />
<suite id="0" name="integrity.basic.enums.namedResultEnumTest" timestamp="23.01.14 17:20:19.0822">
<setup />
<variables />
<statements>
<test id="1" line="5" name="createEnumNamedResultTest" description="Creates a named result bean with an enum inside" fixture="de.gebit.integrity.tests.fixtures.basic.NoOpFixture#createEnumNamedResult" timestamp="23.01.14 17:20:19.0837">
<results duration="1.046" successCount="1" failureCount="0" exceptionCount="0">
<result duration="1.046" description="Creates a named result bean with an enum inside" type="success">
<parameters />
<comparisons>
<comparison name="firstParameter" expectedValue="foobar" value="foobar" type="success" />
<comparison name="secondParameter" expectedValue="100" value="100" type="success" />
<comparison name="thirdParameter" expectedValue="VALUE1" value="VALUE1" type="success" />
</comparisons>
</result>
</results>
</test>
<test id="2" line="7" name="createEnumNamedResultTest" description="Creates a named result bean with an enum inside" fixture="de.gebit.integrity.tests.fixtures.basic.NoOpFixture#createEnumNamedResult" timestamp="23.01.14 17:20:19.0837">
<results duration="0.883" successCount="0" failureCount="1" exceptionCount="0">
<result duration="0.883" description="Creates a named result bean with an enum inside" type="failure">
<parameters />
<comparisons>
<comparison name="firstParameter" expectedValue="foobar" value="foobar" type="success" />
<comparison name="secondParameter" expectedValue="100" value="100" type="success" />
<comparison name="thirdParameter" expectedValue="VALUE2" value="VALUE1" type="failure" />
</comparisons>
</result>
</results>
</test>
</statements>
<teardown />
<result duration="22.189" successCount="1" failureCount="1" exceptionCount="0" testExceptionCount="0" callExceptionCount="0" />
</suite>
</integrity>

Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,60 @@ public Enum echoEnum(@FixtureParameter(name = "enum") Enum aValue) {
return aValue;
}

@FixtureMethod(description = "Returns a named result bean: $result$")
public EnumNamedResult echoEnumNamedResult(@FixtureParameter(name = "result") EnumNamedResult aValue) {
return aValue;
}

@FixtureMethod(description = "Creates a named result bean with an enum inside")
public EnumNamedResult createEnumNamedResult() {
EnumNamedResult tempResult = new EnumNamedResult();
tempResult.setFirstParameter("foobar");
tempResult.setSecondParameter(100);
tempResult.setThirdParameter(Enum.VALUE1);

return tempResult;
}

public enum Enum {

VALUE1,

VALUE2;

}

public class EnumNamedResult {

private String firstParameter;

private Integer secondParameter;

private Enum thirdParameter;

public String getFirstParameter() {
return firstParameter;
}

public void setFirstParameter(String firstParameter) {
this.firstParameter = firstParameter;
}

public Integer getSecondParameter() {
return secondParameter;
}

public void setSecondParameter(Integer secondParameter) {
this.secondParameter = secondParameter;
}

public Enum getThirdParameter() {
return thirdParameter;
}

public void setThirdParameter(Enum thirdParameter) {
this.thirdParameter = thirdParameter;
}

}
}

0 comments on commit 9019cf5

Please sign in to comment.