Java Code Examples for hudson.util.StreamTaskListener#fromStdout()
The following examples show how to use
hudson.util.StreamTaskListener#fromStdout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SmartCredentialsProviderTest.java From git-client-plugin with MIT License | 6 votes |
@Before public void setUp() { listener = StreamTaskListener.fromStdout(); provider = new SmartCredentialsProvider(listener); username = new CredentialItem.Username(); password = new CredentialItem.Password(); maskedUsername = new StandardUsernameCredentialsCredentialItem(MASKED_USER_NAME_PROMPT, true); unmaskedUsername = new StandardUsernameCredentialsCredentialItem(UNMASKED_USER_NAME_PROMPT, false); maskedStringType = new CredentialItem.StringType(MASKED_STRING_TYPE_PROMPT, true); unmaskedStringType = new CredentialItem.StringType(UNMASKED_STRING_TYPE_PROMPT, false); specialStringType = new CredentialItem.StringType(SPECIAL_STRING_TYPE_PROMPT, false); assertNull(username.getValue()); assertNull(password.getValue()); assertNull(maskedUsername.getValue()); assertNull(unmaskedUsername.getValue()); assertNull(maskedStringType.getValue()); assertNull(unmaskedStringType.getValue()); }
Example 2
Source File: GitToolTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testForNode() throws Exception { DumbSlave agent = j.createSlave(); agent.setMode(Node.Mode.EXCLUSIVE); TaskListener log = StreamTaskListener.fromStdout(); GitTool newTool = gitTool.forNode(agent, log); assertEquals(gitTool.getGitExe(), newTool.getGitExe()); }
Example 3
Source File: GitClientCloneTest.java From git-client-plugin with MIT License | 5 votes |
@BeforeClass public static void loadLocalMirror() throws Exception { /* Prime the local mirror cache before other tests run */ /* Allow 3-7 second delay before priming the cache */ /* Allow other tests a better chance to prime the cache */ /* 3-7 second delay is small compared to execution time of this test */ Random random = new Random(); Thread.sleep((3 + random.nextInt(5)) * 1000L); // Wait 3-7 seconds before priming the cache TaskListener mirrorListener = StreamTaskListener.fromStdout(); File tempDir = Files.createTempDirectory("PrimeCloneTest").toFile(); WorkspaceWithRepo cache = new WorkspaceWithRepo(tempDir, "git", mirrorListener); cache.localMirror(); Util.deleteRecursive(tempDir); }
Example 4
Source File: GitClientCliCloneTest.java From git-client-plugin with MIT License | 5 votes |
@BeforeClass public static void loadLocalMirror() throws Exception { /* Prime the local mirror cache before other tests run */ TaskListener mirrorListener = StreamTaskListener.fromStdout(); File tempDir = Files.createTempDirectory("PrimeCliCloneTest").toFile(); WorkspaceWithRepo cache = new WorkspaceWithRepo(tempDir, "git", mirrorListener); cache.localMirror(); Util.deleteRecursive(tempDir); }
Example 5
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Before public void setUp() { Secret secret = Secret.fromString(SECRET_VALUE); listener = StreamTaskListener.fromStdout(); StandardUsernameCredentials cred = new StandardUsernamePasswordCredentialsImpl(USER_NAME, secret); provider = new CredentialsProviderImpl(listener, cred); }
Example 6
Source File: CredentialsProviderImplTest.java From git-client-plugin with MIT License | 5 votes |
@Test public void testSupportsDisallowed() { Secret secret = Secret.fromString(SECRET_VALUE); listener = StreamTaskListener.fromStdout(); StandardUsernameCredentials badCred = new MyUsernameCredentialsImpl(USER_NAME); CredentialsProviderImpl badProvider = new CredentialsProviderImpl(listener, badCred); CredentialItem.Username username = new CredentialItem.Username(); assertNull(username.getValue()); assertFalse(badProvider.supports(username)); assertFalse(badProvider.get(uri, username)); assertNull(username.getValue()); }
Example 7
Source File: GitClientFetchTest.java From git-client-plugin with MIT License | 5 votes |
@BeforeClass public static void loadLocalMirror() throws Exception { /* Prime the local mirror cache before other tests run */ /* Allow 2-5 second delay before priming the cache */ /* Allow other tests a better chance to prime the cache */ /* 2-5 second delay is small compared to execution time of this test */ Random random = new Random(); Thread.sleep((2 + random.nextInt(4)) * 1000L); // Wait 2-5 seconds before priming the cache TaskListener mirrorListener = StreamTaskListener.fromStdout(); File tempDir = Files.createTempDirectory("PrimeFetchTest").toFile(); WorkspaceWithRepo cache = new WorkspaceWithRepo(tempDir, "git", mirrorListener); cache.localMirror(); Util.deleteRecursive(tempDir); }
Example 8
Source File: JenkinsRule.java From jenkins-test-harness with MIT License | 4 votes |
/** * Creates {@link hudson.Launcher.LocalLauncher}. Useful for launching processes. */ public Launcher.LocalLauncher createLocalLauncher() { return new Launcher.LocalLauncher(StreamTaskListener.fromStdout()); }
Example 9
Source File: HudsonTestCase.java From jenkins-test-harness with MIT License | 4 votes |
/** * Creates {@link LocalLauncher}. Useful for launching processes. */ protected LocalLauncher createLocalLauncher() { return new LocalLauncher(StreamTaskListener.fromStdout()); }
Example 10
Source File: MergeCommandTest.java From git-client-plugin with MIT License | 4 votes |
@Before public void createMergeTestRepo() throws IOException, InterruptedException { EnvVars env = new hudson.EnvVars(); TaskListener listener = StreamTaskListener.fromStdout(); File repo = tempFolder.newFolder(); git = Git.with(listener, env).in(repo).using(gitImpl).getClient(); git.init_().workspace(repo.getAbsolutePath()).execute(); // Create a master branch char randomChar = (char) ((new Random()).nextInt(26) + 'a'); readme = new File(repo, "README.adoc"); try (PrintWriter writer = new PrintWriter(readme, "UTF-8")) { writer.println("# Master Branch README " + randomChar); } git.add("README.adoc"); git.commit("Commit README on master branch"); commit1Master = git.revParse("HEAD"); assertTrue("master commit 1 missing on master branch", git.revList("master").contains(commit1Master)); assertTrue("README missing on master branch", readme.exists()); // Create branch-1 readmeOne = new File(repo, "README-branch-1.md"); git.checkoutBranch("branch-1", "master"); try (PrintWriter writer = new PrintWriter(readmeOne, "UTF-8")) { writer.println("# Branch 1 README " + randomChar); } git.add(readmeOne.getName()); git.commit("Commit README on branch 1"); commit1Branch = git.revParse("HEAD"); assertFalse("branch commit 1 on master branch", git.revList("master").contains(commit1Branch)); assertTrue("branch commit 1 missing on branch 1", git.revList("branch-1").contains(commit1Branch)); assertTrue("Branch README missing on branch 1", readmeOne.exists()); assertTrue("Master README missing on branch 1", readme.exists()); // Commit a second change to branch-1 try (PrintWriter writer = new PrintWriter(readmeOne, "UTF-8")) { writer.println("# Branch 1 README " + randomChar); writer.println(""); writer.println("Second change to branch 1 README"); } git.add(readmeOne.getName()); git.commit("Commit 2nd README change on branch 1"); commit2Branch = git.revParse("HEAD"); assertFalse("branch commit 2 on master branch", git.revList("master").contains(commit2Branch)); assertTrue("branch commit 2 not on branch 1", git.revList("branch-1").contains(commit2Branch)); assertTrue("Branch README missing on branch 1", readmeOne.exists()); assertTrue("Master README missing on branch 1", readme.exists()); git.checkoutBranch("branch-2", "master"); try (PrintWriter writer = new PrintWriter(readme, "UTF-8")) { writer.println(BRANCH_2_README_CONTENT + randomChar); writer.println(""); writer.println("Changed on branch commit"); } git.add("README.adoc"); git.commit("Commit README change on branch 2"); commit1Branch2 = git.revParse("HEAD"); assertTrue("Change README commit not on branch 2", git.revListAll().contains(commit1Branch2)); assertFalse("Change README commit on master branch unexpectedly", git.revList("master").contains(commit1Branch2)); // Commit a second change to master branch git.checkout().ref("master").execute(); try (PrintWriter writer = new PrintWriter(readme, "UTF-8")) { writer.println("# Master Branch README " + randomChar); writer.println(""); writer.println("Second commit"); } git.add("README.adoc"); git.commit("Commit 2nd README change on master branch"); commit2Master = git.revParse("HEAD"); assertTrue("commit 2 not on master branch", git.revListAll().contains(commit2Master)); assertFalse("Branch commit 2 on master branch unexpectedly", git.revList("master").contains(commit2Branch)); assertFalse("README 1 on master branch unexpectedly", readmeOne.exists()); mergeCmd = git.merge(); assertFalse("branch commit 1 on master branch prematurely", git.revList("master").contains(commit1Branch)); assertFalse("branch commit 2 on master branch prematurely", git.revList("master").contains(commit2Branch)); }