PageRenderTime 76ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 39ms app.codeStats 0ms

/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
Possible License(s): AGPL-3.0
 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 */
17package org.exoplatform.social.client.core;
18
19
20import org.exoplatform.social.client.api.SocialClientContext;
21import org.exoplatform.social.client.api.SocialClientLibException;
22import org.exoplatform.social.client.api.model.RestIdentity;
23
24/**
25 * The base abstract class for integration tests of of Social Rest APIs v1-alpha2.
26 *
27 * It's required for all tests to check {@link #canRunTest()} to make sure if the rest version is not supported
28 * by server, just pass.
29 *
30 * @author <a href="http://hoatle.net">hoatle (hoatlevan at gmail dot com)</a>
31 * @since 1.0.0-alpha2
32 */
33public abstract class AbstractClientTestV1Alpha2 extends AbstractClientTest {
34
35  private RestIdentity demoIdentity;
36
37  /**
38   * {@inheritDoc}
39   */
40  @Override
41  protected void setRestVersion() {
42    SocialClientContext.setRestVersion("v1-alpha2");
43  }
44
45  /**
46   * Supports to gets Demo's identity.
47   *
48   * @return Demo's Identity.
49   */
50  protected RestIdentity getDemoIdentity() throws SocialClientLibException {
51    if (demoIdentity == null) {
52      demoIdentity = identityService.getIdentity("organization", "demo");
53    }
54    return demoIdentity;
55  }
56
57}