Skip to content

Commit

Permalink
Update Jakarta Authorization FATs to have EE 11 repeats
Browse files Browse the repository at this point in the history
- Add EE 11 repeats and update FAT logic to use the new 3.0 test
provider
  • Loading branch information
jhanders34 committed Aug 22, 2024
1 parent 031656f commit e27a9f8
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 97 deletions.
5 changes: 3 additions & 2 deletions dev/com.ibm.ws.ejbcontainer.security.jacc_fat.2.1/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#*******************************************************************************
# Copyright (c) 2022 IBM Corporation and others.
# Copyright (c) 2022, 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 @@ -22,7 +22,7 @@ src: \
fat.project: true

tested.features: \
appsecurity-5.0, servlet-6.0, enterpriseBeansLite-4.0, appAuthorization-2.1
enterpriseBeansLite-4.0, appAuthorization-2.1, appAuthorization-3.0

-buildpath: \
com.ibm.json4j;version=latest,\
Expand All @@ -31,6 +31,7 @@ tested.features: \
com.ibm.ws.ejbcontainer.security_test.servlets;version=latest,\
com.ibm.ws.security.audit_fat.common.tooling;version=latest,\
com.ibm.ws.security.authorization.jacc.testprovider.jakarta;version=latest,\
io.openliberty.security.authorization.jacc.testprovider;version=latest,\
com.ibm.ws.webcontainer.security_test.servlets;version=latest,\
fattest.simplicity;version=latest,\
io.openliberty.org.apache.commons.logging;version=latest,\
Expand Down
12 changes: 9 additions & 3 deletions dev/com.ibm.ws.ejbcontainer.security.jacc_fat.2.1/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022, 2023 IBM Corporation and others.
* Copyright (c) 2022, 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 @@ -404,6 +404,7 @@ assemble {
******************************************************************
******************************************************************/
autoFVT.dependsOn ':com.ibm.ws.security.authorization.jacc.testprovider:assemble'
autoFVT.dependsOn ':io.openliberty.security.authorization.jacc.testprovider:assemble'
autoFVT.dependsOn ':com.ibm.ws.ejbcontainer.security_test.servlets:assemble'
autoFVT.doLast {

Expand All @@ -426,12 +427,17 @@ autoFVT.doLast {
into new File(autoFvtDir, 'publish/bundles')
rename 'com.ibm.ws.security.authorization.jacc.testprovider.jakarta.jar', 'com.ibm.ws.security.authorization.jacc.testprovider_2.1.jar'
}


copy {
from new File(project(':io.openliberty.security.authorization.jacc.testprovider').projectDir, "/build/libs/io.openliberty.security.authorization.jacc.testprovider.jar")
into new File(autoFvtDir, 'publish/bundles')
rename 'io.openliberty.security.authorization.jacc.testprovider.jar', 'io.openliberty.security.authorization.jacc.testprovider_3.0.jar'
}

copy {
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-1.0.mf")
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-2.0.mf")
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-2.1.mf")
from new File(project(':io.openliberty.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-3.0.mf")
into new File(autoFvtDir, 'publish/features')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@

package com.ibm.ws.ejbcontainer.security.jacc_fat;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

import componenttest.rules.repeater.JakartaEE10Action;
import componenttest.rules.repeater.FeatureReplacementAction;
import componenttest.rules.repeater.RepeatTests;

@RunWith(Suite.class)
Expand All @@ -32,33 +27,10 @@
})

public class FATSuite {
private static final Set<String> EE78_FEATURES;
private static final String[] EE78_FEATURES_ARRAY = {
"appSecurity-1.0",
"usr:jaccTestProvider-1.0"
};

private static final Set<String> EE9_FEATURES;
private static final String[] EE9_FEATURES_ARRAY = {
"usr:jaccTestProvider-2.0"
};

private static final Set<String> EE10_FEATURES;
private static final String[] EE10_FEATURES_ARRAY = {
"usr:jaccTestProvider-2.1"

};

static {
EE78_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE78_FEATURES_ARRAY)));
EE9_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE9_FEATURES_ARRAY)));
EE10_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE10_FEATURES_ARRAY)));
}

/*
* Run EE10 tests in LITE mode and run all tests in FULL mode.
* Run EE10 tests in LITE mode if Java 11, EE11 tests in LITE mode if >= Java 17 and run all tests in FULL mode.
*/
@ClassRule
public static RepeatTests repeat = RepeatTests.with(new JakartaEE10Action());

public static RepeatTests repeat = RepeatTests.with(FeatureReplacementAction.EE10_FEATURES().conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_17)).andWith(FeatureReplacementAction.EE11_FEATURES().removeFeature("usr:jaccTestProvider-2.1").addFeature("usr:jaccTestProvider-3.0"));
}
5 changes: 3 additions & 2 deletions dev/com.ibm.ws.ejbcontainer.security.jacc_fat.2/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#*******************************************************************************
# Copyright (c) 2020, 2022 IBM Corporation and others.
# Copyright (c) 2020, 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 @@ -20,7 +20,7 @@ fat.project: true

tested.features: \
jacc-1.5, expressionLanguage-4.0, appsecurity-4.0, servlet-5.0, cdi-3.0, enterpriseBeansLite-4.0, appAuthorization-2.0, \
expressionLanguage-5.0, appsecurity-5.0, servlet-6.0, cdi-4.0, appAuthorization-2.1, jsonp-2.1
expressionLanguage-5.0, appsecurity-5.0, servlet-6.0, cdi-4.0, appAuthorization-2.1, jsonp-2.1, appAuthorization-3.0

-buildpath: \
com.ibm.json4j;version=latest,\
Expand All @@ -29,6 +29,7 @@ tested.features: \
com.ibm.ws.ejbcontainer.security_test.servlets;version=latest,\
com.ibm.ws.security.audit_fat.common.tooling;version=latest,\
com.ibm.ws.security.authorization.jacc.testprovider;version=latest,\
io.openliberty.security.authorization.jacc.testprovider;version=latest,\
com.ibm.ws.webcontainer.security_test.servlets;version=latest,\
fattest.simplicity;version=latest,\
io.openliberty.org.apache.commons.logging;version=latest,\
Expand Down
10 changes: 8 additions & 2 deletions dev/com.ibm.ws.ejbcontainer.security.jacc_fat.2/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2023 IBM Corporation and others.
* Copyright (c) 2020, 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 @@ -421,11 +421,17 @@ autoFVT.doLast {
into new File(autoFvtDir, 'publish/bundles')
rename 'com.ibm.ws.security.authorization.jacc.testprovider.jakarta.jar', 'com.ibm.ws.security.authorization.jacc.testprovider_2.1.jar'
}

copy {
from new File(project(':io.openliberty.security.authorization.jacc.testprovider').projectDir, "/build/libs/io.openliberty.security.authorization.jacc.testprovider.jar")
into new File(autoFvtDir, 'publish/bundles')
rename 'io.openliberty.security.authorization.jacc.testprovider.jar', 'io.openliberty.security.authorization.jacc.testprovider_3.0.jar'
}

copy {
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-1.0.mf")
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-2.0.mf")
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-2.1.mf")
from new File(project(':io.openliberty.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-3.0.mf")
into new File(autoFvtDir, 'publish/features')
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2012, 2022 IBM Corporation and others.
* Copyright (c) 2012, 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
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand Down Expand Up @@ -64,15 +64,21 @@ public class FATSuite {
"usr:jaccTestProvider-2.1"
};

private static final Set<String> EE11_FEATURES;
private static final String[] EE11_FEATURES_ARRAY = {
"usr:jaccTestProvider-3.0"
};

static {
EE78_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE78_FEATURES_ARRAY)));
EE9_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE9_FEATURES_ARRAY)));
EE10_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE10_FEATURES_ARRAY)));
EE11_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE11_FEATURES_ARRAY)));
}

/*
* Run EE9 tests in LITE mode if Java 8, EE10 tests in LITE mode if >= Java 11 and run all tests in FULL mode.
* Run EE9 tests in LITE mode if Java 8, EE10 tests in LITE mode if >= Java 11, EE11 tests in LITE mode if >= Java 17 and run all tests in FULL mode.
*/
@ClassRule
public static RepeatTests repeat = RepeatTests.with(new EmptyAction().fullFATOnly()).andWith(new JakartaEE9Action().removeFeatures(EE78_FEATURES).addFeatures(EE9_FEATURES).conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_11)).andWith(new JakartaEE10Action().removeFeatures(EE78_FEATURES).removeFeatures(EE9_FEATURES).addFeatures(EE10_FEATURES));
public static RepeatTests repeat = RepeatTests.with(new EmptyAction().fullFATOnly()).andWith(new JakartaEE9Action().removeFeatures(EE78_FEATURES).addFeatures(EE9_FEATURES).conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_11)).andWith(new JakartaEE10Action().removeFeatures(EE78_FEATURES).removeFeatures(EE9_FEATURES).addFeatures(EE10_FEATURES).conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_17)).andWith(FeatureReplacementAction.EE11_FEATURES().removeFeatures(EE78_FEATURES).removeFeatures(EE9_FEATURES).removeFeatures(EE10_FEATURES).addFeatures(EE11_FEATURES));
}
3 changes: 2 additions & 1 deletion dev/com.ibm.ws.ejbcontainer.security.jacc_fat/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ fat.project: true

tested.features: \
audit-2.0, jacc-1.5, expressionLanguage-4.0, appsecurity-4.0, servlet-5.0, cdi-3.0, enterpriseBeansLite-4.0, appAuthorization-2.0, \
expressionLanguage-5.0, appsecurity-5.0, servlet-6.0, cdi-4.0, appAuthorization-2.1, jsonp-2.1
expressionLanguage-5.0, appsecurity-5.0, servlet-6.0, cdi-4.0, appAuthorization-2.1, jsonp-2.1, appAuthorization-3.0

-buildpath: \
com.ibm.json4j;version=latest,\
com.ibm.websphere.security;version=latest,\
com.ibm.ws.ejbcontainer.security_test.servlets;version=latest,\
com.ibm.ws.security.audit_fat.common.tooling;version=latest,\
com.ibm.ws.security.authorization.jacc.testprovider;version=latest,\
io.openliberty.security.authorization.jacc.testprovider;version=latest,\
com.ibm.ws.webcontainer.security_test.servlets;version=latest,\
fattest.simplicity;version=latest,\
io.openliberty.org.apache.commons.logging;version=latest,\
Expand Down
13 changes: 10 additions & 3 deletions dev/com.ibm.ws.ejbcontainer.security.jacc_fat/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2023 IBM Corporation and others.
* Copyright (c) 2020, 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 @@ -400,6 +400,7 @@ assemble {
******************************************************************
******************************************************************/
autoFVT.dependsOn ':com.ibm.ws.security.authorization.jacc.testprovider:assemble'
autoFVT.dependsOn ':io.openliberty.security.authorization.jacc.testprovider:assemble'
autoFVT.dependsOn ':com.ibm.ws.ejbcontainer.security_test.servlets:assemble'
autoFVT.doLast {

Expand All @@ -416,16 +417,22 @@ autoFVT.doLast {
into new File(autoFvtDir, 'publish/bundles')
rename 'com.ibm.ws.security.authorization.jacc.testprovider.jakarta.jar', 'com.ibm.ws.security.authorization.jacc.testprovider_2.0.jar'
}
copy {
copy {
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir, "/build/libs/com.ibm.ws.security.authorization.jacc.testprovider.jakarta.jar")
into new File(autoFvtDir, 'publish/bundles')
rename 'com.ibm.ws.security.authorization.jacc.testprovider.jakarta.jar', 'com.ibm.ws.security.authorization.jacc.testprovider_2.1.jar'
}

copy {
from new File(project(':io.openliberty.security.authorization.jacc.testprovider').projectDir, "/build/libs/io.openliberty.security.authorization.jacc.testprovider.jar")
into new File(autoFvtDir, 'publish/bundles')
rename 'io.openliberty.security.authorization.jacc.testprovider.jar', 'io.openliberty.security.authorization.jacc.testprovider_3.0.jar'
}

copy {
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-1.0.mf")
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-2.0.mf")
from new File(project(':com.ibm.ws.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-2.1.mf")
from new File(project(':io.openliberty.security.authorization.jacc.testprovider').projectDir ,"/publish/usr/extension/lib/features/jaccTestProvider-3.0.mf")
into new File(autoFvtDir, 'publish/features')
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2012, 2022 IBM Corporation and others.
* Copyright (c) 2012, 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
* http://www.eclipse.org/legal/epl-2.0/
*
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
Expand Down Expand Up @@ -63,11 +63,11 @@
EJBJarX02InWarTest.class, //Added one test to run in Lite mode//Changed to run in FULL
EJBJarMixM02InWarTest.class, //Added one test to run in Lite mode//Changed to run in FULL/

/**
* The following test will be removed since we do not support Dynamic feature on rolemappings.
* this is something that is handled by the third party provider.
*/
//RoleMappingReconfig.class
/**
* The following test will be removed since we do not support Dynamic feature on rolemappings.
* this is something that is handled by the third party provider.
*/
//RoleMappingReconfig.class
})
public class FATSuite {
private static final Set<String> EE78_FEATURES;
Expand All @@ -86,15 +86,21 @@ public class FATSuite {
"usr:jaccTestProvider-2.1"
};

private static final Set<String> EE11_FEATURES;
private static final String[] EE11_FEATURES_ARRAY = {
"usr:jaccTestProvider-3.0"
};

static {
EE78_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE78_FEATURES_ARRAY)));
EE9_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE9_FEATURES_ARRAY)));
EE10_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE10_FEATURES_ARRAY)));
EE11_FEATURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(EE11_FEATURES_ARRAY)));
}

/*
* Run EE9 tests in LITE mode if Java 8, EE10 tests in LITE mode if >= Java 11 and run all tests in FULL mode.
* Run EE9 tests in LITE mode if Java 8, EE10 tests in LITE mode if >= Java 11, EE11 tests in LITE mode if >= Java 17 and run all tests in FULL mode.
*/
@ClassRule
public static RepeatTests repeat = RepeatTests.with(new EmptyAction().fullFATOnly()).andWith(new JakartaEE9Action().removeFeatures(EE78_FEATURES).addFeatures(EE9_FEATURES).conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_11)).andWith(new JakartaEE10Action().removeFeatures(EE78_FEATURES).removeFeatures(EE9_FEATURES).addFeatures(EE10_FEATURES));
public static RepeatTests repeat = RepeatTests.with(new EmptyAction().fullFATOnly()).andWith(new JakartaEE9Action().removeFeatures(EE78_FEATURES).addFeatures(EE9_FEATURES).conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_11)).andWith(new JakartaEE10Action().removeFeatures(EE78_FEATURES).removeFeatures(EE9_FEATURES).addFeatures(EE10_FEATURES).conditionalFullFATOnly(FeatureReplacementAction.GREATER_THAN_OR_EQUAL_JAVA_17)).andWith(FeatureReplacementAction.EE11_FEATURES().removeFeatures(EE78_FEATURES).removeFeatures(EE9_FEATURES).removeFeatures(EE10_FEATURES).addFeatures(EE11_FEATURES));
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2023 IBM Corporation and others.
* Copyright (c) 2020, 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 @@ -32,7 +32,10 @@ public class JACCFatUtils {
* @throws Exception If the install failed.
*/
public static void installJaccUserFeature(LibertyServer myServer) throws Exception {
if (JakartaEEAction.isEE10OrLaterActive()) {
if (JakartaEEAction.isEE11OrLaterActive()) {
myServer.installUserBundle("io.openliberty.security.authorization.jacc.testprovider_3.0");
myServer.installUserFeature("jaccTestProvider-3.0");
} else if (JakartaEEAction.isEE10Active()) {
myServer.installUserBundle("com.ibm.ws.security.authorization.jacc.testprovider_2.1");
myServer.installUserFeature("jaccTestProvider-2.1");
} else if (JakartaEEAction.isEE9Active()) {
Expand All @@ -51,7 +54,10 @@ public static void installJaccUserFeature(LibertyServer myServer) throws Excepti
* @throws Exception If the uninstall failed.
*/
public static void uninstallJaccUserFeature(LibertyServer myServer) throws Exception {
if (JakartaEEAction.isEE10OrLaterActive()) {
if (JakartaEEAction.isEE11OrLaterActive()) {
myServer.uninstallUserBundle("io.openliberty.security.authorization.jacc.testprovider_3.0");
myServer.uninstallUserFeature("jaccTestProvider-3.0");
} else if (JakartaEEAction.isEE10Active()) {
myServer.uninstallUserBundle("com.ibm.ws.security.authorization.jacc.testprovider_2.1");
myServer.uninstallUserFeature("jaccTestProvider-2.1");
} else if (JakartaEEAction.isEE9Active()) {
Expand Down
Loading

0 comments on commit e27a9f8

Please sign in to comment.