hudson.slaves.JNLPLauncher Java Examples
The following examples show how to use
hudson.slaves.JNLPLauncher.
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: ECSSlaveTest.java From amazon-ecs-plugin with MIT License | 6 votes |
@Test public void terminateRunningTask() throws Exception { ECSService ecsService = mock(ECSService.class); ECSCloud cloud = mock(ECSCloud.class); Mockito.when(cloud.getEcsService()).thenReturn(ecsService); ByteArrayOutputStream bo = new ByteArrayOutputStream(); TaskListener listener = mock(TaskListener.class); Mockito.when(listener.getLogger()).thenReturn(new PrintStream(bo)); ECSTaskTemplate template = getTaskTemplate(); ECSSlave sut = new ECSSlave(cloud, "myagent", template, new JNLPLauncher()); sut.setTaskArn("mytaskarn"); sut.setClusterArn("myclusterarn"); sut.setNodeName("mynode"); sut._terminate(listener); // Delete the task verify(ecsService, times(1)).stopTask("mytaskarn", "myclusterarn"); }
Example #2
Source File: ECSSlaveTest.java From amazon-ecs-plugin with MIT License | 6 votes |
@Test public void terminate_ThrowsException_ignoreException() throws Exception { ECSService ecsService = mock(ECSService.class); Mockito.doThrow(new ClientException("failed")) .when(ecsService).stopTask("mytaskarn", "myclusterarn"); ECSCloud cloud = mock(ECSCloud.class); Mockito.when(cloud.getEcsService()).thenReturn(ecsService); ByteArrayOutputStream bo = new ByteArrayOutputStream(); TaskListener listener = mock(TaskListener.class); Mockito.when(listener.getLogger()).thenReturn(new PrintStream(bo)); ECSTaskTemplate template = getTaskTemplate(); ECSSlave sut = new ECSSlave(cloud, "myagent", template, new JNLPLauncher()); sut.setTaskArn("mytaskarn"); sut.setClusterArn("myclusterarn"); sut.setNodeName("mynode"); sut._terminate(listener); // Delete the task verify(ecsService, times(1)).stopTask("mytaskarn", "myclusterarn"); }
Example #3
Source File: DockerComputerJNLPConnectorTest.java From docker-plugin with MIT License | 6 votes |
@Test public void testKeepingEvnInBeforeContainerCreated() throws IOException, InterruptedException { // Given final String env1 = "ENV1=val1"; final String vmargs = "-Dhttp.proxyPort=8080"; final DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLauncher(null, vmargs)); final CreateContainerCmd createCmd = mock(CreateContainerCmd.class); final Map<String, String> containerLabels = new TreeMap<>(); when(createCmd.getLabels()).thenReturn(containerLabels); DockerTemplate.setNodeNameInContainerConfig(createCmd, "nodeName"); when(createCmd.getEnv()).thenReturn(new String[]{ env1 }); // When connector.beforeContainerCreated(null, null, createCmd); // Then verify(createCmd, times(1)).withEnv(new String[]{ env1, "JAVA_OPT=" + vmargs }); }
Example #4
Source File: DockerComputerJNLPConnectorTest.java From docker-plugin with MIT License | 6 votes |
@Test public void testAddingVmargsInBeforeContainerCreated() throws IOException, InterruptedException { // Given final String vmargs = "-Dhttp.proxyPort=8080"; final DockerComputerJNLPConnector connector = new DockerComputerJNLPConnector(new JNLPLauncher(null, vmargs)); final CreateContainerCmd createCmd = mock(CreateContainerCmd.class); final Map<String, String> containerLabels = new TreeMap<>(); when(createCmd.getLabels()).thenReturn(containerLabels); DockerTemplate.setNodeNameInContainerConfig(createCmd, "nodeName"); // When connector.beforeContainerCreated(null, null, createCmd); // Then verify(createCmd, times(1)).withEnv(new String[]{ "JAVA_OPT=" + vmargs }); }
Example #5
Source File: JNLPLauncherConfigurator.java From configuration-as-code-plugin with MIT License | 5 votes |
@Override protected JNLPLauncher instance(Mapping config, ConfigurationContext context) throws ConfiguratorException { try { return super.instance(config, context); } catch (ConfiguratorException e) { // see https://issues.jenkins.io/browse/JENKINS-51603 final CNode tunnel = config.get("tunnel"); final CNode vmargs = config.get("vmargs"); return new JNLPLauncher(tunnel != null ? tunnel.asScalar().getValue() : null, vmargs != null ? vmargs.asScalar().getValue() : null); } }
Example #6
Source File: ConfigurationAsCodeTest.java From folder-auth-plugin with MIT License | 4 votes |
@Before public void setUp() throws Exception { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.addNode(new DumbSlave("agent1", "", new JNLPLauncher(true))); folder = j.jenkins.createProject(Folder.class, "root"); }
Example #7
Source File: JNLPLauncherConfigurator.java From configuration-as-code-plugin with MIT License | 4 votes |
public JNLPLauncherConfigurator() { super(JNLPLauncher.class); }
Example #8
Source File: DockerComputerJNLPLauncher.java From yet-another-docker-plugin with MIT License | 4 votes |
@Override public ComputerLauncher getLauncher() { return new JNLPLauncher(); }
Example #9
Source File: DockerComputerJNLPLauncher.java From yet-another-docker-plugin with MIT License | 4 votes |
public Class getJNLPLauncher() { return JNLPLauncher.class; }
Example #10
Source File: DockerComputerJNLPConnector.java From docker-plugin with MIT License | 4 votes |
@Restricted(NoExternalUse.class) public DockerComputerJNLPConnector() { this(new JNLPLauncher()); }
Example #11
Source File: DockerComputerJNLPConnector.java From docker-plugin with MIT License | 4 votes |
@DataBoundConstructor public DockerComputerJNLPConnector(JNLPLauncher jnlpLauncher) { this.jnlpLauncher = jnlpLauncher; }
Example #12
Source File: DockerComputerJNLPConnector.java From docker-plugin with MIT License | 4 votes |
public JNLPLauncher getJnlpLauncher() { return jnlpLauncher; }
Example #13
Source File: DockerComputerJNLPConnector.java From docker-plugin with MIT License | 4 votes |
@Override protected ComputerLauncher createLauncher(final DockerAPI api, final String workdir, final InspectContainerResponse inspect, TaskListener listener) throws IOException, InterruptedException { return new JNLPLauncher(); }