Package org.springframework.web.util

Examples of org.springframework.web.util.UriTemplate


      assertEquals("redirect:/settings", controller.disconnectApp("authme", testAccount()));
      assertEquals(0, tokenStore.findTokensByUserName("kdonald").size());
    }
 
    private Account testAccount() {
      return new Account(1L, "Joe", "Schmoe", "joe@schmoe.com", "joe", "file://pic.jpg", new UriTemplate("http://localhost:8080/members/{profileKey}"));
    }
View Full Code Here


  }

  @Test
  public void postConnect() {
    request.setAttribute("twitterConnect.postTweet", Boolean.TRUE, WebRequest.SCOPE_SESSION);
    Account account = new Account(2L, "Craig", "Walls", "cwalls@vmware.com", "habuma", "http://picture.com/url", new UriTemplate("http://greenhouse.springsource.org/members/{profile}"));
    AccountUtils.signin(account);
    //TwitterApi twitterApi = Mockito.mock(TwitterApi.class);
    //StubServiceProviderConnection<TwitterApi> connection = new StubServiceProviderConnection<TwitterApi>(twitterApi);
    //interceptor.postConnect(connection, request);
    //Mockito.verify(twitterApi).timelineOperations().updateStatus("Join me at the Greenhouse! http://greenhouse.springsource.org/members/habuma");
View Full Code Here

    //Mockito.verify(twitterApi).timelineOperations().updateStatus("Join me at the Greenhouse! http://greenhouse.springsource.org/members/habuma");
  }

  @Test
  public void postConnect_noPostTweetAttribute() {
    Account account = new Account(2L, "Craig", "Walls", "cwalls@vmware.com", "habuma", "http://picture.com/url", new UriTemplate("http://greenhouse.springsource.org/members/{profile}"));
    AccountUtils.signin(account);
    //TwitterApi twitterApi = Mockito.mock(TwitterApi.class);
    //StubServiceProviderConnection<TwitterApi> connection = new StubServiceProviderConnection<TwitterApi>(twitterApi);
    //interceptor.postConnect(connection, request);
    //Mockito.verifyZeroInteractions(twitterApi);
View Full Code Here

  @Test
  public void welcomeMail() {
    WelcomeMailTransformer transformer = new WelcomeMailTransformer();

    Account account = new Account(1L, "Roy", "Clarkson", "rclarkson@vmware.com", "rclarkson", "http://foo.com/bar.jpg", new UriTemplate("http://greenhouse.springsource.org/members/{id}"));
    SimpleMailMessage welcomeMail = (SimpleMailMessage) transformer.welcomeMail(account);

    assertEquals("rclarkson@vmware.com", welcomeMail.getTo()[0]);
    assertEquals("Greenhouse <noreply@springsource.com>", welcomeMail.getFrom());
    assertEquals("Welcome to the Greenhouse!", welcomeMail.getSubject());
View Full Code Here

  }

  @Test
  public void markInviteAccepted() throws InviteException {
    jdbcTemplate.update("insert into Member (firstName, lastName, email, password, username, gender, birthdate) values ('Keith', 'Donald', 'keith.donald@springsource.com', 'kdonald', 'melbourne', 'M', '1977-12-01')");
    Account signedUp = new Account(3L, "Keith", "Donald", "keith.donald@springsource.com", "kdonald", "http://localhost:8080/resources/profile-pics/3.jpg", new UriTemplate("http://localhost:8080/members/{id}"));
    inviteRepository.markInviteAccepted("abc", signedUp);
    try {
      inviteRepository.findInvite("abc");
      fail("Should have failed already accepted");
    } catch (InviteAlreadyAcceptedException e) {
View Full Code Here

    }
  }
 
  @Test
  public void inviteFlow() {
    Account account = new Account(1L, "Roy", "Clarkson", "rclarkson@vmware.com", "rclarkson", "http://localhost:8080/images/rclarkson.jpg", new UriTemplate("http://localhost:8080/members/{id}"));
    List<Invitee> invitees = new ArrayList<Invitee>();
    invitees.add(Invitee.valueOf("Keith Donald <keith.donald@springsource.com>"));
    invitees.add(Invitee.valueOf("Craig Walls <cwalls@vmware.com>"));
    String invitationText = "Come join me at the Greenhouse!";
    inviteService.sendInvite(account, invitees, invitationText);
View Full Code Here

   */
  @Inject
  public AsyncMailInviteService(MailSender mailSender, InviteRepository inviteRepository, @Value("#{environment['application.secureUrl']}/invite/accept?token={token}") String acceptUriTemplate) {
    this.mailSender = mailSender;
    this.inviteRepository = inviteRepository;
    this.acceptUriTemplate = new UriTemplate(acceptUriTemplate);
  }
View Full Code Here

    @Override
    public void doWith(ResourceTester content) {

      String href = content.assertHasLink("self", null).getHref();

      UriTemplate uriTemplate = new UriTemplate(template.toString());
      assertThat(String.format("Expected %s to match %s!", href, uriTemplate.toString()), uriTemplate.matches(href),
          is(true));
    }
View Full Code Here

    patchAndGet(frodosSiblingsLink, links.get(1).getHref(), TEXT_URI_LIST);
    patchAndGet(frodosSiblingsLink, links.get(2).getHref(), TEXT_URI_LIST);
    patchAndGet(frodosSiblingsLink, links.get(3).getHref(), TEXT_URI_LIST);

    String pippinId = new UriTemplate("/people/{id}").match(links.get(3).getHref()).get("id");
    deleteAndVerify(new Link(frodosSiblingsLink.getHref() + "/" + pippinId));

    assertSiblingNames(frodosSiblingsLink, "Bilbo", "Merry");
  }
View Full Code Here

    mapper.writeValue(writer, resource);

    String s = writer.toString();

    Link fatherLink = linkDiscoverer.findLinkWithRel("father", s);
    assertThat(fatherLink.getHref(), endsWith(new UriTemplate("/{id}/father").expand(person.getId()).toString()));

    Link siblingLink = linkDiscoverer.findLinkWithRel("siblings", s);
    assertThat(siblingLink.getHref(), endsWith(new UriTemplate("/{id}/siblings").expand(person.getId()).toString()));
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.util.UriTemplate

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.