@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);
  }
Beispiel #2
0
 private void setStringProperty(String key, String value) {
   if (value != null) {
     put(key, CollectionUtils.asSet(value));
   }
 }
Beispiel #3
0
 /** Updates the last poll time of this device code. */
 public void poll() {
   this.put("lastQueried", CollectionUtils.asSet(String.valueOf(System.currentTimeMillis())));
 }