List of usage examples for java.net URI create
public static URI create(String str)
From source file:de.shadowhunt.subversion.internal.AbstractRepositoryFactoryIT.java
@Test(expected = SubversionException.class) public void test01_create() { final RepositoryFactory factory = RepositoryFactory.getInstance(); final URI uri = URI.create(repository.getBaseUri().toString() + "/" + UUID.randomUUID().toString()); final Repository probeRepository = factory.createRepository(uri, client, context); Assert.fail("must not complete"); }
From source file:org.gbif.registry.metasync.protocols.digir.DigirMetadataSynchroniserTest.java
@Before public void setup() { synchroniser = new DigirMetadataSynchroniser(client); installation = new Installation(); installation.setType(InstallationType.DIGIR_INSTALLATION); Endpoint endpoint = new Endpoint(); endpoint.setUrl(URI.create("http://localhost")); installation.addEndpoint(endpoint);/* w ww.ja v a2 s . com*/ }
From source file:io.spring.initializr.stub.ClientApplicationTests.java
private URI createUri(String path) { String url = this.stubFinder.findStubUrl("initializr-web").toString(); return URI.create(url + path); }
From source file:org.springframework.cloud.dataflow.rest.util.HttpClientConfigurerTests.java
/** * Basic test ensuring that an exception is thrown if the scheme of the proxy * Uri is not set.//from ww w. j av a2 s .com */ @Test public void testHttpClientWithProxyCreationWithMissingScheme() throws Exception { final URI targetHost = new URI("http://test.com"); final HttpClientConfigurer builder = HttpClientConfigurer.create(targetHost); try { builder.withProxyCredentials(URI.create("spring"), "spring", "cloud"); } catch (IllegalArgumentException e) { Assert.assertEquals("The scheme component of the proxyUri must not be empty.", e.getMessage()); return; } fail("Expected an IllegalArgumentException to be thrown."); }
From source file:ch.cyberduck.core.hubic.HubicAuthenticationResponseHandler.java
@Override public AuthenticationResponse handleResponse(final HttpResponse response) throws IOException { if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { Charset charset = HTTP.DEF_CONTENT_CHARSET; ContentType contentType = ContentType.get(response.getEntity()); if (contentType != null) { if (contentType.getCharset() != null) { charset = contentType.getCharset(); }/*from ww w . j a v a 2s .com*/ } try { final JsonParser parser = new JsonParser(); final JsonObject json = parser .parse(new InputStreamReader(response.getEntity().getContent(), charset)).getAsJsonObject(); final String token = json.getAsJsonPrimitive("token").getAsString(); final String endpoint = json.getAsJsonPrimitive("endpoint").getAsString(); return new AuthenticationResponse(response, token, Collections.singleton(new Region(null, URI.create(endpoint), null, true))); } catch (JsonParseException e) { throw new IOException(e.getMessage(), e); } } else if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED || response.getStatusLine().getStatusCode() == HttpStatus.SC_FORBIDDEN) { throw new AuthorizationException(new Response(response)); } throw new GenericException(new Response(response)); }
From source file:org.fcrepo.camel.indexing.solr.integration.RouteUpdateIT.java
@Override protected void doPreSetup() throws Exception { final String webPort = System.getProperty("fcrepo.dynamic.test.port", "8080"); final String jettyPort = System.getProperty("jetty.dynamic.test.port", "8080"); final FcrepoClient client = new FcrepoClient(null, null, null, true); final FcrepoResponse res = client.post(URI.create("http://localhost:" + webPort + "/rest"), ObjectHelper.loadResourceAsStream("indexable.ttl"), "text/turtle"); fullPath = res.getLocation().toString(); TestUtils.httpPost("http://localhost:" + jettyPort + "/solr/testCore/update?commit=true", "<delete><query>*:*</query></delete>", "application/xml"); }
From source file:org.ale.scanner.zotero.web.worldcat.WorldCatAPIClient.java
public void isbnLookup(String isbn) { APIRequest r = newRequest();/*from ww w . jav a 2 s . c o m*/ r.setHttpMethod(APIRequest.GET); r.setURI(URI.create(String.format(XISBN_SEARCH, isbn))); Bundle extra = new Bundle(); extra.putString(WorldCatAPIClient.EXTRA_ISBN, isbn); r.setExtra(extra); mRequestQueue.enqueue(r); }
From source file:com.github.jknack.handlebars.io.ServletContextTemplateLoaderTest.java
@Test public void subFolder() throws IOException { InputStream is = createMock(InputStream.class); is.close();//from w w w .j a va2 s. c o m expectLastCall(); ServletContext servletContext = createMock(ServletContext.class); expect(servletContext.getResourceAsStream("/mustache/specs/comments.yml")).andReturn(is); replay(servletContext, is); TemplateLoader locator = new ServletContextTemplateLoader(servletContext); locator.setSuffix(".yml"); Reader reader = locator.load(URI.create("mustache/specs/comments")); assertNotNull(reader); IOUtils.closeQuietly(reader); verify(servletContext, is); }