[java-identity-provider] branch main updated: Refresh Plugin installer tests now that V5 is out

Rod Widdowson rdw at steadingsoftware.com
Tue Nov 7 14:20:10 UTC 2023


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=7f4b8a92f4fef98ae18a6f270e4baf529f0192a3

The following commit(s) were added to refs/heads/main by this push:
     new 7f4b8a92f Refresh Plugin installer tests now that V5 is out
7f4b8a92f is described below

commit 7f4b8a92f4fef98ae18a6f270e4baf529f0192a3
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Oct 19 11:04:05 2023 +0100

    Refresh Plugin installer tests now that V5 is out
---
 .../idp/installer/plugin/impl/PluginInstaller.java |   6 +-
 .../idp/installer/plugin/impl/PluginCLITest.java   |   4 +-
 .../installer/plugin/impl/PluginInstallerTest.java | 148 ---------------------
 .../idp/installer/plugin/impl/PluginStateTest.java |  17 +--
 .../idp/installer/plugin/impl/TestPlugin.java      |   6 +-
 .../net/shibboleth/idp/plugin/allPlugins.props     |   2 +-
 .../net/shibboleth/idp/plugin/plugins.props        |   2 +-
 7 files changed, 14 insertions(+), 171 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
index 289b597d8..d9084427f 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/PluginInstaller.java
@@ -1077,9 +1077,9 @@ public final class PluginInstaller extends AbstractInitializableComponent implem
         final String version  = Version.getVersion();
 
         if (version == null) {
-            LOG.error("Could not determine IdP Version. Assuming 4.2.0");
-            LOG.error("You should never see this outside a test environment");
-            return new InstallableComponentVersion(4,2,0);
+            LOG.error("Could not determine IdP Version. Assuming 5.0.0");
+            LOG.error("You should never see this outside a test environment/");
+            return new InstallableComponentVersion(5,0,0);
         } 
         return new InstallableComponentVersion(version);
     }
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginCLITest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginCLITest.java
index 275e35b58..0ba23a1ef 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginCLITest.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginCLITest.java
@@ -38,9 +38,9 @@ import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
 @SuppressWarnings("javadoc")
 public class PluginCLITest extends BasePluginTest {
     
-    private final static boolean RunInstallTests = false; 
+    private final static boolean RunInstallTests = false;
     
-    private final String PLUGIN_DISTRO = "http://test.shibboleth.net/downloads/identity-provider/plugins/metadatagen/1.0.0/idp-plugin-metadatagen-dist-1.0.0.tar.gz";
+    private final String PLUGIN_DISTRO = "http://test.shibboleth.net/downloads/identity-provider/plugins/metadatagen/2.0.0/idp-plugin-metadatagen-dist-2.0.0.tar.gz";
     
     private final String PLUGIN_ID = "net.shibboleth.idp.plugin.metadatagen";
 
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java
deleted file mode 100644
index 670168750..000000000
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginInstallerTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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 net.shibboleth.idp.installer.plugin.impl;
-
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.URL;
-import java.nio.file.Path;
-import java.security.Security;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-import javax.annotation.Nonnull;
-
-import org.apache.hc.client5.http.classic.HttpClient;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.slf4j.Logger;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import net.shibboleth.idp.module.IdPModule;
-import net.shibboleth.idp.plugin.IdPPlugin;
-import net.shibboleth.profile.plugin.AbstractPlugin;
-import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.httpclient.HttpClientBuilder;
-import net.shibboleth.shared.primitive.LoggerFactory;
-
- at SuppressWarnings({"javadoc", "null"})
-public class PluginInstallerTest extends BasePluginTest {
-
-    private final Logger log = LoggerFactory.getLogger(PluginInstallerTest.class);
-
-    private HttpClient client;
-
-    private final Predicate<String> loggingAcceptCert = new  Predicate<>() {
-        public boolean test(String what) {
-            log.debug("Accepting the certificate\n{}", what);
-            return true;
-        }
-    };
-
-    
-    @BeforeClass public void setup() throws Exception {
-        if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
-            Security.addProvider(new BouncyCastleProvider());
-        }
-        client = new HttpClientBuilder().buildClient();
-    }
-
-    @Test(enabled = false) public void testListing() throws ComponentInitializationException, IOException {
-        
-        try (final PluginInstaller inst = new PluginInstaller(client)) {
-            inst.setIdpHome(getIdpHome());
-            inst.initialize();
-            final Map<String, Object> result = inst.getInstalledPlugins().stream().collect(Collectors.toMap(IdPPlugin::getPluginId,
-                    e->e));
-            
-            assertTrue(result.containsKey("org.example.Plugin"));
-            assertTrue(result.containsKey("net.shibboleth.plugin.test"));
-        }
-    }
-
-    @Test(enabled = false, dependsOnMethods ={"testListing", }) public void testRemove() throws ComponentInitializationException, IOException
-    {
-        try (final PluginInstaller inst = new PluginInstaller(client)) {
-            inst.setIdpHome(getIdpHome());
-            inst.setPluginId("org.example.Plugin");
-            inst.initialize();
-            inst.uninstall();
-        }
-    }
-
-    @Test(enabled = false) public void testUnpackZip() throws ComponentInitializationException, IOException {
-        try (final PluginInstaller inst = new PluginInstaller(client)) {
-            inst.setIdpHome(getIdpHome());
-            inst.setAcceptKey(loggingAcceptCert);
-            inst.initialize();
-            final URL where = new URL("https://build.shibboleth.net/nexus/service/local/repositories/releases/content/net/shibboleth/idp/plugin/scripting/idp-plugin-nashorn-dist/0.1.4/");
-            inst.setPluginId("net.shibboleth.idp.plugin.nashorn");
-            inst.installPlugin(where,"idp-plugin-nashorn-dist-0.1.4.zip", false);
-        }
-    }
-    
-    @Test(enabled = false) public void testUnpackZipFile() throws ComponentInitializationException, IOException {
-        try (final PluginInstaller inst = new PluginInstaller(client)) {
-            inst.setIdpHome(getIdpHome());
-            inst.setAcceptKey(loggingAcceptCert);
-            inst.initialize();
-            final Path dir = Path.of("H:\\Perforce\\Juno\\New\\plugins\\java-idp-plugin-scripting\\rhino-dist\\target");
-            inst.installPlugin(dir,"shibboleth-idp-plugin-rhino-0.1.4-SNAPSHOT.zip", false);
-        }
-    }
-
-    
-    @Test(enabled = false) public void testUnpackTgz() throws ComponentInitializationException, IOException {
-        try (final PluginInstaller inst = new PluginInstaller(client)) {
-            inst.setPluginId("net.shibboleth.idp.plugin.rhino");
-            inst.setIdpHome(getIdpHome());
-            inst.setAcceptKey(loggingAcceptCert);
-            inst.initialize();
-            final URL where = new URL("https://build.shibboleth.net/nexus/service/local/repositories/releases/content/net/shibboleth/idp/plugin/scripting/idp-plugin-rhino-dist/0.1.4/");
-            inst.installPlugin(where,"idp-plugin-rhino-dist-0.1.4.tgz", false);
-        }
-    }
-
-
-    public static class Wibble extends AbstractPlugin<IdPModule> {
-
-        /** {@inheritDoc} */
-        public @Nonnull String getPluginId() {
-            
-            return "org.example.Plugin";
-        }
-
-        /** {@inheritDoc} */
-        public @Nonnull List<URL> getUpdateURLs() throws IOException {
-            return CollectionSupport.emptyList();
-        }
-
-        /** {@inheritDoc} */
-        public int getMajorVersion() {
-            return 0;
-        }
-
-        /** {@inheritDoc} */
-        public int getMinorVersion() {
-            return 0;
-        }
-        
-    }
-
-}
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java
index 30dc66715..c7b8c33b7 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/PluginStateTest.java
@@ -54,17 +54,17 @@ public class PluginStateTest {
 
         final InstallableComponentVersion pluginVersion = new InstallableComponentVersion(simple.getMajorVersion(), simple.getMinorVersion(), simple.getPatchVersion());
         
-        assertEquals(pluginVersion, new InstallableComponentVersion("1.2.3"));
+        assertEquals(pluginVersion, new InstallableComponentVersion("2.0.0"));
         assertEquals(state.getPluginInfo().getAvailableVersions().size(), 3);
         assertTrue(state.getPluginInfo().getAvailableVersions().containsKey(new InstallableComponentVersion(1, 2, 3)));
         assertTrue(state.getPluginInfo().getAvailableVersions().containsKey(new InstallableComponentVersion(1, 2, 4)));
         assertTrue(state.getPluginInfo().getAvailableVersions().containsKey(new InstallableComponentVersion(2,0,0)));
         assertFalse(state.getPluginInfo().getAvailableVersions().containsKey(new InstallableComponentVersion(3, 2, 3)));
 
-        assertTrue(testSupportState(pluginVersion, state, "4.1.0"));
-        assertTrue(testSupportState(pluginVersion, state, "4.2.0"));
+        assertFalse(testSupportState(pluginVersion, state, "4.1.0"));
+        assertFalse(testSupportState(pluginVersion, state, "4.2.0"));
         assertTrue(testSupportState(pluginVersion, state, "4.99.9"));
-        assertFalse(testSupportState(pluginVersion, state, "5.0.0"));
+        assertTrue(testSupportState(pluginVersion, state, "5.0.0"));
 
         final InstallableComponentVersion v124 = new InstallableComponentVersion(1,2,3);        
         assertTrue(testSupportState(v124, state,"4.1.0"));
@@ -72,15 +72,6 @@ public class PluginStateTest {
         assertFalse(testSupportState(v124, state, "5.0.0"));
         assertFalse(testSupportState(v124, state, "4.0.0"));
 
-        final InstallableComponentVersion v2 = new InstallableComponentVersion(2,0,0);
-        assertTrue(testSupportState(v2, state, "4.99.1"));
-        assertTrue(testSupportState(v2, state, "4.99.999"));
-        assertFalse(testSupportState(v2, state, "4.99.0"));
-        assertFalse(testSupportState(v2, state, "4.98.999"));
-        assertTrue(testSupportState(v2, state, "5.0.0"));
-        assertTrue(testSupportState(v2, state, "6.0.0"));
-        assertTrue(testSupportState(v2, state, "7.0.0"));
-        assertFalse(testSupportState(v2, state, "8"));
     }
 
     @Test
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java
index 8ef818860..563ef1874 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TestPlugin.java
@@ -54,19 +54,19 @@ public class TestPlugin extends AbstractPlugin<IdPModule> implements IdPPlugin {
     /** {@inheritDoc} */
     @Override
     public int getMajorVersion() {
-        return 1;
+        return 2;
     }
 
     /** {@inheritDoc} */
     @Override
     public int getMinorVersion() {
-        return 2;
+        return 0;
     }
     
 
     /** {@inheritDoc} */
     @Override
     public int getPatchVersion() {
-        return 3;
+        return 0;
     }
 }
diff --git a/idp-installer/src/test/resources/net/shibboleth/idp/plugin/allPlugins.props b/idp-installer/src/test/resources/net/shibboleth/idp/plugin/allPlugins.props
index f84bfcddf..b567ca10e 100644
--- a/idp-installer/src/test/resources/net/shibboleth/idp/plugin/allPlugins.props
+++ b/idp-installer/src/test/resources/net/shibboleth/idp/plugin/allPlugins.props
@@ -102,5 +102,5 @@ net.shibboleth.plugin.test.downloadURL.2.0.0=https://example.org/plugins2
 net.shibboleth.plugin.test.baseName.2.0.0=base-1-2-4
 net.shibboleth.plugin.test.idpVersionMax.2.0.0=8.0.0
 net.shibboleth.plugin.test.idpVersionMin.2.0.0=4.99.1
-net.shibboleth.plugin.test.supportLevel.2.0.0 = Unsupported
+net.shibboleth.plugin.test.supportLevel.2.0.0 = Current
 
diff --git a/idp-installer/src/test/resources/net/shibboleth/idp/plugin/plugins.props b/idp-installer/src/test/resources/net/shibboleth/idp/plugin/plugins.props
index 4771e98e7..9b94ba222 100644
--- a/idp-installer/src/test/resources/net/shibboleth/idp/plugin/plugins.props
+++ b/idp-installer/src/test/resources/net/shibboleth/idp/plugin/plugins.props
@@ -22,7 +22,7 @@ net.shibboleth.plugin.test.supportLevel.1.2.4 = OutOfDate
 net.shibboleth.plugin.test.downloadURL.2.0.0=https://example.org/plugins2
 net.shibboleth.plugin.test.baseName.2.0.0=base-1-2-4
 net.shibboleth.plugin.test.idpVersionMax.2.0.0=8.0.0
-net.shibboleth.plugin.test.idpVersionMin.2.0.0=4.99.1
+net.shibboleth.plugin.test.idpVersionMin.2.0.0=4.98.1
 net.shibboleth.plugin.test.supportLevel.2.0.0 = Unsupported
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list