Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework TCK to Junit5 #297

Merged
merged 7 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<junit.jupiter.version>5.7.2</junit.jupiter.version>
<arquillian.junit5.version>1.7.0.Alpha5</arquillian.junit5.version>
</properties>

<dependencies>
Expand All @@ -72,14 +74,20 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.6.0.Final</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<version>${arquillian.junit5.version}</version>
</dependency>
</dependencies>

</project>
711 changes: 356 additions & 355 deletions tck/tck-common/src/main/java/jakarta/jsonp/tck/common/JSONP_Util.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -22,6 +22,7 @@


import java.io.*;
import java.util.logging.Logger;

// A wrapper class to BufferedInputStream class used to inject IOException errors
// when the throwIOException instance variable is set. All methods delegate
Expand All @@ -30,6 +31,8 @@

public class MyBufferedInputStream extends BufferedInputStream {

private static final Logger LOGGER = Logger.getLogger(MyBufferedInputStream.class.getName());

private boolean throwIOException = false;

public MyBufferedInputStream(InputStream in) {
Expand All @@ -47,7 +50,7 @@ public MyBufferedInputStream(InputStream in, boolean throwIOException) {

private void checkToTripIOException() throws IOException {
if (throwIOException) {
System.out.println(
LOGGER.info(
"MyBufferedInputStream->checkToTripIOException: *** tripping an IOException ***");
throw new IOException("tripping an IOException");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -22,6 +22,7 @@


import java.io.*;
import java.util.logging.Logger;

// A wrapper class to BufferedReader class used to inject IOException errors
// when the throwIOException instance variable is set. All methods delegate
Expand All @@ -30,6 +31,8 @@

public class MyBufferedReader extends BufferedReader {

private static final Logger LOGGER = Logger.getLogger(MyBufferedReader.class.getName());

private boolean throwIOException;

public MyBufferedReader(Reader in) {
Expand All @@ -47,7 +50,7 @@ public MyBufferedReader(Reader in, int sz, boolean throwIOException) {

private void checkToTripIOException() throws IOException {
if (throwIOException) {
System.out.println("*** tripping an IOException ***");
LOGGER.info("*** tripping an IOException ***");
throw new IOException("tripping an IOException");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -22,6 +22,7 @@


import java.io.*;
import java.util.logging.Logger;

// A wrapper class to BufferedWriter class used to inject IOException errors
// when the throwIOException instance variable is set. All methods delegate
Expand All @@ -30,6 +31,8 @@

public class MyBufferedWriter extends BufferedWriter {

private static final Logger LOGGER = Logger.getLogger(MyBufferedWriter.class.getName());

private boolean throwIOException;

public MyBufferedWriter(Writer out) {
Expand All @@ -47,7 +50,7 @@ public MyBufferedWriter(Writer out, int sz, boolean throwIOException) {

private void checkToTripIOException() throws IOException {
if (throwIOException) {
System.out.println("*** tripping an IOException ***");
LOGGER.info("*** tripping an IOException ***");
throw new IOException("tripping an IOException");
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -49,22 +49,24 @@
package jakarta.jsonp.tck.util;

import java.io.*;
import java.util.logging.Logger;

public class FileUTFConverter {

private static final Logger LOGGER = Logger.getLogger(FileUTFConverter.class.getName());

private static final String USAGE = "Usage : java FileUTFConverter [-toUTF|-fromUTF] encoding infile outfile";

public static void main(String args[]) {
try {
if (args.length != 4) {
System.err.println(USAGE);
LOGGER.warning(USAGE);
System.exit(1);
}

// Convert UTF-8 input file to specified UTF encoded output file
if (args[0].equals("-toUTF")) {
System.out
.println("FileUTFConverter-> convert UTF-8 encoded input file ("
LOGGER.info("FileUTFConverter-> convert UTF-8 encoded input file ("
+ args[2] + "), to encoding (" + args[1]
+ ") and write to output file (" + args[3] + ")");
FileInputStream fis = new FileInputStream(args[2]);
Expand All @@ -81,7 +83,7 @@ public static void main(String args[]) {
br.close();
// Convert specified UTF encoded input file to UTF-8 encoded output file
} else if (args[0].equals("-fromUTF")) {
System.out.println("FileUTFConverter-> convert UTF encoded input file ("
LOGGER.info("FileUTFConverter-> convert UTF encoded input file ("
+ args[2] + "), from encoding (" + args[1]
+ ") and write to UTF-8 encoded output file (" + args[3] + ")");
FileInputStream fis = new FileInputStream(args[2]);
Expand All @@ -97,7 +99,7 @@ public static void main(String args[]) {
bw.close();
br.close();
} else {
System.err.println(USAGE);
LOGGER.warning(USAGE);
System.exit(1);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -21,6 +21,7 @@
package jakarta.jsonp.tck.util;

import java.io.*;
import java.util.logging.Logger;

/*
* Used to generate an encoded file preceded by N null characters.
Expand All @@ -32,13 +33,15 @@
*/
public class MyEncoder {

private static final Logger LOGGER = Logger.getLogger(MyEncoder.class.getName());

private static final int NULL = '\0';

private static final String USAGE = "Usage : java MyEncoder #nulls infile outfile";

public static void main(String args[]) {
if (args.length != 3) {
System.err.println(USAGE);
LOGGER.warning(USAGE);
System.exit(1);
}

Expand All @@ -50,12 +53,11 @@ public static void main(String args[]) {
inputStream = new FileReader(args[1]);
outputStream = new FileWriter(args[2]);

System.out.println("Null chars: " + args[0]);
System.out.println("Input file: " + args[1]);
System.out.println("Output file: " + args[2]);
LOGGER.info("Null chars: " + args[0]);
LOGGER.info("Input file: " + args[1]);
LOGGER.info("Output file: " + args[2]);

System.out
.println("\nCreating an encoded file with each char preceded by " + n
LOGGER.info("\nCreating an encoded file with each char preceded by " + n
+ " null chars.\n");

int c;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -34,20 +34,23 @@
package jakarta.jsonp.tck.util;

import java.io.*;
import java.util.logging.Logger;

public class StringUTFConverter {

private static final Logger LOGGER = Logger.getLogger(StringUTFConverter.class.getName());

private static final String USAGE = "Usage : java StringUTFConverter inputstring encoding outputfile";

public static void main(String args[]) {
try {
if (args.length != 3) {
System.err.println(USAGE);
LOGGER.warning(USAGE);
System.exit(1);
}

// Convert string to specified UTF encoded output file
System.out.println(
LOGGER.info(
"StringtoUTF-> convert string (" + args[0] + "), to encoding ("
+ args[1] + ") and write to output file (" + args[2] + ")");
FileOutputStream fos = new FileOutputStream(args[2]);
Expand Down
Loading