Skip to content

Commit

Permalink
Merged changes due to lost repo connection. Should reestablish 1.0-RC3.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsticks committed Mar 8, 2015
1 parent 3d7a4fe commit 9d66fb3
Show file tree
Hide file tree
Showing 18 changed files with 297 additions and 285 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
money-tck.iml
.project
.classpath
../../git/jsr354-tck/money-tck.iml
target/
test-output/
*.iml
Expand Down
7 changes: 6 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ To setup the TCK with your implementation you must follow the following steps:

To execute the TCK, simply execute

mvn clean test site
mvn clean test site

5) Go to target/site - there you will find your TCK test results.


As jump-start you can clone https://github.com/JavaMoney/jsr354-ritest .

The JSR 354 Team.



47 changes: 37 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<parent>
<groupId>org.javamoney</groupId>
<artifactId>javamoney-parent</artifactId>
<version>1.0-RC2</version>
<version>1.0-RC3</version>
</parent>

<artifactId>javamoney-tck</artifactId>
<packaging>jar</packaging>

<version>1.0-SNAPSHOT</version>
<version>1.0-RC3</version>

<name>JSR 354 (TCK)</name>
<url>http://java.net/projects/javamoney</url>
Expand All @@ -46,7 +46,7 @@
</licenses>

<properties>
<jsr.version>1.0-SNAPSHOT</jsr.version>
<jsr.version>1.0-RC3</jsr.version>
<jdkVersion>1.8</jdkVersion>
<maven.compile.targetLevel>${jdkVersion}</maven.compile.targetLevel>
<maven.compile.sourceLevel>${jdkVersion}</maven.compile.sourceLevel>
Expand Down Expand Up @@ -389,6 +389,21 @@
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.2</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>1.5.0-alpha.6</version>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>src/main/asciidoc</sourceDirectory>
<baseDir>${project.basedir}</baseDir>
<imagesDir>src/main/asciidoc/images/</imagesDir>
<embedAssets>true</embedAssets>
<!-- eruby>erubis</eruby -->
</configuration>
<executions>
<execution>
<id>output-html</id>
Expand All @@ -398,16 +413,28 @@
</goals>
<configuration>
<outputDirectory>target/docs</outputDirectory>
<sourceHighlighter>highlightjs</sourceHighlighter>
<sourceHighlighter>coderay</sourceHighlighter>
<backend>html</backend>
<embedAssets>true</embedAssets>
<imagesDir>arc/main/asciidoc/images</imagesDir>
</configuration>
</execution>
<!-- execution> <id>output-pdf</id> <phase>generate-resources</phase>
<goals> <goal>process-asciidoc</goal> </goals> <configuration> <outputDirectory>target/docs</outputDirectory>
<sourceHighlighter>highlightjs</sourceHighlighter> <backend>pdf</backend>
</configuration> </execution -->
<execution>
<id>output-pdf</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<!-- WARNING callout bullets don't yet work with CodeRay -->
<sourceHighlighter>coderay</sourceHighlighter>
<attributes>
<pagenums/>
<toc/>
<idprefix/>
<idseparator>-</idseparator>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
* @author Anatole Tresch
*/
public interface JSR354TestConfiguration{
public interface JSR354TestConfiguration {

/**
* Return a collection with all {@link MonetaryAmount} classes that are implemented. The list
Expand Down
88 changes: 39 additions & 49 deletions src/main/java/org/javamoney/tck/TCKRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* Main class for executing the JSR 354 TCK.
* Created by Anatole on 12.06.2014.
*/
public class TCKRunner extends XmlSuite{
public TCKRunner(){
public class TCKRunner extends XmlSuite {
public TCKRunner() {
setName("JSR354-TCK 1.0");
XmlTest test = new XmlTest(this);
test.setName("TCK/Test Setup");
Expand All @@ -55,7 +55,7 @@ public TCKRunner(){
test.setXmlClasses(classes);
}

public static void main(String... args){
public static void main(String... args) {
System.out.println("-- JSR 354 TCK started --");
List<XmlSuite> suites = new ArrayList<>();
suites.add(new TCKRunner());
Expand All @@ -72,7 +72,7 @@ public static void main(String... args){
System.out.println("-- JSR 354 TCK finished --");
}

public static final class TCKReporter extends TestListenerAdapter{
public static final class TCKReporter extends TestListenerAdapter {
private int count = 0;
private int skipped = 0;
private int failed = 0;
Expand All @@ -81,101 +81,92 @@ public static final class TCKReporter extends TestListenerAdapter{
private StringWriter internalBuffer = new StringWriter(3000);
private FileWriter w;

public TCKReporter(File file){
try{
if(!file.exists()){
public TCKReporter(File file) {
try {
if (!file.exists()) {
file.createNewFile();
}
w = new FileWriter(file);
w.write("*****************************************************************************************\n");
w.write("**** JSR 354 - Money & Currency, Technical Compatibility Kit, version 1.0\n");
w.write("*****************************************************************************************\n\n");
w.write("Executed on " + new java.util.Date() +"\n\n" );
w.write("Executed on " + new java.util.Date() + "\n\n");

// System.out:
internalBuffer.write("*****************************************************************************************\n");
internalBuffer.write("**** JSR 354 - Money & Currency, Technical Compatibility Kit, version 1.0\n");
internalBuffer.write("*****************************************************************************************\n\n");
internalBuffer.write("Executed on " + new java.util.Date() + "\n\n");
}
catch(IOException e){
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}

@Override
public void onTestFailure(ITestResult tr){
public void onTestFailure(ITestResult tr) {
failed++;
String location = tr.getTestClass().getRealClass().getSimpleName()+'#'+tr.getMethod().getMethodName();
try{
String location = tr.getTestClass().getRealClass().getSimpleName() + '#' + tr.getMethod().getMethodName();
try {
Method realTestMethod = tr.getMethod().getMethod();
Test testAnnot = realTestMethod.getAnnotation(Test.class);
if(testAnnot!=null && testAnnot.description()!=null && !testAnnot.description().isEmpty()){
if(tr.getThrowable()!=null){
if (testAnnot != null && testAnnot.description() != null && !testAnnot.description().isEmpty()) {
if (tr.getThrowable() != null) {
StringWriter sw = new StringWriter();
PrintWriter w = new PrintWriter(sw);
tr.getThrowable().printStackTrace(w);
w.flush();
log("[FAILED] " + testAnnot.description() + "("+location+"):\n"+sw.toString());
}
else{
log("[FAILED] " + testAnnot.description()+ "("+location+")");
log("[FAILED] " + testAnnot.description() + "(" + location + "):\n" + sw.toString());
} else {
log("[FAILED] " + testAnnot.description() + "(" + location + ")");
}
}
else{
} else {

if(tr.getThrowable()!=null){
if (tr.getThrowable() != null) {
StringWriter sw = new StringWriter();
PrintWriter w = new PrintWriter(sw);
tr.getThrowable().printStackTrace(w);
w.flush();
log("[FAILED] " + location + ":\n"+sw.toString());
}
else{
log("[FAILED] " + location + ":\n" + sw.toString());
} else {
log("[FAILED] " + location);
}
}
}
catch(IOException e){
} catch (IOException e) {
throw new IllegalStateException("IO Error", e);
}
}

@Override
public void onTestSkipped(ITestResult tr){
public void onTestSkipped(ITestResult tr) {
skipped++;
String location = tr.getTestClass().getRealClass().getSimpleName()+'#'+tr.getMethod().getMethodName();
try{
String location = tr.getTestClass().getRealClass().getSimpleName() + '#' + tr.getMethod().getMethodName();
try {
Method realTestMethod = tr.getMethod().getMethod();
Test specAssert = realTestMethod.getAnnotation(Test.class);
if(specAssert!=null && specAssert.description()!=null && !specAssert.description().isEmpty()){
log("[SKIPPED] " + specAssert.description()+ "("+location+")");
}
else{
if (specAssert != null && specAssert.description() != null && !specAssert.description().isEmpty()) {
log("[SKIPPED] " + specAssert.description() + "(" + location + ")");
} else {
log("[SKIPPED] " + location);
}
}
catch(IOException e){
} catch (IOException e) {
throw new IllegalStateException("IO Error", e);
}
}

@Override
public void onTestSuccess(ITestResult tr){
public void onTestSuccess(ITestResult tr) {
success++;
String location = tr.getTestClass().getRealClass().getSimpleName()+'#'+tr.getMethod().getMethodName();
try{
String location = tr.getTestClass().getRealClass().getSimpleName() + '#' + tr.getMethod().getMethodName();
try {
Method realTestMethod = tr.getMethod().getMethod();
Test specAssert = realTestMethod.getAnnotation(Test.class);
if(specAssert!=null && specAssert.description()!=null && !specAssert.description().isEmpty()){
log("[SUCCESS] " + specAssert.description()+ "("+location+")");
}
else{
if (specAssert != null && specAssert.description() != null && !specAssert.description().isEmpty()) {
log("[SUCCESS] " + specAssert.description() + "(" + location + ")");
} else {
log("[SUCCESS] " + location);
}
}
catch(IOException e){
} catch (IOException e) {
throw new IllegalStateException("IO Error", e);
}
}
Expand All @@ -188,8 +179,8 @@ private void log(String text) throws IOException {
internalBuffer.write('\n');
}

public void writeSummary(){
try{
public void writeSummary() {
try {
log("\nJSR 354 TCP version 1.0 Summary");
log("-------------------------------");
log("\nTOTAL TESTS EXECUTED : " + count);
Expand All @@ -201,8 +192,7 @@ public void writeSummary(){
internalBuffer.flush();
System.out.println();
System.out.println(internalBuffer);
}
catch(IOException e){
} catch (IOException e) {
throw new IllegalStateException("IO Error", e);
}
}
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/org/javamoney/tck/TCKTestSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@

public final class TCKTestSetup {

private static JSR354TestConfiguration TEST_CONFIG = loadTestConfiguration();
private static JSR354TestConfiguration TEST_CONFIG = loadTestConfiguration();

private TCKTestSetup() {
}
private TCKTestSetup() {
}

private static JSR354TestConfiguration loadTestConfiguration() {
try {
return ServiceLoader.load(JSR354TestConfiguration.class).iterator()
.next();
} catch (Exception e) {
throw new IllegalStateException("No valid implementation of "
+ JSR354TestConfiguration.class.getName()
+ " is registered with the ServiceLoader.");
}
}
private static JSR354TestConfiguration loadTestConfiguration() {
try {
return ServiceLoader.load(JSR354TestConfiguration.class).iterator()
.next();
} catch (Exception e) {
throw new IllegalStateException("No valid implementation of "
+ JSR354TestConfiguration.class.getName()
+ " is registered with the ServiceLoader.");
}
}

public static JSR354TestConfiguration getTestConfiguration() {
return TEST_CONFIG;
}
public static JSR354TestConfiguration getTestConfiguration() {
return TEST_CONFIG;
}

}
14 changes: 7 additions & 7 deletions src/main/java/org/javamoney/tck/TCKValidationException.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

public final class TCKValidationException extends RuntimeException {

private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;

public TCKValidationException(String message) {
super(message);
}
public TCKValidationException(String message) {
super(message);
}

public TCKValidationException(String message, Throwable e) {
super(message, e);
}
public TCKValidationException(String message, Throwable e) {
super(message, e);
}

}
Loading

0 comments on commit 9d66fb3

Please sign in to comment.