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

JSP TCK Refactoring using Arquillian and JUnit #1182

Merged
merged 17 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package com.sun.ts.tests.common.webclient;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -94,6 +95,8 @@ public class WebTestCase implements TestCase {
*/
private String _goldenfilePath = null;

private InputStream _goldenfileStream = null;

/**
* A List of strings that will be searched for in the response in the order
* they appear in the list.
Expand Down Expand Up @@ -227,6 +230,17 @@ public void setGoldenFilePath(String gfPath) {
_goldenfilePath = gfPath;
}


/**
* Sets the InputStream of the goldenfile the test case should use.
*
* @param in
* an InputStream value of the goldenfile.
*/
public void setGoldenFileStream(InputStream in) {
_goldenfileStream = in;
}

/**
* Sets the request that should be dispatched by this test case.
*
Expand Down Expand Up @@ -458,6 +472,15 @@ public String getGoldenfilePath() {
return _goldenfilePath;
}

/**
* Returns the InputStream of the goldenfile.
*
* @return InputStream of the goldenfile
*/
public InputStream getGoldenfileStream() {
return _goldenfileStream;
}

/**
* Returns the state for this particular test case.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

package com.sun.ts.tests.common.webclient.validation;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.tests.common.webclient.Goldenfile;
import com.sun.ts.tests.common.webclient.Util;

/**
* <pre>
Expand Down Expand Up @@ -63,7 +65,7 @@ public TokenizedValidator() {
* if an error occurs will processing the Goldenfile
*/
protected boolean checkGoldenfile() throws IOException {
String gf;
String gf = null;
String path = _case.getGoldenfilePath();
String enc = _res.getResponseEncoding();

Expand All @@ -74,7 +76,13 @@ protected boolean checkGoldenfile() throws IOException {
Goldenfile file = new Goldenfile(_case.getGoldenfilePath(), enc);

try {
gf = file.getGoldenFileAsString();
File goldenFile = new File(_case.getGoldenfilePath());
if(goldenFile.exists()){
gf = file.getGoldenFileAsString();
}
else if(_case.getGoldenfileStream()!=null){
gf = Util.getEncodedStringFromStream(_case.getGoldenfileStream(), enc);
}
} catch (IOException ioe) {
TestUtil
.logErr("[TokenizedValidator] Unexpected exception while accessing "
Expand Down
17 changes: 17 additions & 0 deletions glassfish-runner/jsp-tck/j2ee.pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#
# Copyright (c) 2023 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
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
#
AS_ADMIN_USERPASSWORD=j2ee
16 changes: 16 additions & 0 deletions glassfish-runner/jsp-tck/javajoe.pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright (c) 2023 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
# http://www.eclipse.org/legal/epl-2.0.
#
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the
# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
# version 2 with the GNU Classpath Exception, which is available at
# https://www.gnu.org/software/classpath/license.html.
#
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
#
AS_ADMIN_USERPASSWORD=javajoe
Loading
Loading