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

Install errors and messages #29060

Merged
merged 13 commits into from
Jul 18, 2024
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
17 changes: 12 additions & 5 deletions dev/com.ibm.ws.install.featureUtility_fat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021, 2023 IBM Corporation and others.
/* Copyright (c) 2021, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -13,12 +13,14 @@
addRequiredLibraries {
configurations {
usrFeatures
features
features1
features2
}

dependencies {
usrFeatures 'test.featureUtility_fat:userFeature:1.0@zip'
features 'test.featureUtility_fat:Archive:1.0@zip'
features1 'test.featureUtility_fat:Archive:1.0@zip'
features2 'test.featureUtility_fat:Archive:2.0@zip'
requiredLibs project(':com.ibm.ws.org.slf4j.api'),
project(':com.ibm.ws.org.slf4j.simple')
}
Expand All @@ -29,8 +31,13 @@ addRequiredLibraries {
}

copy {
from configurations.features
into "publish/repo/archive"
from configurations.features1
into "publish/repo/archive1"
}

copy {
from configurations.features2
into "publish/repo/archive2"
}

dependsOn copyTestContainers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2021 IBM Corporation and others.
* Copyright (c) 2019, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand All @@ -25,7 +25,7 @@
@RunWith(Suite.class)
@SuiteClasses({

InstallFeatureTest.class, InstallServerTest.class, HelpActionTest.class
InstallFeatureTest.class, InstallServerTest.class, HelpActionTest.class, InstallVersionlessServerTest.class

})
public class FATSuite extends TestContainerSuite {
Expand All @@ -38,8 +38,9 @@ public class FATSuite extends TestContainerSuite {
@BeforeClass
public static void beforeSuite() throws Exception {
FeatureUtilityToolTest.setupEnv();
FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/userFeature/userFeature-1.0.zip"));
FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/archive/Archive-1.0.zip"));
FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/").toAbsolutePath().toString(),Paths.get("publish/repo/userFeature/userFeature-1.0.zip"));
FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo/").toAbsolutePath().toString(),Paths.get("publish/repo/archive1/Archive-1.0.zip"));
FeatureUtilityToolTest.constructLocalMavenRepo(Paths.get("publish/repo2/").toAbsolutePath().toString(),Paths.get("publish/repo/archive2/Archive-2.0.zip")); //New repo has versionless features
}

@AfterClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public abstract class FeatureUtilityToolTest {

protected static String libertyVersion = "23.0.0.2";
// ${buildDir}/publish/repo
protected static String mavenLocalRepo = Paths.get("publish/repo/").toAbsolutePath().toString();
protected static String mavenLocalRepo1 = Paths.get("publish/repo/").toAbsolutePath().toString();
protected static String mavenLocalRepo2 = Paths.get("publish/repo2/").toAbsolutePath().toString();
public static LibertyServer server;
private static String installRoot;
static String minifiedRoot;
Expand Down Expand Up @@ -94,7 +95,8 @@ protected static void setupEnv() throws Exception {
minifiedRoot = exportWlp(installRoot, installRoot + "/../temp/wlp.zip", installRoot + relativeMinifiedRoot);
Log.info(c, methodName, "minified root: " + minifiedRoot);

Log.info(c, methodName, "mavenLocalRepo : " + mavenLocalRepo.toString());
Log.info(c, methodName, "mavenLocalRepo1 : " + mavenLocalRepo1.toString());
Log.info(c, methodName, "mavenLocalRepo2 : " + mavenLocalRepo2.toString());

if(!new File(minifiedRoot).exists()){
throw new Exception("The minified root does not exist!");
Expand Down Expand Up @@ -372,8 +374,8 @@ protected ProgramOutput runFeatureUtility(String testcase, String[] params) thro

protected ProgramOutput runFeatureUtility(String testcase, String[] params, boolean debug) throws Exception {
Properties envProps = new Properties();
// add beta property here
// envProps.put("JVM_ARGS", "-Dbeta.property=true");
//add beta property here
envProps.put("JVM_ARGS", "-Dbeta.property=true");
return runFeatureUtility(testcase, params, envProps);
}

Expand Down Expand Up @@ -418,8 +420,10 @@ protected static boolean deleteProps(String methodName) throws IOException {
}

protected static boolean deleteRepo(String methodName) throws IOException {
boolean repo = TestUtils.deleteFolder(new File(mavenLocalRepo));
Log.info(c, methodName, "DELETED REPO : " + mavenLocalRepo + "?" + repo);
boolean repo = TestUtils.deleteFolder(new File(mavenLocalRepo1));
Log.info(c, methodName, "DELETED REPO : " + mavenLocalRepo1 + "?" + repo);
repo = TestUtils.deleteFolder(new File(mavenLocalRepo2));
Log.info(c, methodName, "DELETED REPO : " + mavenLocalRepo2 + "?" + repo);
return repo;
}

Expand Down Expand Up @@ -507,18 +511,6 @@ protected static void checkCommandOutput(ProgramOutput po, int exitCode, String

}

/*
* / Copy Maven central features and signatures to local repository
*/
protected static void constructLocalMavenRepo(Path artifactPath) throws Exception {
Log.info(c, "constructLocalMavenRepo",
"Creating local repository using " + artifactPath.toAbsolutePath().toString());

ZipFile zipFile = new ZipFile(artifactPath.toFile());
TestUtils.unzipFileIntoDirectory(zipFile, Paths.get(mavenLocalRepo).toFile());
Log.info(c, "constructLocalMavenRepo", "Unzipped to " + Paths.get(mavenLocalRepo).toAbsolutePath().toString());

}

/**
* @param METHOD_NAME
Expand All @@ -542,5 +534,18 @@ protected void retryFeatureUtility(String METHOD_NAME) throws Exception {
runFeatureUtility(METHOD_NAME, param1s);
}

/*
* / Copy Maven central features and signatures to local repository
*/
protected static void constructLocalMavenRepo(String repoPath,Path artifactPath) throws Exception {
Log.info(c, "constructLocalMavenRepo",
"Creating local repository using " + artifactPath.toAbsolutePath().toString());

ZipFile zipFile = new ZipFile(artifactPath.toFile());
TestUtils.unzipFileIntoDirectory(zipFile, Paths.get(repoPath).toFile());
Log.info(c, "constructLocalMavenRepo", "Unzipped to " + Paths.get(repoPath).toAbsolutePath().toString());

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static void beforeClassSetup() throws Exception {
public void beforeSetUp() throws Exception {
copyFileToMinifiedRoot("etc",
"publish/propertyFiles/publishRepoOverrideProps/featureUtility.properties");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo);
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo1);
}

@After
Expand Down Expand Up @@ -162,7 +162,7 @@ public void testInstallFeatureESA() throws Exception {
String esaFile = String.format("/io/openliberty/features/json-1.0/%s/json-1.0-%s.esa", libertyVersion,
libertyVersion);
//copy json esa file from local Maven repo to a temporary location (wlp/tmp)
copyFileToMinifiedRoot("tmp", mavenLocalRepo + esaFile);
copyFileToMinifiedRoot("tmp", mavenLocalRepo1 + esaFile);
// Begin Test
String[] param1s = { "installFeature", minifiedRoot + "/tmp/" + String.format("json-1.0-%s.esa", libertyVersion), "--verbose" };
String[] filesList = { "lib/features/com.ibm.websphere.appserver.json-1.0.mf" };
Expand Down Expand Up @@ -589,7 +589,7 @@ public void testFeatureVerifyENFORCEnoSig() throws Exception {
String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" };

//copy testesa1 esa file from local Maven repo to a temporary location (wlp/tmp)
copyFileToMinifiedRoot("tmp", mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa");
copyFileToMinifiedRoot("tmp", mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa");

// Begin Test
String[] param1s = { "installFeature", minifiedRoot + "/tmp/testesa1-19.0.0.8.esa", "json-1.0",
Expand All @@ -610,7 +610,7 @@ public void testFeatureVerifyALL() throws Exception {
Log.entering(c, METHOD_NAME);

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa");

String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" };
Expand All @@ -632,7 +632,7 @@ public void testFeatureVerifySKIP() throws Exception {
final String METHOD_NAME = "testFeatureVerifySKIP";
Log.entering(c, METHOD_NAME);
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa");

String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" };
Expand Down Expand Up @@ -709,7 +709,7 @@ public void testFeatureVerifyALLProps() throws Exception {
Log.entering(c, METHOD_NAME);
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa");

String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" };
Expand All @@ -732,7 +732,7 @@ public void testFeatureVerifyALLEnv() throws Exception {
envProps.put("FEATURE_VERIFY", "all");

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa");

String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" };
Expand Down Expand Up @@ -784,24 +784,24 @@ public void testVerifyRevokedKey() throws Exception {
envProps.put("FEATURE_VERIFY", "all");

// backup the valid user feature signature
Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath),
Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"));
Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath),
Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"));
// overwrite with signature signed by revoked key
Files.copy(Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/revoked/testesa1-19.0.0.8.esa.asc"),
Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc"));
Files.copy(Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/revoked/testesa1-19.0.0.8.esa.asc"),
Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc"));

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/revoked/revokedKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/revoked/revokedKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "2CB7FEADC826EA27");

String[] param1s = { "installFeature", "testesa1",
"--featuresBOM=com.ibm.ws.userFeature:features-bom:19.0.0.8", "--verbose" };
ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s);

// Change back to valid signature
Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"),
Paths.get(mavenLocalRepo + userFeatureSigPath),
Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"),
Paths.get(mavenLocalRepo1 + userFeatureSigPath),
StandardCopyOption.REPLACE_EXISTING);

checkCommandOutput(po, InstallException.SIGNATURE_VERIFICATION_FAILED, "CWWKF1510E", null);
Expand All @@ -821,24 +821,24 @@ public void testVerifyExpiredKey() throws Exception {
envProps.put("FEATURE_VERIFY", "all");

// backup the valid user feature signature
Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath),
Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"));
Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath),
Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"));
// overwrite with signature signed by expired key
Files.copy(Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/expired/testesa1-19.0.0.8.esa.asc"),
Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc"));
Files.copy(Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/expired/testesa1-19.0.0.8.esa.asc"),
Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc"));

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/expired/expiredKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/expired/expiredKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "61B792CE2DAA8C02");

String[] param1s = { "installFeature", "testesa1",
"--featuresBOM=com.ibm.ws.userFeature:features-bom:19.0.0.8", "--verbose" };
ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s);

// Change back to valid signature
Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"),
Paths.get(mavenLocalRepo + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING);
Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"),
Paths.get(mavenLocalRepo1 + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING);

checkCommandOutput(po, InstallException.SIGNATURE_VERIFICATION_FAILED, "CWWKF1511E", null);
Log.exiting(c, METHOD_NAME);
Expand All @@ -857,7 +857,7 @@ public void testVerifyNoKeyId() throws Exception {

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");

String[] param1s = { "installFeature", "testesa1",
"--featuresBOM=com.ibm.ws.userFeature:features-bom:19.0.0.8", "--verbose" };
Expand Down Expand Up @@ -930,25 +930,25 @@ public void testVerifyBadSignature() throws Exception {
envProps.put("FEATURE_VERIFY", "all");

// backup the valid user feature signature
Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath),
Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"));
Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath),
Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"));
// overwrtie valid signature to invalid signature
Files.copy(
Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/invalidSig/testesa1-19.0.0.8.esa.asc"),
Paths.get(mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc"));
Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/invalidSig/testesa1-19.0.0.8.esa.asc"),
Paths.get(mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/19.0.0.8/testesa1-19.0.0.8.esa.asc"));

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "feature.verify", "all");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");

String[] param1s = { "installFeature", "testesa1",
"--featuresBOM=com.ibm.ws.userFeature:features-bom:19.0.0.8", "--verbose" };
ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s);

// Change back to valid signature
Files.move(Paths.get(mavenLocalRepo + userFeatureSigPath + ".bck"),
Paths.get(mavenLocalRepo + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING);
Files.move(Paths.get(mavenLocalRepo1 + userFeatureSigPath + ".bck"),
Paths.get(mavenLocalRepo1 + userFeatureSigPath), StandardCopyOption.REPLACE_EXISTING);


checkCommandOutput(po, InstallException.SIGNATURE_VERIFICATION_FAILED, "CWWKF1512E", null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 IBM Corporation and others.
* Copyright (c) 2019, 2024 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -44,7 +44,7 @@ public static void beforeClassSetup() throws Exception {
@Before
public void beforeSetUp() throws Exception {
copyFileToMinifiedRoot("etc", "publish/propertyFiles/publishRepoOverrideProps/featureUtility.properties");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo);
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "featureLocalRepo", mavenLocalRepo1);
}

@After
Expand Down Expand Up @@ -157,28 +157,7 @@ public void testInvalidMultiVersionFeatures() throws Exception {
Log.exiting(c, METHOD_NAME);
}

/**
* Test the install of versionless servlet from maven central. Multi-version is not
* supported with installServerFeature as it cannot be installed to same
* resource.
*
* @throws Exception
*/
@Ignore
@Test
public void testVersionlessWithPlatformFeatures() throws Exception {
final String METHOD_NAME = "testInvalidMultiVersionFeatures";
Log.entering(c, METHOD_NAME);

copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/versionlessWPlatform/server.xml");

String[] param1s = { "installServerFeatures", "serverX", "--verbose" };
ProgramOutput po = runFeatureUtility(METHOD_NAME, param1s);

checkCommandOutput(po, 21, "CWWKF1405E", null);
Log.exiting(c, METHOD_NAME);
}


/**
* Install an user feature with the "--featuresBom" parameters
*/
Expand Down Expand Up @@ -293,7 +272,7 @@ public void testInstallServerFeaturesUsrVerifyAll() throws Exception {
copyFileToMinifiedRoot("usr/servers/serverX", "publish/tmp/usrFeaturesServerXml/server.xml");

writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyurl",
mavenLocalRepo + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
mavenLocalRepo1 + "/com/ibm/ws/userFeature/testesa1/valid/validKey.asc");
writeToProps(minifiedRoot + "/etc/featureUtility.properties", "myKey.keyid", "71f8e6239b6834aa");

String[] filesList = { "usr/extension/lib/features/testesa1.mf", "usr/extension/bin/testesa1.bat" };
Expand Down
Loading