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:me.lazerka.gae.jersey.oauth2.facebook.TokenVerifierFacebookDebugTokenTest.java

@BeforeMethod
public void setUp() throws URISyntaxException, IOException {
    MockitoAnnotations.initMocks(this);

    unit = new TokenVerifierFacebookDebugToken(mock(URLFetchService.class), jackson, "138483919580948",
            "secret", nowProvider);

    when(request.getRequestUri()).thenReturn(URI.create("https://example.com"));
}

From source file:at.ac.tuwien.dsg.cloud.utilities.gateway.registry.UserController.java

@PostConstruct
public void init() {
    RequestEntity<Void> req = RequestEntity.get(URI.create(this.kongUris.getKongConsumersUri())).build();

    try {//from w  w  w. j  a  va2s.c om
        ResponseEntity<KongUserList> resp = restUtilities.simpleRestExchange(req, KongUserList.class);
        this.kongUsers = resp.getBody();
    } catch (ResourceAccessException ex) {
        this.kongUsers = new KongUserList();
    }
}

From source file:net.sf.taverna.t2.activities.xpath.XPathActivityFactory.java

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

From source file:com.mycompany.geocoordinate.controller.PointController.java

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "/point", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody ResponseEntity<List<Integer>> point(@RequestBody GeoObject geoObject)
        throws IOException, JSONException {

    boolean check = coordinateMapper.isThereGeoObjectFromCircleType(GeoType.GEOPOINT) != null
            & coordinateMapper.selectCoordinateForLineorCircle(geoObject.getCoordinate()) != null;

    coordinateMapper.insertCoordinateForLineorCircle(GeoType.GEOPOINT, geoObject.getCoordinate());

    List<Integer> responseType = coordinateMapper.selectIdGeo(geoObject.getCoordinate());

    return ResponseEntity.created(URI.create("/point/id")).body(responseType);

}

From source file:com.googlecode.jsonschema2pojo.ContentResolverTest.java

@Test
public void classpathLinkIsResolvedToContent() throws IOException {

    URI schemaFile;/*from w w  w.ja v a2  s.c  o  m*/
    JsonNode uriContent;

    schemaFile = URI.create("classpath:schema/address.json");
    uriContent = resolver.resolve(schemaFile);
    assertThat(uriContent.path("description").asText().length(), is(greaterThan(0)));

    schemaFile = URI.create("classpath:/schema/address.json");
    uriContent = resolver.resolve(schemaFile);
    assertThat(uriContent.path("description").asText().length(), is(greaterThan(0)));

    schemaFile = URI.create("resource:schema/address.json");
    uriContent = resolver.resolve(schemaFile);
    assertThat(uriContent.path("description").asText().length(), is(greaterThan(0)));

    schemaFile = URI.create("java:schema/address.json");
    uriContent = resolver.resolve(schemaFile);
    assertThat(uriContent.path("description").asText().length(), is(greaterThan(0)));

}

From source file:com.collective.celos.server.AutoScheduleTest.java

@Before
public void setup() throws Exception {
    File tmpDir = folder.newFolder();
    this.workflowsDir = new File(tmpDir, WORKFLOWS_DIR);
    File defaultsDir = new File(tmpDir, DEFAULTS_DIR);
    this.slotDbDir = new File(tmpDir, DB_DIR);
    this.workflowsDir.mkdirs();
    defaultsDir.mkdirs();//w w  w.j  a v a2 s  . co  m
    this.slotDbDir.mkdirs();

    this.celosServer = new CelosServer();
    FileSystemStateDatabase config = new FileSystemStateDatabase(slotDbDir);
    this.port = celosServer.startServer(ImmutableMap.<String, String>of(), workflowsDir, defaultsDir, config);
    this.celosClient = new CelosClient(URI.create("http://localhost:" + port));
}

From source file:io.kamax.mxisd.controller.directory.v1.UserDirectoryController.java

@RequestMapping(path = "/search", method = RequestMethod.POST)
public String search(HttpServletRequest request) throws IOException {
    String accessToken = getAccessToken(request);
    UserDirectorySearchRequest searchQuery = parser.parse(request, UserDirectorySearchRequest.class);
    URI target = URI.create(request.getRequestURL().toString());
    UserDirectorySearchResult result = mgr.search(target, accessToken, searchQuery.getSearchTerm());
    return gson.toJson(result);
}

From source file:io.brooklyn.ambari.rest.RequestCheckRunnable.java

@Override
public void run() {
    boolean done = Repeater.create(String.format("Request %s status check", builder.request.toString()))
            .every(Duration.ONE_SECOND).until(new Callable<Boolean>() {
                @Override/*from   ww  w  .j  ava 2  s .  co m*/
                public Boolean call() throws Exception {
                    final String json = HttpTool
                            .httpGet(builder.httpClient, URI.create(builder.request.getHref()), builder.headers)
                            .getContentAsString();
                    final String status = JsonPath.read(json, "$.Requests.request_status");
                    if (!VALID_STATES.contains(status)) {
                        throw new RuntimeException("Request fails with state " + status
                                + ". Check here for details " + builder.request.getHref());
                    }
                    return StringUtils.equals(status, "COMPLETED");
                }
            }).limitTimeTo(builder.timeout).rethrowExceptionImmediately().run();

    if (!done) {
        throw new RuntimeException(builder.errorMessage);
    }
}

From source file:org.eel.kitchen.jsonschema.keyword.BasicKeywordValidatorTest.java

@BeforeMethod
public void initContext() {
    final KeywordBundle bundle = KeywordBundles.defaultBundle();
    final URIManager manager = new URIManager();
    final SchemaRegistry registry = new SchemaRegistry(manager, URI.create(""));
    final JsonValidatorCache cache = new JsonValidatorCache(bundle, registry);

    context = new ValidationContext(cache);
    report = new ValidationReport();
    validator = spy(new BasicKeywordValidator());
}