changeset 1548:cb75d5ae33e0

Propagating unimplemented DownloadService2. Added tests for it * netx/net/sourceforge/jnlp/services/ServiceUtil.java: added static getter for DownloadService2 * netx/net/sourceforge/jnlp/services/XDownloadService2.java: unimplemented stub for future DownloadService2 * netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: listed javax.jnlp.DownloadService2 providing XDownloadService2 * tests/reproducers/simple/DownloadService2/resources/DownloadService.jnlp: jnlp to call DownloadService * tests/reproducers/simple/DownloadService2/resources/DownloadService2.jnlp:jnlp to call DownloadService2 * tests/reproducers/simple/DownloadService2/srcs/DownloadService.java: app to call DownloadService * tests/reproducers/simple/DownloadService2/srcs/DownloadService2.java: app to call DownloadService2 * tests/reproducers/simple/DownloadService2/testcases/DownloadService2Test.java: test to laounch DownloadService2 and DownloadService
author Jiri Vanek <jvanek@redhat.com>
date Wed, 13 Feb 2019 18:05:44 +0100
parents 4bb9b43e39b7
children 0ec171908528
files ChangeLog netx/net/sourceforge/jnlp/services/ServiceUtil.java netx/net/sourceforge/jnlp/services/XDownloadService2.java netx/net/sourceforge/jnlp/services/XServiceManagerStub.java tests/reproducers/simple/DownloadService2/resources/DownloadService.jnlp tests/reproducers/simple/DownloadService2/resources/DownloadService2.jnlp tests/reproducers/simple/DownloadService2/srcs/DownloadService.java tests/reproducers/simple/DownloadService2/srcs/DownloadService2.java tests/reproducers/simple/DownloadService2/testcases/DownloadService2Test.java
diffstat 9 files changed, 332 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 12 13:22:39 2019 +0100
+++ b/ChangeLog	Wed Feb 13 18:05:44 2019 +0100
@@ -1,3 +1,16 @@
+2019-02-13  Jiri Vanek <jvanek@redhat.com>
+
+	Propagating unimplemented DownloadService2. Added tests for it
+	* netx/net/sourceforge/jnlp/services/ServiceUtil.java: added static getter for DownloadService2
+	* netx/net/sourceforge/jnlp/services/XDownloadService2.java: unimplemented stub for future DownloadService2
+	* netx/net/sourceforge/jnlp/services/XServiceManagerStub.java: listed  javax.jnlp.DownloadService2 providing  XDownloadService2
+	* tests/reproducers/simple/DownloadService2/resources/DownloadService.jnlp: jnlp to call DownloadService
+	* tests/reproducers/simple/DownloadService2/resources/DownloadService2.jnlp:jnlp to call DownloadService2
+	* tests/reproducers/simple/DownloadService2/srcs/DownloadService.java: app to call DownloadService
+	* tests/reproducers/simple/DownloadService2/srcs/DownloadService2.java: app to call DownloadService2 
+	* tests/reproducers/simple/DownloadService2/testcases/DownloadService2Test.java: test to laounch DownloadService2
+	and DownloadService
+
 2019-02-12  Jim Douglas <jimdouglas@mac.com>
 
 	Fixed typo in DownloadService2
--- a/netx/net/sourceforge/jnlp/services/ServiceUtil.java	Tue Feb 12 13:22:39 2019 +0100
+++ b/netx/net/sourceforge/jnlp/services/ServiceUtil.java	Wed Feb 13 18:05:44 2019 +0100
@@ -27,6 +27,7 @@
 import javax.jnlp.BasicService;
 import javax.jnlp.ClipboardService;
 import javax.jnlp.DownloadService;
+import javax.jnlp.DownloadService2;
 import javax.jnlp.ExtensionInstallerService;
 import javax.jnlp.FileOpenService;
 import javax.jnlp.FileSaveService;
@@ -78,6 +79,14 @@
     public static DownloadService getDownloadService() {
         return (DownloadService) getService("javax.jnlp.DownloadService");
     }
+    
+    /**
+     * @return the DownloadService reference, or null if the service is
+     * unavailable.
+     */
+    public static DownloadService2 getDownloadService2() {
+        return (DownloadService2) getService("javax.jnlp.DownloadService2");
+    }
 
     /**
      * @return the ExtensionInstallerService reference, or null if the service is
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/netx/net/sourceforge/jnlp/services/XDownloadService2.java	Wed Feb 13 18:05:44 2019 +0100
@@ -0,0 +1,53 @@
+/* XDownloadService2.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+package net.sourceforge.jnlp.services;
+
+import javax.jnlp.DownloadService2;
+
+public class XDownloadService2 implements DownloadService2 {
+
+    @Override
+    public ResourceSpec[] getCachedResources(ResourceSpec resourceSpec) {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+    @Override
+    public ResourceSpec[] getUpdateAvailableResources(ResourceSpec resourceSpec) {
+        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+    }
+
+}
--- a/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java	Tue Feb 12 13:22:39 2019 +0100
+++ b/netx/net/sourceforge/jnlp/services/XServiceManagerStub.java	Wed Feb 13 18:05:44 2019 +0100
@@ -16,15 +16,8 @@
 
 package net.sourceforge.jnlp.services;
 
-import java.io.*;
-import java.net.*;
-import java.util.*;
-import java.lang.ref.*;
-import java.lang.reflect.*;
-import java.security.*;
 import javax.jnlp.*;
 
-import net.sourceforge.jnlp.*;
 
 /**
  * Lookup table for services.
@@ -44,6 +37,7 @@
     private static String serviceNames[] = {
             "javax.jnlp.BasicService", // required
             "javax.jnlp.DownloadService", // required
+            "javax.jnlp.DownloadService2",
             "javax.jnlp.ExtendedService",
             "javax.jnlp.ExtensionInstallerService", // required
             "javax.jnlp.PersistenceService",
@@ -57,6 +51,7 @@
     private static Object services[] = {
             ServiceUtil.createPrivilegedProxy(BasicService.class, new XBasicService()),
             ServiceUtil.createPrivilegedProxy(DownloadService.class, new XDownloadService()),
+            ServiceUtil.createPrivilegedProxy(DownloadService2.class, new XDownloadService2()),
             ServiceUtil.createPrivilegedProxy(ExtendedService.class, new XExtendedService()),
             ServiceUtil.createPrivilegedProxy(ExtensionInstallerService.class, new XExtensionInstallerService()),
             ServiceUtil.createPrivilegedProxy(PersistenceService.class, new XPersistenceService()),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/simple/DownloadService2/resources/DownloadService.jnlp	Wed Feb 13 18:05:44 2019 +0100
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?> 
+
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ -->
+
+<jnlp spec="1.0"
+      codebase="./"
+      href="DownloadService.jnlp">
+    <information>
+        <title>looup downloadservice</title>
+        <vendor>IcedTea</vendor>
+    </information>
+    <resources>
+        <jar href="DownloadService2.jar" main="true"/>
+    </resources>
+    <application-desc main-class="DownloadService">
+    </application-desc>
+</jnlp> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/simple/DownloadService2/resources/DownloadService2.jnlp	Wed Feb 13 18:05:44 2019 +0100
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?> 
+
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ -->
+
+<jnlp spec="1.0"
+      codebase="./"
+      href="DownloadService2.jnlp">
+    <information>
+        <title>looup downloadservice2</title>
+        <vendor>IcedTea</vendor>
+    </information>
+    <resources>
+        <jar href="DownloadService2.jar" main="true"/>
+    </resources>
+    <application-desc main-class="DownloadService2">
+    </application-desc>
+</jnlp> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/simple/DownloadService2/srcs/DownloadService.java	Wed Feb 13 18:05:44 2019 +0100
@@ -0,0 +1,46 @@
+/* DownloadService2.java
+Copyright (C) 2011 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+import javax.jnlp.*;
+
+public class DownloadService {
+
+  public static void main(String[] args) throws UnavailableServiceException{
+
+    ServiceManager.lookup("javax.jnlp.DownloadService");
+
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/simple/DownloadService2/srcs/DownloadService2.java	Wed Feb 13 18:05:44 2019 +0100
@@ -0,0 +1,46 @@
+/* DownloadService2.java
+Copyright (C) 2011 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+import javax.jnlp.*;
+
+public class DownloadService2 {
+
+  public static void main(String[] args) throws UnavailableServiceException {
+
+    ServiceManager.lookup("javax.jnlp.DownloadService2");
+
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/simple/DownloadService2/testcases/DownloadService2Test.java	Wed Feb 13 18:05:44 2019 +0100
@@ -0,0 +1,59 @@
+/* DownloadService2Test.java
+Copyright (C) 2011 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+import net.sourceforge.jnlp.ProcessResult;
+import net.sourceforge.jnlp.ServerAccess;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DownloadService2Test {
+
+    private static ServerAccess server = new ServerAccess();
+
+ 
+    @Test
+    public void downloadService() throws Exception {
+        ProcessResult pr=server.executeJavawsHeadless(null,"/DownloadService.jnlp");
+        Assert.assertEquals((Integer)0, pr.returnValue);
+    }
+
+    @Test
+    public void downloadService2() throws Exception {
+        ProcessResult pr=server.executeJavawsHeadless(null,"/DownloadService2.jnlp");
+        Assert.assertEquals((Integer)0, pr.returnValue);
+    }
+  }