Package uk.ac.osswatch.simal.rest

Examples of uk.ac.osswatch.simal.rest.RESTCommand


  @Test
  public void testCreateDefaultSourceFromURI() throws SimalAPIException {
    String cmdString = RESTCommand.ALL_COLLEAGUES + RESTCommand.PARAM_PERSON_ID
        + "1" + RESTCommand.FORMAT_JSON;
    RESTCommand cmd = RESTCommand.createCommand(cmdString);
    assertEquals("Command method is incorrect", RESTCommand.ALL_COLLEAGUES, cmd
        .getCommandMethod());
    assertEquals("Person ID is incorrect", "1", cmd.getPersonID());
    assertEquals("Format is incorrect", RESTCommand.FORMAT_JSON, cmd
        .getFormat());
    assertEquals("Source is incorrect", RESTCommand.TYPE_SIMAL, cmd.getSource());
  }
View Full Code Here


  @Test
  public void testCreateMyExperiementSOurceFromURI() throws SimalAPIException {
    String cmdString = RESTCommand.ALL_COLLEAGUES + RESTCommand.PARAM_PERSON_ID
        + "1" + RESTCommand.PARAM_SOURCE + RESTCommand.TYPE_MYEXPERIMENT
        + RESTCommand.FORMAT_JSON;
    RESTCommand cmd = RESTCommand.createCommand(cmdString);
    assertEquals("Source is incorrect", RESTCommand.TYPE_MYEXPERIMENT, cmd
        .getSource());
    assertEquals("Command method is incorrect", RESTCommand.ALL_COLLEAGUES, cmd
        .getCommandMethod());
    assertEquals("Person ID is incorrect", "1", cmd.getPersonID());
    assertEquals("Format is incorrect", RESTCommand.FORMAT_JSON, cmd
        .getFormat());
  }
View Full Code Here

  @Test
  public void testToPathInfo() throws SimalAPIException {
    String cmdString = RESTCommand.ALL_COLLEAGUES + RESTCommand.PARAM_SOURCE
        + RESTCommand.TYPE_MYEXPERIMENT + RESTCommand.PARAM_PERSON_ID + "1"
        + RESTCommand.FORMAT_JSON;
    RESTCommand cmd = RESTCommand.createCommand(cmdString);
    assertEquals("Path info is incorrect", cmdString, cmd.getPath());
  }
View Full Code Here

    // source
    add(getRepeatingDataSourcePanel("sources", "seeAlso", person.getSources()));

    // FOAF link
    try {
      RESTCommand cmd = RESTCommand.createGetPerson(person.getSimalID(),
          RESTCommand.TYPE_SIMAL, RESTCommand.FORMAT_XML);
      add(new ExternalLink("rdfLink", cmd.getURL()));
      String rdfLink = "<link href=\"" + cmd.getURL()
          + "\" rel=\"meta\" title=\"RDF\" type=\"application/rdf+xml\" />";
      add(new StringHeaderContributor(rdfLink));
    } catch (SimalAPIException e) {
      UserReportableException error = new UserReportableException(
          "Unable to get a RESTful URI for the person RDF/XML document",
View Full Code Here

        return;
    }
    add(new DeleteLink("deleteProjectActionLink", project));

    try {
      RESTCommand cmd = RESTCommand.createGetProject(project.getSimalID(),
          RESTCommand.TYPE_SIMAL, RESTCommand.FORMAT_XML);
      add(new ExternalLink("doapLink", cmd.getURL()));
      String rdfLink = "<link href=\"" + cmd.getURL()
          + "\" rel=\"meta\" title=\"DOAP\" type=\"application/rdf+xml\" />";
      add(new StringHeaderContributor(rdfLink));
     
      cmd = RESTCommand.createGetProject(project.getSimalID(),
      RESTCommand.TYPE_SIMAL, RESTCommand.FORMAT_JSON);
      add(new ExternalLink("jsonLink", cmd.getURL()));
      String jsonLink = "<link href=\"" + cmd.getURL()
          + "\" rel=\"meta\" title=\"JSON\" type=\"application/json\" />";
      add(new StringHeaderContributor(rdfLink));
    } catch (SimalRepositoryException e) {
      UserReportableException error = new UserReportableException(
          "Unable to get new person ID from the repository",
View Full Code Here

TOP

Related Classes of uk.ac.osswatch.simal.rest.RESTCommand

Copyright © 2018 www.massapicom. 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.