Search in sources :

Example 1 with BitbucketServerFetchHandler

use of com.hp.octane.integrations.services.pullrequestsandbranches.bitbucketserver.BitbucketServerFetchHandler in project octane-ci-java-sdk by MicroFocus.

the class FetchHandlerTests method bitbucketParseLinks.

@Test
public void bitbucketParseLinks() throws JsonProcessingException {
    String body = "{\"slug\":\"simple-tests\",\"id\":1,\"name\":\"simple-tests\",\"hierarchyId\":\"3652cee12ecd25817b22\",\"scmId\":\"git\",\"state\":\"AVAILABLE\",\"statusMessage\":\"Available\",\"forkable\":true,\"project\":{\"key\":\"TES\",\"id\":2,\"name\":\"tests\",\"public\":false,\"type\":\"NORMAL\",\"links\":{\"self\":[{\"href\":\"http://myd-hvm02624.swinfra.net:7990/projects/TES\"}]}},\"public\":true,\"links\":{\"clone\":[{\"href\":\"ssh://git@myd-hvm02624.swinfra.net:7999/tes/simple-tests.git\",\"name\":\"ssh\"},{\"href\":\"http://myd-hvm02624.swinfra.net:7990/scm/tes/simple-tests.git\",\"name\":\"http\"}],\"self\":[{\"href\":\"http://myd-hvm02624.swinfra.net:7990/projects/TES/repos/simple-tests/browse\"}]}}";
    BitbucketServerFetchHandler handler = new BitbucketServerFetchHandler(new NoCredentialsStrategy());
    SCMRepositoryLinks links = handler.parseSCMRepositoryLinks(body);
    Assert.assertEquals("ssh://git@myd-hvm02624.swinfra.net:7999/tes/simple-tests.git", links.getSshUrl());
    Assert.assertEquals("http://myd-hvm02624.swinfra.net:7990/scm/tes/simple-tests.git", links.getHttpUrl());
}
Also used : BitbucketServerFetchHandler(com.hp.octane.integrations.services.pullrequestsandbranches.bitbucketserver.BitbucketServerFetchHandler) NoCredentialsStrategy(com.hp.octane.integrations.services.pullrequestsandbranches.rest.authentication.NoCredentialsStrategy) SCMRepositoryLinks(com.hp.octane.integrations.dto.scm.SCMRepositoryLinks) Test(org.junit.Test)

Example 2 with BitbucketServerFetchHandler

use of com.hp.octane.integrations.services.pullrequestsandbranches.bitbucketserver.BitbucketServerFetchHandler in project octane-ci-java-sdk by MicroFocus.

the class FetchHandlerTests method bitbucketServerTest.

@Test
public void bitbucketServerTest() {
    BitbucketServerFetchHandler handler = new BitbucketServerFetchHandler(new NoCredentialsStrategy());
    String result = handler.getRepoApiPath("http://localhost:8990/scm/proj/rep1.git");
    Assert.assertEquals("getRepoApiPath for https failed", "http://localhost:8990/rest/api/1.0/projects/proj/repos/rep1", result);
    result = handler.getRepoApiPath("http://localhost:8990/scm/~admin/rep1.git");
    Assert.assertEquals("getRepoApiPath for https failed", "http://localhost:8990/rest/api/1.0/users/admin/repos/rep1", result);
}
Also used : BitbucketServerFetchHandler(com.hp.octane.integrations.services.pullrequestsandbranches.bitbucketserver.BitbucketServerFetchHandler) NoCredentialsStrategy(com.hp.octane.integrations.services.pullrequestsandbranches.rest.authentication.NoCredentialsStrategy) Test(org.junit.Test)

Aggregations

BitbucketServerFetchHandler (com.hp.octane.integrations.services.pullrequestsandbranches.bitbucketserver.BitbucketServerFetchHandler)2 NoCredentialsStrategy (com.hp.octane.integrations.services.pullrequestsandbranches.rest.authentication.NoCredentialsStrategy)2 Test (org.junit.Test)2 SCMRepositoryLinks (com.hp.octane.integrations.dto.scm.SCMRepositoryLinks)1