Search in sources :

Example 1 with BitbucketServerApiClient

use of org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient in project che-server by eclipse-che.

the class BitbucketServerApiClientProviderTest method shouldNormalizeURLsBeforeCreateBitbucketServerApi.

@Test
public void shouldNormalizeURLsBeforeCreateBitbucketServerApi() {
    // given
    BitbucketServerApiProvider bitbucketServerApiProvider = new BitbucketServerApiProvider("https://bitbucket.server.com/, https://bitbucket2.server.com/", "https://bitbucket.server.com/", ImmutableSet.of(oAuthAuthenticator));
    // when
    BitbucketServerApiClient actual = bitbucketServerApiProvider.get();
    // then
    assertNotNull(actual);
    // internal representation always w/out slashes
    assertTrue(actual.isConnected("https://bitbucket.server.com"));
}
Also used : NoopBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient) BitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) Test(org.testng.annotations.Test)

Example 2 with BitbucketServerApiClient

use of org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient in project che-server by eclipse-che.

the class BitbucketServerApiClientProviderTest method shouldProvideNoopOAuthAuthenticatorIfSomeConfigurationIsNotSet.

@Test(dataProvider = "noopConfig")
public void shouldProvideNoopOAuthAuthenticatorIfSomeConfigurationIsNotSet(@Nullable String bitbucketEndpoints, @Nullable String bitbucketOauth1Endpoint, Set<OAuthAuthenticator> authenticators) throws IOException {
    // given
    BitbucketServerApiProvider bitbucketServerApiProvider = new BitbucketServerApiProvider(bitbucketEndpoints, bitbucketOauth1Endpoint, authenticators);
    // when
    BitbucketServerApiClient actual = bitbucketServerApiProvider.get();
    // then
    assertNotNull(actual);
    assertTrue(NoopBitbucketServerApiClient.class.isAssignableFrom(actual.getClass()));
}
Also used : NoopBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient) BitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) NoopBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient) Test(org.testng.annotations.Test)

Example 3 with BitbucketServerApiClient

use of org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient in project devspaces-images by redhat-developer.

the class BitbucketServerApiClientProviderTest method shouldNormalizeURLsBeforeCreateBitbucketServerApi.

@Test
public void shouldNormalizeURLsBeforeCreateBitbucketServerApi() {
    // given
    BitbucketServerApiProvider bitbucketServerApiProvider = new BitbucketServerApiProvider("https://bitbucket.server.com/, https://bitbucket2.server.com/", "https://bitbucket.server.com/", ImmutableSet.of(oAuthAuthenticator));
    // when
    BitbucketServerApiClient actual = bitbucketServerApiProvider.get();
    // then
    assertNotNull(actual);
    // internal representation always w/out slashes
    assertTrue(actual.isConnected("https://bitbucket.server.com"));
}
Also used : NoopBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient) BitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) Test(org.testng.annotations.Test)

Example 4 with BitbucketServerApiClient

use of org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient in project che-server by eclipse-che.

the class BitbucketServerApiClientProviderTest method shouldBeAbleToCreateBitbucketServerApi.

@Test
public void shouldBeAbleToCreateBitbucketServerApi() {
    // given
    BitbucketServerApiProvider bitbucketServerApiProvider = new BitbucketServerApiProvider("https://bitbucket.server.com, https://bitbucket2.server.com", "https://bitbucket.server.com", ImmutableSet.of(oAuthAuthenticator));
    // when
    BitbucketServerApiClient actual = bitbucketServerApiProvider.get();
    // then
    assertNotNull(actual);
    assertTrue(HttpBitbucketServerApiClient.class.isAssignableFrom(actual.getClass()));
}
Also used : NoopBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient) BitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) Test(org.testng.annotations.Test)

Example 5 with BitbucketServerApiClient

use of org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient in project che-server by eclipse-che.

the class BitbucketServerApiClientProviderTest method shouldProvideHttpAuthenticatorIfOauthConfigurationIsNotSet.

@Test(dataProvider = "httpOnlyConfig")
public void shouldProvideHttpAuthenticatorIfOauthConfigurationIsNotSet(@Nullable String bitbucketEndpoints, @Nullable String bitbucketOauth1Endpoint, Set<OAuthAuthenticator> authenticators) throws IOException {
    // given
    BitbucketServerApiProvider bitbucketServerApiProvider = new BitbucketServerApiProvider(bitbucketEndpoints, bitbucketOauth1Endpoint, authenticators);
    // when
    BitbucketServerApiClient actual = bitbucketServerApiProvider.get();
    // then
    assertNotNull(actual);
    assertTrue(HttpBitbucketServerApiClient.class.isAssignableFrom(actual.getClass()));
}
Also used : NoopBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient) BitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) HttpBitbucketServerApiClient(org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient) Test(org.testng.annotations.Test)

Aggregations

BitbucketServerApiClient (org.eclipse.che.api.factory.server.bitbucket.server.BitbucketServerApiClient)8 HttpBitbucketServerApiClient (org.eclipse.che.api.factory.server.bitbucket.server.HttpBitbucketServerApiClient)8 NoopBitbucketServerApiClient (org.eclipse.che.api.factory.server.bitbucket.server.NoopBitbucketServerApiClient)8 Test (org.testng.annotations.Test)8