-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
open repository in external browser with branch (#284)
* Open repo in ext browser with branch * Handled Github, Gitlab & Bitbucket domains for branch navigation. For other domains, navigation to repository would be supported * Unit tests added
- Loading branch information
1 parent
9d96d29
commit 8588127
Showing
3 changed files
with
135 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...g/abapgit/adt/ui/internal/repositories/actions/TestUnitAbapGitRepositoriesOpenAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.abapgit.adt.ui.internal.repositories.actions; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.junit.Assert; | ||
|
||
import java.net.URISyntaxException; | ||
|
||
import org.abapgit.adt.backend.model.abapgitrepositories.IRepository; | ||
import org.abapgit.adt.backend.model.abapgitrepositories.impl.AbapgitrepositoriesFactoryImpl; | ||
import org.abapgit.adt.ui.internal.repositories.AbapGitView; | ||
import org.abapgit.adt.ui.internal.repositories.TestsPdeAbapGitRepositoriesUtil; | ||
import org.eclipse.core.runtime.CoreException; | ||
|
||
public class TestUnitAbapGitRepositoriesOpenAction { | ||
|
||
private static OpenRepositoryAction openAction; | ||
private static AbapGitView view; | ||
private static IRepository dummyGitSelection; | ||
private static IRepository dummyBitSelection; | ||
private static TestsPdeAbapGitRepositoriesUtil utils; | ||
|
||
@BeforeClass | ||
public static void setup() throws CoreException { | ||
utils = new TestsPdeAbapGitRepositoriesUtil(); | ||
view = utils.initializeView(); | ||
// git based host | ||
dummyGitSelection = utils.createDummyRepository(); | ||
// bitbucket host | ||
dummyBitSelection = AbapgitrepositoriesFactoryImpl.eINSTANCE.createRepository(); | ||
dummyBitSelection.setUrl("https://user1234@bitbucket.org/user1234/dummy.git"); | ||
dummyBitSelection.setPackage("$AP_GITHUB"); | ||
dummyBitSelection.setCreatedEmail("dummy_user_one@email.com"); | ||
dummyBitSelection.setBranchName("refs/heads/master"); | ||
dummyBitSelection.setDeserializedAt("20200322180503"); | ||
dummyBitSelection.setStatusText("dummy_status"); | ||
openAction = new OpenRepositoryAction(view); | ||
} | ||
|
||
@Test | ||
public void testOpenRepositoryInBrowserAction() throws URISyntaxException { | ||
String actualGitLink = openAction.getLink(dummyGitSelection); | ||
String expectedGitLink = "https://github.com/dummy_url/tree/master"; | ||
Assert.assertEquals(actualGitLink, expectedGitLink); | ||
|
||
String actualBitLink = openAction.getLink(dummyBitSelection); | ||
String expectedBitLink = "https://bitbucket.org/user1234/dummy/src/master"; | ||
Assert.assertEquals(actualBitLink, expectedBitLink); | ||
} | ||
} |