List of usage examples for java.net URI create
public static URI create(String str)
From source file:org.apache.servicecomb.it.ITBootListener.java
protected void selectPort(String cfgKey) { String endpoint = DynamicPropertyFactory.getInstance().getStringProperty(cfgKey, null).get(); if (endpoint == null) { return;//from w w w. j av a2s . c om } URI uri = URI.create("http://" + endpoint); if (uri.getPort() == 0) { int port = getRandomPort(); try { ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); endpoint = new URIBuilder("http://" + endpoint).setPort(port).build().toString().substring(7); config.getConfiguration(0).setProperty(cfgKey, endpoint); LOGGER.info("change {} to {}.", cfgKey, endpoint); } catch (URISyntaxException e) { throw new IllegalStateException("Failed to build endpoint.", e); } } }
From source file:com.conwet.silbops.api.impl.ConnectionFactoryImplTest.java
@Test public void shouldCreateFactoryWithDefaultPort() { factory = new ConnectionFactoryImpl(URI.create("silbops://localhost")); assertThat(factory).isNotNull();/*from w ww . j ava 2 s. c om*/ }
From source file:net.sf.taverna.t2.activities.beanshell.BeanshellActivityFactory.java
@Override public URI getActivityType() { return URI.create(BeanshellActivity.URI); }
From source file:com.nesscomputing.config.util.HttpConfigStrategy.java
public HttpConfigStrategy(@Nonnull final URI webLocation) { super(webLocation); final String web = webLocation.toString(); if (web.endsWith("/")) { this.webLocation = webLocation; } else {//from w ww .j a v a2 s. c om this.webLocation = URI.create(web + "/"); } LOG.trace("Searching for configuration at '%s'.", webLocation); }
From source file:org.eel.kitchen.jsonschema.validator.JsonResolverTest.java
@BeforeMethod public void initRegistry() { final URIManager manager = new URIManager(); final URI namespace = URI.create(""); registry = new SchemaRegistry(manager, namespace); resolver = new JsonResolver(registry); }
From source file:org.apache.taverna.robundle.manifest.PathMetadata.java
@JsonCreator public PathMetadata(String uriStr) { setUri(URI.create(uriStr)); }
From source file:ch.cyberduck.core.dav.DAVClient.java
@Override protected HttpResponse execute(final HttpRequestBase request) throws IOException { if (StringUtils.isNotBlank(request.getURI().getRawQuery())) { request.setURI(URI.create( String.format("%s%s?%s", uri, request.getURI().getRawPath(), request.getURI().getRawQuery()))); } else {//from w w w .j a v a2 s . com request.setURI(URI.create(String.format("%s%s", uri, request.getURI().getRawPath()))); } return super.execute(request); }
From source file:org.eel.kitchen.jsonschema.uri.URIManagerTest.java
@Test public void shouldBeAbleToRegisterScheme() throws JsonSchemaException, IOException { final InputStream sampleStream = new ByteArrayInputStream("{}".getBytes()); when(mock.fetch(any(URI.class))).thenReturn(sampleStream); manager.registerScheme("foo", mock); manager.getContent(URI.create("foo://bar")); assertTrue(true);/*from ww w. j av a 2s . c o m*/ }
From source file:org.zalando.riptide.RedirectTest.java
@Test public void shouldFollowRedirect() { final URI originalUrl = URI.create("https://api.example.com/accounts/123"); final URI redirectUrl = URI.create("https://api.example.org/accounts/123"); server.expect(requestTo(originalUrl)) .andRespond(withStatus(HttpStatus.MOVED_PERMANENTLY).location(redirectUrl)); server.expect(requestTo(redirectUrl)) .andRespond(withSuccess().contentType(MediaType.TEXT_PLAIN).body("123")); assertThat(send(originalUrl), is("123")); }
From source file:org.apache.olingo.odata2.fit.misc.CxfCacheUriInfoIssue2Test.java
@Test public void testServletContextPath() throws Exception { URI uri1 = URI.create(server1.getEndpoint().toASCIIString() + "$metadata"); final HttpGet get1 = new HttpGet(uri1); HttpResponse r1 = new DefaultHttpClient().execute(get1); assertNotNull(r1);// w w w.j av a2s .c o m assertEquals(uri1, CxfCacheUriInfoIssueService1Factory.service.getProcessor().getContext().getPathInfo() .getRequestUri()); assertEquals(server1.getEndpoint(), CxfCacheUriInfoIssueService1Factory.service.getProcessor().getContext() .getPathInfo().getServiceRoot()); URI uri2 = URI.create(server2.getEndpoint().toASCIIString() + "$metadata"); final HttpGet get2 = new HttpGet(uri2); HttpResponse r2 = new DefaultHttpClient().execute(get2); assertNotNull(r2); assertEquals(uri2, CxfCacheUriInfoIssueService2Factory.service.getProcessor().getContext().getPathInfo() .getRequestUri()); assertEquals(server2.getEndpoint(), CxfCacheUriInfoIssueService2Factory.service.getProcessor().getContext() .getPathInfo().getServiceRoot()); }