/src/test/java/org/exoplatform/social/client/core/AbstractClientTestV1Alpha2.java

http://github.com/exosocial/exo.social.client · Java · 57 lines · 17 code · 7 blank · 33 comment · 2 complexity · a713a1f81577ace015abba5da376c742 MD5 · raw file

  1. /*
  2. * Copyright (C) 2003-2011 eXo Platform SAS.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Affero General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Affero General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package org.exoplatform.social.client.core;
  18. import org.exoplatform.social.client.api.SocialClientContext;
  19. import org.exoplatform.social.client.api.SocialClientLibException;
  20. import org.exoplatform.social.client.api.model.RestIdentity;
  21. /**
  22. * The base abstract class for integration tests of of Social Rest APIs v1-alpha2.
  23. *
  24. * It's required for all tests to check {@link #canRunTest()} to make sure if the rest version is not supported
  25. * by server, just pass.
  26. *
  27. * @author <a href="http://hoatle.net">hoatle (hoatlevan at gmail dot com)</a>
  28. * @since 1.0.0-alpha2
  29. */
  30. public abstract class AbstractClientTestV1Alpha2 extends AbstractClientTest {
  31. private RestIdentity demoIdentity;
  32. /**
  33. * {@inheritDoc}
  34. */
  35. @Override
  36. protected void setRestVersion() {
  37. SocialClientContext.setRestVersion("v1-alpha2");
  38. }
  39. /**
  40. * Supports to gets Demo's identity.
  41. *
  42. * @return Demo's Identity.
  43. */
  44. protected RestIdentity getDemoIdentity() throws SocialClientLibException {
  45. if (demoIdentity == null) {
  46. demoIdentity = identityService.getIdentity("organization", "demo");
  47. }
  48. return demoIdentity;
  49. }
  50. }