Search in sources :

Example 6 with VcsRootInstanceImpl

use of jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl in project teamcity-git by JetBrains.

the class SpaceExternalChangeViewerExtensionTest method jetbrainsTeamVcsRoot_urlIsIncorrect.

@Test
void jetbrainsTeamVcsRoot_urlIsIncorrect() {
    // given
    final VcsRootInstanceImpl vcsRoot = Mockito.mock(VcsRootInstanceImpl.class);
    Mockito.doReturn(Constants.VCS_NAME).when(vcsRoot).getVcsName();
    Mockito.doReturn("").when(vcsRoot).getProperty(Constants.FETCH_URL);
    // test
    SpaceExternalChangeViewerExtension extension = mySpaceExternalChangeViewerExtension();
    final Map<String, String> availableProperties = extension.getAvailableProperties(vcsRoot);
    assertNull(availableProperties);
}
Also used : VcsRootInstanceImpl(jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl) SpaceExternalChangeViewerExtension(jetbrains.buildServer.buildTriggers.vcs.git.SpaceExternalChangeViewerExtension) Test(org.testng.annotations.Test)

Example 7 with VcsRootInstanceImpl

use of jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl in project teamcity-git by JetBrains.

the class SpaceExternalChangeViewerExtensionTest method jetbrainsTeamVcsRoot_vcsNameIsIncorrect.

@Test
void jetbrainsTeamVcsRoot_vcsNameIsIncorrect() {
    // given
    final VcsRootInstanceImpl vcsRoot = Mockito.mock(VcsRootInstanceImpl.class);
    Mockito.doReturn("VCS").when(vcsRoot).getVcsName();
    // test
    SpaceExternalChangeViewerExtension extension = mySpaceExternalChangeViewerExtension();
    final Map<String, String> availableProperties = extension.getAvailableProperties(vcsRoot);
    assertNull(availableProperties);
}
Also used : VcsRootInstanceImpl(jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl) SpaceExternalChangeViewerExtension(jetbrains.buildServer.buildTriggers.vcs.git.SpaceExternalChangeViewerExtension) Test(org.testng.annotations.Test)

Example 8 with VcsRootInstanceImpl

use of jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl in project teamcity-git by JetBrains.

the class SpaceExternalChangeViewerExtensionTest method jetbrainsSpaceVcsRoot.

@Test
void jetbrainsSpaceVcsRoot() {
    // given
    final VcsRootInstanceImpl vcsRoot = Mockito.mock(VcsRootInstanceImpl.class);
    Mockito.doReturn(Constants.VCS_NAME).when(vcsRoot).getVcsName();
    Mockito.doReturn(hostedOnJetBrainsSide).when(vcsRoot).getProperty(Constants.FETCH_URL);
    final OAuthConnectionDescriptor connection = Mockito.mock(OAuthConnectionDescriptor.class);
    Mockito.doReturn(ImmutableMap.of(SPACE_SERVER_URL, hostedOnJetBrainsSideServerUrl, SPACE_CLIENT_ID, "ignore", SPACE_CLIENT_SECRET, "ignore")).when(connection).getParameters();
    // test
    SpaceExternalChangeViewerExtension extension = mySpaceExternalChangeViewerExtension();
    final Map<String, String> availableProperties = extension.getAvailableProperties(vcsRoot);
    assertEquals(availableProperties, ImmutableMap.of(PropertyType.CHANGE_SET_TYPE, "https://golubinov.jetbrains.space/p/oauthspace/repositories/test-epo/revision/${changeSetId}", PropertyType.LINK_TEXT, "Open in Space", PropertyType.LINK_ICON_CLASS, "tc-icon_space"));
}
Also used : VcsRootInstanceImpl(jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl) SpaceExternalChangeViewerExtension(jetbrains.buildServer.buildTriggers.vcs.git.SpaceExternalChangeViewerExtension) OAuthConnectionDescriptor(jetbrains.buildServer.serverSide.oauth.OAuthConnectionDescriptor) Test(org.testng.annotations.Test)

Aggregations

VcsRootInstanceImpl (jetbrains.buildServer.vcs.impl.VcsRootInstanceImpl)8 Test (org.testng.annotations.Test)8 SpaceExternalChangeViewerExtension (jetbrains.buildServer.buildTriggers.vcs.git.SpaceExternalChangeViewerExtension)7 SProject (jetbrains.buildServer.serverSide.SProject)3 OAuthConnectionDescriptor (jetbrains.buildServer.serverSide.oauth.OAuthConnectionDescriptor)3 SVcsRoot (jetbrains.buildServer.vcs.SVcsRoot)3 HashMap (java.util.HashMap)1 MockTimeService (jetbrains.buildServer.MockTimeService)1 GitHubPasswordAuthRootRegistryImpl (jetbrains.buildServer.buildTriggers.vcs.git.GitHubPasswordAuthRootRegistryImpl)1 BuildServerListener (jetbrains.buildServer.serverSide.BuildServerListener)1 ProjectManager (jetbrains.buildServer.serverSide.ProjectManager)1 ServerResponsibility (jetbrains.buildServer.serverSide.ServerResponsibility)1 VcsRootInstanceContext (jetbrains.buildServer.serverSide.impl.beans.VcsRootInstanceContext)1 MockSVcsRoot (jetbrains.buildServer.vcs.MockSVcsRoot)1 RepositoryStateListener (jetbrains.buildServer.vcs.RepositoryStateListener)1 VcsRootImpl (jetbrains.buildServer.vcs.impl.VcsRootImpl)1 Expectations (org.jmock.Expectations)1 Mockery (org.jmock.Mockery)1