Package java.net

Examples of java.net.URL.toURI()


    }
   
    @Test
    public void testAlreadyCheckedFilesAreNotParsedAgain() throws InterruptedException, IOException, URISyntaxException, ComponentConfigurationException {
        URL resource = SurefireArchiverUnitTest.class.getResource("/surefire-archiver-test2");
        File reportsDir = new File(resource.toURI().getPath());
        doReturn(reportsDir).when(this.mojoInfo).getConfigurationValue("reportsDirectory", File.class);
        touchReportFiles(reportsDir);
       
        FileSet fileSet = this.archiver.getFileSet(reportsDir);
        Assert.assertEquals(2, fileSet.getDirectoryScanner().getIncludedFilesCount());
View Full Code Here


            BufferedReader r = new BufferedReader(new InputStreamReader(index.openStream(),"UTF-8"));
            try {
                String line;
                while ((line=r.readLine())!=null) {
                  final URL url = new URL(index, line + ".jpi");
          File f = new File(url.toURI());
                  if(f.exists()){
                    copyBundledPlugin(url, line + ".jpi");
                  }else{
                    copyBundledPlugin(new URL(index, line + ".hpi"), line + ".jpi"); // fallback to hpi
                  }
View Full Code Here

  
    private void postRequestMessage(String message) throws Exception {
        // ensure jsse clients can validate the self signed dummy localhost cert,
        // use the server keystore as the trust store for these tests
        URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
        System.setProperty("javax.net.ssl.trustStore", trustStoreUrl.toURI().getPath());
       
        HttpPost post = new HttpPost("https://localhost:" + portNum + "/users/");
        post.addHeader(Exchange.CONTENT_TYPE, "application/xml");
        post.setEntity(new StringEntity(message));
View Full Code Here

            final URL url = ServerSideScriptsTest.class.getClassLoader().getResource(resourcePath);
            if (url != null) {
                if ( url.getProtocol().equals("file") ) {
                    URI uri = null;
                    try {
                        uri = url.toURI();
                        final File dir = new File(uri);
                        if ( dir.exists() && dir.isDirectory() ) {
                            return dir;
                        }
                    } catch (final URISyntaxException e) {
View Full Code Here

                    final String urlString = url.toString();
                    final int pos = urlString.indexOf('!');
                    try {
                        final String jarFilePath = urlString.substring(4, pos);
                        final URL jarURL = new URL(jarFilePath);
                        final URI uri = jarURL.toURI();

                        // create a temp dir
                        final File baseDir = new File(System.getProperty("java.io.tmpdir"));

                        final File tempDir = new File(baseDir, System.currentTimeMillis() + ".dir");
View Full Code Here

                        dict = new Hashtable<String, Object>();
                        if ( !hint.startsWith(INSTALL_NAME) ) {
                            dict.put(InstallableResource.INSTALLATION_HINT, hint);
                        }
                        try {
                            dict.put(InstallableResource.RESOURCE_URI_HINT, url.toURI().toString());
                        } catch (final URISyntaxException e) {
                            // we just ignore this
                        }
                    } else if ( !hint.equals(CONFIG_NAME) ) {
                        final int activeModes = isActive(hint);
View Full Code Here

            public void configure() throws URISyntaxException {
                JettyHttpComponent componentJetty = (JettyHttpComponent) context.getComponent("jetty");
                componentJetty.setSslPassword(pwd);
                componentJetty.setSslKeyPassword(pwd);
                URL keyStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
                componentJetty.setKeystore(keyStoreUrl.toURI().getPath());
               
                from("jetty:https://localhost:" + port1 + "/test?sslContextParametersRef=sslContextParameters").to("mock:a");

                Processor proc = new Processor() {
                    public void process(Exchange exchange) throws Exception {
View Full Code Here

    @Before
    public void setUp() throws Exception {
        port = AvailablePortFinder.getNextAvailable(16300);

        URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
        setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.toURI().getPath());
        uri = "websocket://" + server + ":" + port + "/test?sslContextParametersRef=#sslContextParameters";

        super.setUp();
    }
View Full Code Here

    @Override
    public void setUp() throws Exception {
        // ensure jsse clients can validate the self signed dummy localhost cert,
        // use the server keystore as the trust store for these tests
        URL trustStoreUrl = this.getClass().getClassLoader().getResource("jsse/localhost.ks");
        setSystemProp("javax.net.ssl.trustStore", trustStoreUrl.toURI().getPath());

        super.setUp();
    }

    @Override
View Full Code Here

        public File allocate() throws Exception {
            URL res = findDataResource();
            if(!res.getProtocol().equals("file"))
                throw new AssertionError("Test data is not available in the file system: "+res);
            // if we picked up a directory, it's one level above config.xml
            File home = new File(res.toURI());
            if(!home.getName().endsWith(".zip"))
                home = home.getParentFile();

            return new CopyExisting(home).allocate();
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.