Skip to content
Permalink
Browse files

Support for OpenEdge 12.1

Read JAVA_HOME in $DLC/properties/java.properties
New proxygen file format
No more RestGen tests (task will be dropped)
  • Loading branch information...
gquerret committed Aug 14, 2019
1 parent 1836091 commit f459acc0d17259c7f02477871923f9483f1586fb
@@ -41,6 +41,7 @@ stage('Full tests') {
branch3: { testBranch('linux', 'JDK8', 'Ant 1.9', 'OpenEdge-11.7', false, '11.7-Linux') },
branch4: { testBranch('linux', 'Corretto 8', 'Ant 1.10', 'OpenEdge-12.0', false, '12.0-Linux') },
branch5: { testBranch('windows', 'Corretto 8', 'Ant 1.10', 'OpenEdge-12.0', true, '12.0-Win') },
branch6: { testBranch('windows', 'Corretto 8', 'Ant 1.10', 'OpenEdge-12.1', true, '12.1-Win') },
failFast: false

node('linux') {
@@ -50,13 +51,15 @@ stage('Full tests') {
unstash name: 'junit-11.7-Linux'
unstash name: 'junit-12.0-Linux'
unstash name: 'junit-12.0-Win'
unstash name: 'junit-12.1-Win'

sh "mkdir junitreports"
unzip zipFile: 'junitreports-11.7-Win.zip', dir: 'junitreports'
unzip zipFile: 'junitreports-11.6-Linux.zip', dir: 'junitreports'
unzip zipFile: 'junitreports-11.7-Linux.zip', dir: 'junitreports'
unzip zipFile: 'junitreports-12.0-Linux.zip', dir: 'junitreports'
unzip zipFile: 'junitreports-12.0-Win.zip', dir: 'junitreports'
unzip zipFile: 'junitreports-12.1-Win.zip', dir: 'junitreports'
junit 'junitreports/**/*.xml'
}
}
@@ -404,7 +404,7 @@
<zipfileset dir="${build-test}" includes="**/*" prefix="build/test" />
<zipfileset dir="tests" includes="**/*" prefix="testbox" />
<zipfileset dir="${src.progress}" includes="Consultingwerk/**/*" prefix="testbox/ClassDocumentation/test3/src" />
<zipfileset dir="lib" includes="ast.jar,ast-dependencies.jar,ini4j-0.5.1.jar,guava.jar,testng-6.13.1.jar,jcommander-1.30.jar,jacocoant-0.8.4.jar,*.pl" prefix="lib" />
<zipfileset dir="lib" includes="ast.jar,ast-dependencies.jar,ini4j-0.5.1.jar,guava.jar,testng-6.13.1.jar,jcommander-1.30.jar,jacocoant-0.8.4.jar,xmltask.jar,*.pl" prefix="lib" />
</zip>
</target>

BIN +74.4 KB lib/xmltask.jar
Binary file not shown.
@@ -17,6 +17,7 @@
package com.phenix.pct;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -26,6 +27,7 @@
import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -63,6 +65,8 @@
private File dlcBin = null;
private File dlcJava = null;
private File pdsHome = null;
private File jdk = null;
private File jre = null;
private boolean includedPL = true;

// Internal use
@@ -104,7 +108,9 @@ public final void setDlcHome(File dlcHome) {
throw new BuildException(caught);
}

if (version.compareTo(new DLCVersion(12, 0, "0")) >= 0)
if (version.compareTo(new DLCVersion(12, 1, "0")) >= 0)
this.pp = new ProgressV121();
else if (version.compareTo(new DLCVersion(12, 0, "0")) >= 0)
this.pp = new ProgressV12();
else if (version.compareTo(new DLCVersion(11, 7, "0")) >= 0)
this.pp = new ProgressV117();
@@ -121,6 +127,29 @@ else if (version.compareTo(new DLCVersion(10, 0, "A")) >= 0)
else
throw new BuildException("Invalid Progress version : " + version.toString());
log("Using object : " + pp.getClass().getName(), Project.MSG_VERBOSE);

if (pp.externalJDK()) {
try (InputStream input = new FileInputStream (new File(dlcHome, "properties/java.properties"))) {
Properties props = new Properties();
props.load(input);
String str = props.getProperty("JAVA_HOME");
if (str == null)
log("No JAVA_HOME property", Project.MSG_ERR);
else {
jdk = new File(str);
jre = new File(jdk, "jre");
if (!jdk.exists())
log("JAVA_HOME '" + jdk.getAbsolutePath() + "' directory doesn't exist")
;
}
} catch (IOException uncaught) {
log("Unable to open file $DLC/properties/java.properties", Project.MSG_ERR);
}
} else {
jdk = new File(dlcHome, "jdk");
jre = new File(dlcHome, "jre");
}

}

public void setPdsHome(File pdsHome) {
@@ -211,15 +240,15 @@ protected final File getDlcHome() {
}

protected final File getJRE() {
return new File(dlcHome, "jre");
return jre;
}

protected final File getJDK() {
return new File(dlcHome, "jdk");
return jdk;
}

protected final File getJDKBin() {
return new File(getJDK(), "bin");
return new File(jdk, "bin");
}

protected final File getPdsHome() {
@@ -19,7 +19,6 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Environment;
import org.apache.tools.ant.types.Resource;
@@ -141,9 +140,7 @@ public void execute() {
// This caused problems with JUnit testing, as I think there are System.exit statements
// in proxygen code
pxg.setFork(true);
// No included JDK on UNIX
if (Os.isFamily(Os.FAMILY_WINDOWS))
pxg.setJvm(getJVM().getAbsolutePath());
pxg.setJvm(getJVM().getAbsolutePath());
if (this.workingDirectory != null) {
pxg.setDir(this.workingDirectory);
}
@@ -200,20 +197,22 @@ private void executeProxygen(File pxgFile) {
Environment.Variable var = new Environment.Variable();
// Bug #1311746 : mixed case extension are not handled correctly
// So, at first extract extension and then compare ignore case
int ext_pos = pxgFile.toString().lastIndexOf('.');
String extension = (ext_pos == -1 ? "" : pxgFile.toString().substring(ext_pos));
if (extension.equalsIgnoreCase(".xpxg")) //$NON-NLS-1$
int extPos = pxgFile.toString().lastIndexOf('.');
String extension = (extPos == -1 ? "" : pxgFile.toString().substring(extPos));
if (".xpxg".equalsIgnoreCase(extension)) //$NON-NLS-1$
var.setKey("XPXGFile"); //$NON-NLS-1$
else
var.setKey("PXGFile"); //$NON-NLS-1$
var.setValue(pxgFile.toString());
pxgTask.addSysproperty(var);

boolean fail = false;
File baseDir = workingDirectory == null ? new File(".") : workingDirectory;
File pxgLogFile = null; // Generated by proxygen itself
try {
pxgTask.execute();
} catch (BuildException caught) {
// Thrown later
fail = true;
}

@@ -230,7 +229,7 @@ private void executeProxygen(File pxgFile) {
log(str, Project.MSG_INFO);
}
if ((pxgLogFile == null) && (str.startsWith("For details see the log file"))) {
pxgLogFile = new File(str.substring(29).trim());
pxgLogFile = new File(baseDir, str.substring(29).trim());
}
}
} catch (IOException caught) {
@@ -47,4 +47,5 @@
String getOutputParameterCall();
String getQuit();
String getXCodeSessionKey();
boolean externalJDK();
}
@@ -143,6 +143,11 @@ public String getXCodeSessionKey() {
return getString("ProgressV10.16"); //$NON-NLS-1$
}

@Override
public boolean externalJDK() {
return false;
}

public String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
@@ -143,6 +143,11 @@ public String getXCodeSessionKey() {
return getString("ProgressV11.16"); //$NON-NLS-1$
}

@Override
public boolean externalJDK() {
return false;
}

public String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
@@ -143,6 +143,11 @@ public String getXCodeSessionKey() {
return getString("ProgressV12.16"); //$NON-NLS-1$
}

@Override
public boolean externalJDK() {
return false;
}

public String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
@@ -0,0 +1,25 @@
/**
* Copyright 2005-2019 Riverside Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.phenix.pct;

public class ProgressV121 extends ProgressV12 {

@Override
public boolean externalJDK() {
return true;
}
}
@@ -20,24 +20,27 @@
import static org.testng.Assert.assertTrue;

import java.io.File;
import java.io.IOException;

import org.apache.tools.ant.BuildException;
import org.testng.annotations.Test;

import com.phenix.pct.RCodeInfo.InvalidRCodeException;

/**
* Class for testing PCTProxygen task
*
* @author <a href="mailto:g.querret+PCT@gmail.com">Gilles QUERRET</a>
*/
public class PCTProxygenTest extends BuildFileTestNg {

@Test(groups = { "v10" }, expectedExceptions = BuildException.class)
@Test(groups = { "v10", "nov12" }, expectedExceptions = BuildException.class)
public void test1() {
configureProject("PCTProxygen/test1/build.xml");
executeTarget("test");
}

@Test(groups = { "v10", "win" })
@Test(groups = { "v10", "win", "nov12" })
public void test2() {
configureProject("PCTProxygen/test2/build.xml");
executeTarget("prepare");
@@ -54,7 +57,7 @@ public void test2() {
assertTrue(f3.exists());
}

@Test(groups = { "v11", "win" })
@Test(groups = { "v11", "win", "nov12" })
public void test3() {
configureProject("PCTProxygen/test3/build.xml");
executeTarget("prepare");
@@ -68,7 +71,7 @@ public void test3() {
assertTrue(f2.exists());
}

@Test(groups = { "v10", "win" })
@Test(groups = { "v10", "win", "nov12" })
public void test4() {
configureProject("PCTProxygen/test4/build.xml");
executeTarget("prepare");
@@ -87,6 +90,18 @@ public void test4() {

@Test(groups = { "v11", "win" })
public void test5() {
// Old file format, only for 12.0
try {
DLCVersion version = DLCVersion.getObject(new File(System.getProperty("DLC")));
if ((version.getMajorVersion() > 12)
|| ((version.getMajorVersion() == 12) && (version.getMinorVersion() >= 1)))
return;
} catch (IOException e) {
return;
} catch (InvalidRCodeException e) {
return;
}

configureProject("PCTProxygen/test5/build.xml");
executeTarget("prepare");

@@ -100,4 +115,27 @@ public void test5() {
assertTrue(f3.exists());
assertTrue(f4.exists());
}

@Test(groups = { "v12", "win" })
public void test6() {
// New file format in 12.1
try {
DLCVersion version = DLCVersion.getObject(new File(System.getProperty("DLC")));
if ((version.getMajorVersion() == 12) && (version.getMinorVersion() == 0))
return;
} catch (IOException e) {
return;
} catch (InvalidRCodeException e) {
return;
}

configureProject("PCTProxygen/test6/build.xml");
executeTarget("prepare");

executeTarget("test1");
File f1 = new File("PCTProxygen/test6/build-pxg1/Test.class");
File f2 = new File("PCTProxygen/test6/build-pxg1/TestImpl.class");
assertTrue(f1.exists());
assertTrue(f2.exists());
}
}
@@ -28,7 +28,7 @@
*/
public class RestGenTest extends BuildFileTestNg {

@Test(groups = {"v11", "win"})
@Test(groups = {"v11", "win", "nov12"})
public void test1() {
configureProject("RestGen/test1/build.xml");
executeTarget("test");
@@ -68,6 +68,8 @@
<!-- Only in testXX, test cases with number greater than 100 are reserved for PCTCompileExt -->
<replace dir="testbox/PCTCompileExt" includes="test??/build.xml" token="PCTCompile" value="PCTCompileExt" />
<replace dir="testbox/PCTCompileExt" includes="test??/build.xml" token="pct:compile" value="pct:compile_ext" />
<echo message="Using Ant '${ant.version}' in '${ant.home}'" />
<echo message="Using Java ${ant.java.version} - Java home: ${java.home}" />
</target>

<target name="test">

0 comments on commit f459acc

Please sign in to comment.
You can’t perform that action at this time.