/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package com.sun.javaws.jnl; import java.io.File; import java.io.IOException; import java.net.URL; import com.sun.javaws.exceptions.BadFieldException; import com.sun.javaws.exceptions.JNLParseException; import com.sun.javaws.exceptions.MissingFieldException; import sun.tests.junit.JavawsTestCase; /* * demonstrates how to use internal API */ public class TestForDRSTool extends JavawsTestCase { private static final String FILENAME = "app.jnlp"; public TestForDRSTool(String testName) { super(testName); } public void test() throws BadFieldException, MissingFieldException, JNLParseException, IOException { URL url = this.getClass().getResource(FILENAME); File file = new File(url.getPath()); LaunchDesc desc = LaunchDescFactory.buildDescriptor(file, null, null, null); assertEquals(desc.getLocation().toString(), "http://localhost/POC/Applet/dist/launch.jnlp"); assertEquals(desc.getCodebase().toString(), "http://localhost/POC/Applet/dist/"); assertEquals(desc.getInformation().getTitle(), "Applet"); assertEquals(desc.getInformation().getVendor(), "dmitryc"); assertEquals(desc.getInformation().getDescription(0), "Applet - desciption"); assertEquals(desc.getMainClassName(), "applet.Applet"); assertEquals(desc.getSecurityModel(), LaunchDesc.SANDBOX_SECURITY); JARDesc[] jars = desc.getResources().getLocalJarDescs(); assertEquals(jars.length, 1); assertEquals(jars[0].getLocationString(), "http://localhost/POC/Applet/dist/Applet.jar"); assertEquals(jars[0].getVersion(), null); ExtensionDesc[] exts = desc.getResources().getExtensionDescs(); assertEquals(exts.length, 0); } }