[java-idp-plugin-scripting] branch main updated: IDP-1679 Remove spurious plugin test

Rod Widdowson rdw at steadingsoftware.com
Sun Sep 20 14:47:15 UTC 2020


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

rdw pushed a commit to branch main
in repository java-idp-plugin-scripting.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-scripting.git;a=commit;h=e396b255a53423579cdc4cc9546e0d617f5cf39e

The following commit(s) were added to refs/heads/main by this push:
       new  e396b25   IDP-1679 Remove spurious plugin test
e396b25 is described below

commit e396b255a53423579cdc4cc9546e0d617f5cf39e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Sep 20 15:46:54 2020 +0100

    IDP-1679 Remove spurious plugin test
    
    https://issues.shibboleth.net/jira/browse/IDP-1679
---
 nashorn-impl/pom.xml                               |   5 -
 .../idp/plugin/scripting/nashorn/PluginTest.java   | 142 ---------------------
 rhino-impl/pom.xml                                 |   6 -
 .../idp/plugin/scripting/rhino/PluginTest.java     | 124 ------------------
 4 files changed, 277 deletions(-)

diff --git a/nashorn-impl/pom.xml b/nashorn-impl/pom.xml
index a576aa7..7f2e263 100644
--- a/nashorn-impl/pom.xml
+++ b/nashorn-impl/pom.xml
@@ -121,11 +121,6 @@
             <scope>runtime</scope>
         </dependency>
 
-        <dependency>
-            <groupId>${idp.groupId}</groupId>
-            <artifactId>idp-admin-impl</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
diff --git a/nashorn-impl/src/test/java/net/shibboleth/idp/plugin/scripting/nashorn/PluginTest.java b/nashorn-impl/src/test/java/net/shibboleth/idp/plugin/scripting/nashorn/PluginTest.java
deleted file mode 100644
index 4afbf46..0000000
--- a/nashorn-impl/src/test/java/net/shibboleth/idp/plugin/scripting/nashorn/PluginTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You 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.plugin.scripting.nashorn;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Properties;
-import java.util.ServiceLoader;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import net.shibboleth.ext.spring.resource.HTTPResource;
-import net.shibboleth.idp.plugin.PluginDescription;
-import net.shibboleth.idp.plugin.PluginSupport.SupportLevel;
-import net.shibboleth.idp.plugin.PluginVersion;
-import net.shibboleth.idp.plugin.impl.PluginState;
-import net.shibboleth.idp.plugin.impl.PluginState.VersionInfo;
-import net.shibboleth.idp.plugin.scripting.Version;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-
-/**  basic sanity tests */
- at SuppressWarnings("javadoc")
-public class PluginTest {
-
-    private PluginDescription nashorn;
-    private PluginVersion version;
-    private PluginState state; 
-
-
-    @BeforeClass
-    public void SetupPlugin() throws ComponentInitializationException {
-        final ServiceLoader<PluginDescription> loader = ServiceLoader.load(PluginDescription.class);
-        for (final PluginDescription service:loader) {
-            if ("net.shibboleth.idp.plugin.nashorn".contentEquals(service.getPluginId())) {
-                nashorn = service;
-                break;
-            }
-        }
-        assertNotNull(nashorn);
-        state = new PluginState(nashorn);
-        state.initialize();
-        if (null == Version.getVersion()) {
-            version = new PluginVersion("0.1.2");
-        } else {
-            version = new PluginVersion(nashorn.getMajorVersion(),nashorn.getMinorVersion(), nashorn.getPatchVersion());
-        }
-    }
-
-    @Test
-    public void testState() throws ComponentInitializationException {
-        assertTrue(state.getAvailableVersions().containsKey(version));
-        assertEquals(state.getCurrentInfo().getSupportLevel(), SupportLevel.Current);
-        assertTrue(state.isSupportedWithIdPVersion(version, new PluginVersion("4.1.0")));
-        assertFalse(state.isSupportedWithIdPVersion(version, new PluginVersion("5.0.0")));
-    }
-
-    @Test
-    public void testStateOld() throws ComponentInitializationException {
-        final PluginVersion oldVers = new PluginVersion(0,1,0);
-        assertTrue(state.getAvailableVersions().containsKey(oldVers));
-        final VersionInfo info = state.getAvailableVersions().get(oldVers);
-        assertEquals(info.getSupportLevel(), SupportLevel.OutOfDate);
-        assertTrue(state.isSupportedWithIdPVersion(oldVers, new PluginVersion("4.1.0")));
-        assertFalse(state.isSupportedWithIdPVersion(oldVers, new PluginVersion("5.0.0")));
-    }
-
-    @Test  
-    public void testDownload() throws Exception {
-        //
-        // Abuse:  We 'know' that the first download is the sdk
-        //
-        final URL url = nashorn.getExternalFilePathsToCopy().get(0).getFirst();
-        final HTTPResource resource = new HTTPResource(new HttpClientBuilder().buildClient(), url);
-        final InputStream stream = resource.getInputStream();
-        byte[] buffer;
-        int count = 0;
-        do {
-            buffer = stream.readNBytes(10240);
-            count += buffer.length;
-        } while (buffer.length >= 10240);
-        assertEquals(count, 539904);
-    }
-
-    @Test
-    public void testFiles() throws IOException {
-        final Path distDir = Path.of("../nashorn-dist/src/main/resources");
-        assertTrue(Files.exists(distDir));
-        for (final Path p : nashorn.getFilePathsToCopy()) {
-            assertTrue(Files.exists(distDir.resolve(p)));
-        }
-        final File propFile = distDir.resolve("bootstrap").resolve("id.property").toFile();
-        assertTrue(propFile.exists());
-        Properties props = new Properties(2);           
-        try(final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(propFile))) {
-            props.load(stream);
-            assertEquals(StringSupport.trimOrNull(props.getProperty("pluginid")), nashorn.getPluginId());
-        }
-    }
-
-    @Test
-    public void testVersions() {
-        if (null == Version.getVersion()) {
-            // inside eclipse
-            assertEquals(nashorn.getMajorVersion(), 0);
-            assertEquals(nashorn.getMinorVersion(), 1);
-            assertEquals(nashorn.getPatchVersion(), 2);
-        } else {
-            assertEquals(nashorn.getMajorVersion(), 0);
-            assertEquals(nashorn.getMinorVersion(), 1);
-            assertTrue(nashorn.getPatchVersion()== 2 || nashorn.getPatchVersion() ==3);
-        }
-    }
-}
diff --git a/rhino-impl/pom.xml b/rhino-impl/pom.xml
index b12af49..38c483c 100644
--- a/rhino-impl/pom.xml
+++ b/rhino-impl/pom.xml
@@ -67,12 +67,6 @@
             <scope>provided</scope>
         </dependency>
 
-        <dependency>
-            <groupId>${idp.groupId}</groupId>
-            <artifactId>idp-admin-impl</artifactId>
-            <scope>test</scope>
-        </dependency>
-
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
diff --git a/rhino-impl/src/test/java/net/shibboleth/idp/plugin/scripting/rhino/PluginTest.java b/rhino-impl/src/test/java/net/shibboleth/idp/plugin/scripting/rhino/PluginTest.java
deleted file mode 100644
index 9b51008..0000000
--- a/rhino-impl/src/test/java/net/shibboleth/idp/plugin/scripting/rhino/PluginTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You 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.plugin.scripting.rhino;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Properties;
-import java.util.ServiceLoader;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import net.shibboleth.idp.plugin.PluginDescription;
-import net.shibboleth.idp.plugin.PluginSupport.SupportLevel;
-import net.shibboleth.idp.plugin.PluginVersion;
-import net.shibboleth.idp.plugin.impl.PluginState;
-import net.shibboleth.idp.plugin.impl.PluginState.VersionInfo;
-import net.shibboleth.idp.plugin.scripting.Version;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.primitive.StringSupport;
-
-/**  basic sanity tests */
- at SuppressWarnings("javadoc")
-public class PluginTest {
-
-    private PluginDescription rhino;
-    private PluginVersion version;
-    private PluginState state;
-
-    @BeforeClass
-    public void SetupPlugin() throws ComponentInitializationException {
-        final ServiceLoader<PluginDescription> loader = ServiceLoader.load(PluginDescription.class);
-        for (final PluginDescription service:loader) {
-            if ("net.shibboleth.idp.plugin.rhino".contentEquals(service.getPluginId())) {
-                rhino = service;
-                break;
-            }
-        }
-        assertNotNull(rhino);
-        state = new PluginState(rhino);
-        state.initialize();
-        if (null == Version.getVersion()) {
-            version = new PluginVersion("0.1.2");
-        } else {
-            version = new PluginVersion(rhino.getMajorVersion(),rhino.getMinorVersion(), rhino.getPatchVersion());
-        }
-    }
-
-    @Test
-    public void testStateOld() throws ComponentInitializationException {
-        state.initialize();
-        final PluginVersion version = new PluginVersion("0.1.0");
-        assertTrue(state.getAvailableVersions().containsKey(version));
-        final VersionInfo info = state.getAvailableVersions().get(version);
-        assertEquals(info.getSupportLevel(), SupportLevel.OutOfDate);
-        assertTrue(state.isSupportedWithIdPVersion(version, new PluginVersion("4.1.0")));
-        assertFalse(state.isSupportedWithIdPVersion(version, new PluginVersion("5.0.0")));
-    }
-
-    @Test
-    public void testState() throws ComponentInitializationException {
-        state.initialize();
-        assertTrue(state.getAvailableVersions().containsKey(version));
-        assertEquals(state.getCurrentInfo().getSupportLevel(), SupportLevel.Current);
-        assertTrue(state.isSupportedWithIdPVersion(version, new PluginVersion("4.1.0")));
-        assertFalse(state.isSupportedWithIdPVersion(version, new PluginVersion("5.0.0")));
-    }
-        
-    @Test
-    public void testFiles() throws IOException {
-        final Path distDir = Path.of("../rhino-dist/src/main/resources");
-        assertTrue(Files.exists(distDir));
-        for (final Path p : rhino.getFilePathsToCopy()) {
-            assertTrue(Files.exists(distDir.resolve(p)));   
-        }
-        final File propFile = distDir.resolve("bootstrap").resolve("id.property").toFile();
-        assertTrue(propFile.exists());
-        Properties props = new Properties(2);           
-        try(final BufferedInputStream stream = new BufferedInputStream(new FileInputStream(propFile))) {
-            props.load(stream);
-            assertEquals(StringSupport.trimOrNull(props.getProperty("pluginid")), rhino.getPluginId());
-        }
-    }
-        
-    // Remove soon
-    @Test
-    public void testVersions() {
-        if (null == Version.getVersion()) {
-            // inside eclipse
-            assertEquals(rhino.getMajorVersion(), 0);
-            assertEquals(rhino.getMinorVersion(), 1);
-            assertEquals(rhino.getPatchVersion(), 2);
-        } else {
-            assertEquals(rhino.getMajorVersion(), 0);
-            assertEquals(rhino.getMinorVersion(), 1);
-            assertTrue(rhino.getPatchVersion()== 2 || rhino.getPatchVersion() ==3);
-        }
-    }
-}
- 

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


More information about the commits mailing list