Example usage for java.net URI create

List of usage examples for java.net URI create

Introduction

In this page you can find the example usage for java.net URI create.

Prototype

public static URI create(String str) 

Source Link

Document

Creates a URI by parsing the given string.

Usage

From source file:net.sf.taverna.t2.activities.apiconsumer.ApiConsumerActivityFactory.java

@Override
public URI getActivityType() {
    return URI.create(ApiConsumerActivity.URI);
}

From source file:io.selendroid.server.SelendroidStandaloneServer.java

/**
 * for testing only/*w w  w  .  j  a  v a 2s  .co m*/
 * 
 * @throws AndroidSdkException
 */
protected SelendroidStandaloneServer(SelendroidConfiguration configuration, SelendroidStandaloneDriver driver)
        throws AndroidSdkException {
    this.configuration = configuration;
    this.driver = driver;
    NamingThreadFactory namingThreadFactory = new NamingThreadFactory(Executors.defaultThreadFactory(),
            "selendroid-standalone-handler");
    webServer = WebServers.createWebServer(Executors.newCachedThreadPool(namingThreadFactory),
            new InetSocketAddress(configuration.getPort()), URI.create("http://127.0.0.1"
                    + (configuration.getPort() == 80 ? "" : (":" + configuration.getPort())) + "/"));
    init();
}

From source file:com.opentable.etcd.SmokeTest.java

@Before
public void initialize() {
    backgroundThread = Executors.newSingleThreadExecutor();
    this.prefix = "/unittest-" + UUID.randomUUID().toString();

    jaxrsClient = new JaxRsClientFactory(Config.getEmptyConfig())
            .addFeatureToAllClients(JsonClientFeature.forMapper(new ObjectMapper()))
            .newClient("etcd", StandardFeatureGroup.PUBLIC);

    final EtcdClientFactory factory = new EtcdClientFactory(jaxrsClient, new ObjectMapper());
    client = factory.createClient(URI.create(server.getConnectString()));
}

From source file:ch.iterate.openstack.swift.model.Region.java

public URI getCDNManagementUrl(List<NameValuePair> parameters) {
    return URI.create(
            String.format("%s?%s", this.getCDNManagementUrl(), URLEncodedUtils.format(parameters, "UTF-8")));
}

From source file:mx.ipn.escom.supernaut.nile.logic.CommonBean.java

public CommonBean() {
    gson = new Gson();
    client = HttpClients.createDefault();
    modelType = (Class<Model>) ((ParameterizedType) getClass().getGenericSuperclass())
            .getActualTypeArguments()[0];
    baseUri = URI.create(HOST.toURI() + "/resources/" + modelType.getName().toLowerCase());
}

From source file:nl.surfnet.sab.HttpClientTransportTest.java

@Before
public void setUp() throws Exception {
    server = new LocalTestServer(null, null);

    server.register("/test", new HttpRequestHandler() {
        @Override//from ww  w.  ja  va  2 s . co  m
        public void handle(HttpRequest request, HttpResponse response, HttpContext context)
                throws HttpException, IOException {
            response.setEntity(new StringEntity("This is the response"));
            response.setStatusCode(200);
        }
    });

    server.start();
    endPoint = URI.create("http:/" + server.getServiceAddress().toString() + "/test");
    credentials = new UsernamePasswordCredentials("theuser", "thepass");
    transport = new HttpClientTransport(credentials, credentials, endPoint, endPoint);
}

From source file:net.sf.taverna.t2.activities.soaplab.SoaplabActivityFactory.java

@Override
public URI getActivityType() {
    return URI.create(SoaplabActivity.URI);
}

From source file:com.hp.autonomy.frontend.find.core.web.ControllerUtilsTest.java

@Test
public void buildErrorModelAndView() {
    final ErrorModelAndViewInfo errorModelAndViewInfo = new ErrorModelAndViewInfo.Builder()
            .setRequest(new MockHttpServletRequest()).setMainMessageCode("some.code")
            .setSubMessageCode("some.code").setSubMessageArguments(new Object[] {})
            .setStatusCode(HttpStatus.SC_FAILED_DEPENDENCY).setContactSupport(true)
            .setButtonHref(URI.create("http://some-address")).build();
    final ModelAndView modelAndView = controllerUtils.buildErrorModelAndView(errorModelAndViewInfo);
    assertNotNull(modelAndView.getModel().get(ErrorAttributes.MAIN_MESSAGE.value()));
    assertNotNull(modelAndView.getModel().get(ErrorAttributes.CONTACT_SUPPORT.value()));
    assertNotNull(modelAndView.getModel().get(ErrorAttributes.BUTTON_HREF.value()));
}

From source file:org.fcrepo.apix.registry.impl.HttpRegistryTest.java

@Test
public void representationTest() throws Exception {
    final HttpRegistry toTest = new HttpRegistry();

    final URI uri = URI.create("http://test");
    final String content = "CONTENT";
    final InputStream stream = IOUtils.toInputStream(content, "UTF-8");

    toTest.setHttpClient(mockClient(uri, stream, "text/turte", SC_OK));

    assertEquals(content, IOUtils.toString(toTest.get(uri).representation(), "UTF-8"));
}

From source file:org.jclouds.http.httpnio.pool.NioHttpCommandConnectionPoolTest.java

public void testConstructorGoodSSLPort() throws Exception {
    NioHttpCommandConnectionPool pool = new NioHttpCommandConnectionPool(null, null, null, null,
            createNiceMock(AsyncNHttpClientHandler.class), null, createNiceMock(HttpParams.class),
            URI.create("https://localhost:443"));
    assertEquals(pool.getTarget(), new InetSocketAddress("localhost", 443));
}