@BeforeClass
  @SuppressWarnings("unchecked")
  public void setUp() {
    JacksonRepresentationFactory jacksonRepresentationFactory =
        new JacksonRepresentationFactory(new ObjectMapper());
    requestFactory = mock(OAuth2RequestFactory.class);
    accessTokenService = mock(AccessTokenService.class);
    OAuth2Representation representation = new OAuth2Representation(null);
    exceptionHandler =
        new ExceptionHandler(representation, null, null, jacksonRepresentationFactory);
    hook = mock(TokenRequestHook.class);

    tokenEndpointResource =
        new TokenEndpointResource(
            requestFactory,
            accessTokenService,
            exceptionHandler,
            CollectionUtils.asSet(hook),
            jacksonRepresentationFactory);
  }
예제 #2
0
 private void setStringProperty(String key, String value) {
   if (value != null) {
     put(key, CollectionUtils.asSet(value));
   }
 }
예제 #3
0
 /** Updates the last poll time of this device code. */
 public void poll() {
   this.put("lastQueried", CollectionUtils.asSet(String.valueOf(System.currentTimeMillis())));
 }