@Test public void testDeleteNonexistentToken() { OAuthConsumer consumer = new OAuthConsumer("providerX", "http: "secretX", "HMAC-SHA1"); Boolean result = sut.execute(new OAuthTokenRequest(consumer, "X", "Y")); Assert.assertEquals(true, result); }
@Override @SuppressWarnings("unchecked") public Boolean execute(final OAuthTokenRequest inRequest) { Query q = getEntityManager().createQuery( "from OAuthToken t where t.consumer.serviceProviderName = :serviceName" + " and t.consumer.gadgetUrl = :gadgetUrl and t.viewerId = :viewerId and t.ownerId = :ownerId") .setParameter("serviceName", inRequest.getConsumer().getServiceProviderName()).setParameter( "gadgetUrl", inRequest.getConsumer().getGadgetUrl()).setParameter("viewerId", inRequest.getViewerId()).setParameter("ownerId", inRequest.getOwnerId()); List<OAuthToken> results = q.getResultList(); if (results.size() > 0) { getEntityManager().remove(results.get(0)); } return Boolean.TRUE; }
DeleteOAuthToken extends BaseArgDomainMapper<OAuthTokenRequest, Boolean> { @Override @SuppressWarnings("unchecked") public Boolean execute(final OAuthTokenRequest inRequest) { Query q = getEntityManager().createQuery( "from OAuthToken t where t.consumer.serviceProviderName = :serviceName" + " and t.consumer.gadgetUrl = :gadgetUrl and t.viewerId = :viewerId and t.ownerId = :ownerId") .setParameter("serviceName", inRequest.getConsumer().getServiceProviderName()).setParameter( "gadgetUrl", inRequest.getConsumer().getGadgetUrl()).setParameter("viewerId", inRequest.getViewerId()).setParameter("ownerId", inRequest.getOwnerId()); List<OAuthToken> results = q.getResultList(); if (results.size() > 0) { getEntityManager().remove(results.get(0)); } return Boolean.TRUE; } }
DeleteOAuthToken extends BaseArgDomainMapper<OAuthTokenRequest, Boolean> { @Override @SuppressWarnings("unchecked") public Boolean execute(final OAuthTokenRequest inRequest) { Query q = getEntityManager().createQuery( "from OAuthToken t where t.consumer.serviceProviderName = :serviceName" + " and t.consumer.gadgetUrl = :gadgetUrl and t.viewerId = :viewerId and t.ownerId = :ownerId") .setParameter("serviceName", inRequest.getConsumer().getServiceProviderName()).setParameter( "gadgetUrl", inRequest.getConsumer().getGadgetUrl()).setParameter("viewerId", inRequest.getViewerId()).setParameter("ownerId", inRequest.getOwnerId()); List<OAuthToken> results = q.getResultList(); if (results.size() > 0) { getEntityManager().remove(results.get(0)); } return Boolean.TRUE; }  }
DeleteOAuthToken extends BaseArgDomainMapper<OAuthTokenRequest, Boolean> { @Override @SuppressWarnings("unchecked") public Boolean execute(final OAuthTokenRequest inRequest) { Query q = getEntityManager().createQuery( "from OAuthToken t where t.consumer.serviceProviderName = :serviceName" + " and t.consumer.gadgetUrl = :gadgetUrl and t.viewerId = :viewerId and t.ownerId = :ownerId") .setParameter("serviceName", inRequest.getConsumer().getServiceProviderName()).setParameter( "gadgetUrl", inRequest.getConsumer().getGadgetUrl()).setParameter("viewerId", inRequest.getViewerId()).setParameter("ownerId", inRequest.getOwnerId()); List<OAuthToken> results = q.getResultList(); if (results.size() > 0) { getEntityManager().remove(results.get(0)); } return Boolean.TRUE; }  @Override @SuppressWarnings("unchecked") Boolean execute(final OAuthTokenRequest inRequest); }
DeleteOAuthToken extends BaseArgDomainMapper<OAuthTokenRequest, Boolean> { @Override @SuppressWarnings("unchecked") public Boolean execute(final OAuthTokenRequest inRequest) { Query q = getEntityManager().createQuery( "from OAuthToken t where t.consumer.serviceProviderName = :serviceName" + " and t.consumer.gadgetUrl = :gadgetUrl and t.viewerId = :viewerId and t.ownerId = :ownerId") .setParameter("serviceName", inRequest.getConsumer().getServiceProviderName()).setParameter( "gadgetUrl", inRequest.getConsumer().getGadgetUrl()).setParameter("viewerId", inRequest.getViewerId()).setParameter("ownerId", inRequest.getOwnerId()); List<OAuthToken> results = q.getResultList(); if (results.size() > 0) { getEntityManager().remove(results.get(0)); } return Boolean.TRUE; }  @Override @SuppressWarnings("unchecked") Boolean execute(final OAuthTokenRequest inRequest);  }