Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/content/docs/reference/components/jenkins_v1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ Type: OBJECT

### Enable Notification Plugin

1. Click this icon.
1. Click this **Setting** icon.
2. Click on **Plugins**.
3. Click on **Available plugins**.
4. Search for **notification**.
5. Click on **Notification** from **Tikal Knowledge**. [Notification plugin link](https://plugins.jenkins.io/notification/)
6. Click here.
5. Find **Notification** from **Tikal Knowledge**. [Notification plugin link](https://plugins.jenkins.io/notification/)
6. Click on checkbox next to **Notification** from **Tikal Knowledge**.
7. Click on **Install**.
8. Wait for everything to finish downloading.
9. Click on **Go back to the top page**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ public class JenkinsComponentHandler implements ComponentHandler {
"Jenkins is leading open source automation server, Jenkins provides hundreds of plugins to support " +
"building, deploying and automating any project.")
.icon("path:assets/jenkins.svg")
.customAction(true)
.customActionHelp("", "https://www.jenkins.io/doc/book/using/remote-access-api/")
.categories(ComponentCategory.DEVELOPER_TOOLS)
.actions(JenkinsCreateJobAction.ACTION_DEFINITION)
.clusterElements(tool(JenkinsCreateJobAction.ACTION_DEFINITION))
.connection(JenkinsConnection.CONNECTION_DEFINITION)
.triggers(JenkinsNewJobStatusNotificationTrigger.TRIGGER_DEFINITION)
.customAction(true);
.customAction(true)
.version(1);

@Override
public ComponentDefinition getDefinition() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.bytechef.component.definition.Context;
import com.bytechef.component.definition.Context.Http.Body;
import com.bytechef.component.definition.Parameters;
import com.bytechef.component.definition.Property.ControlType;

/**
* @author Nikolina Spehar
Expand All @@ -42,8 +43,10 @@ public class JenkinsCreateJobAction {
string(CONFIG_XML)
.label("Config XML")
.description("Content of the config.xml file.")
.controlType(ControlType.TEXT_AREA)
.required(true))
.perform(JenkinsCreateJobAction::perform);
.perform(JenkinsCreateJobAction::perform)
.help("", "https://docs.bytechef.io/reference/components/jenkins_v1#create-job");

private JenkinsCreateJobAction() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public class JenkinsConnection {
string(BASE_URI)
.label("Base URI")
.description("Complete base URI of your jenkins server.")
.required(true)));
.required(true)))
.help("", "https://docs.bytechef.io/reference/components/jenkins_v1#connection-setup")
.version(1);

private JenkinsConnection() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public class JenkinsNewJobStatusNotificationTrigger {
.description("Additional notes of the Jenkins job build."),
object("artifacts")
.description("Artifacts of Jenkins job build.")))))
.webhookRequest(JenkinsNewJobStatusNotificationTrigger::webhookRequest);
.webhookRequest(JenkinsNewJobStatusNotificationTrigger::webhookRequest)
.help(
"", "https://docs.bytechef.io/reference/components/jenkins_v1#new-job-status-notification");

private JenkinsNewJobStatusNotificationTrigger() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

### Enable Notification Plugin

1. Click this icon.
1. Click this **Setting** icon.
2. Click on **Plugins**.
3. Click on **Available plugins**.
4. Search for **notification**.
5. Click on **Notification** from **Tikal Knowledge**. [Notification plugin link](https://plugins.jenkins.io/notification/)
6. Click here.
5. Find **Notification** from **Tikal Knowledge**. [Notification plugin link](https://plugins.jenkins.io/notification/)
6. Click on checkbox next to **Notification** from **Tikal Knowledge**.
7. Click on **Install**.
8. Wait for everything to finish downloading.
9. Click on **Go back to the top page**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,55 @@
import static com.bytechef.component.jenkins.constant.JenkinsConstants.CONFIG_XML;
import static com.bytechef.component.jenkins.constant.JenkinsConstants.NAME;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import com.bytechef.component.definition.Context;
import com.bytechef.component.definition.Context.ContextFunction;
import com.bytechef.component.definition.Context.Http;
import com.bytechef.component.definition.Context.Http.Body;
import com.bytechef.component.definition.Context.Http.Executor;
import com.bytechef.component.definition.Parameters;
import com.bytechef.component.test.definition.MockParametersFactory;
import com.bytechef.component.test.definition.extension.MockContextSetupExtension;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;

/**
* @author Nikolina Spehar
*/
@ExtendWith(MockContextSetupExtension.class)
class JenkinsCreateJobActionTest {

private final ArgumentCaptor<Body> bodyArgumentCaptor = ArgumentCaptor.forClass(Http.Body.class);
private final ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);
private final Context mockedContext = mock(Context.class);
private final Http.Executor mockedExecutor = mock(Http.Executor.class);
private final Parameters mockedParameters = MockParametersFactory.create(
Map.of(NAME, "name", CONFIG_XML, "configXml"));

@Test
void testPerform() {
when(mockedContext.http(any()))
void testPerform(
Context mockedContext, Executor mockedExecutor, Http mockedHttp,
ArgumentCaptor<ContextFunction<Http, Executor>> httpFunctionArgumentCaptor) {

when(mockedHttp.post(stringArgumentCaptor.capture()))
.thenReturn(mockedExecutor);
when(mockedExecutor.header(stringArgumentCaptor.capture(), stringArgumentCaptor.capture()))
.thenReturn(mockedExecutor);
when(mockedExecutor.queryParameter(stringArgumentCaptor.capture(), stringArgumentCaptor.capture()))
.thenReturn(mockedExecutor);
when(mockedExecutor.body(bodyArgumentCaptor.capture()))
.thenReturn(mockedExecutor);
when(mockedExecutor.execute())
.thenReturn(null);

assertNull(JenkinsCreateJobAction.perform(mockedParameters, mockedParameters, mockedContext));

assertEquals(List.of("Content-Type", "application/xml", NAME, "name"), stringArgumentCaptor.getAllValues());

Body body = bodyArgumentCaptor.getValue();

assertEquals("application/xml", body.getMimeType());
assertEquals("configXml", body.getContent());
assertEquals(
List.of("/createItem", "Content-Type", "application/xml", NAME, "name"),
stringArgumentCaptor.getAllValues());
assertNotNull(httpFunctionArgumentCaptor.getValue());
assertEquals(Body.of("configXml", "application/xml"), bodyArgumentCaptor.getValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"beforeTimeoutResume": null,
"deprecated": null,
"description": "Creates a new job.",
"help": null,
"help": {
"body": "",
"learnMoreUrl": "https://docs.bytechef.io/reference/components/jenkins_v1#create-job"
},
"metadata": null,
"name": "createJob",
"outputDefinition": null,
Expand Down Expand Up @@ -35,7 +38,7 @@
"type": "STRING"
}, {
"advancedOption": null,
"controlType": "TEXT",
"controlType": "TEXT_AREA",
"defaultValue": null,
"description": "Content of the config.xml file.",
"displayCondition": null,
Expand Down Expand Up @@ -89,7 +92,7 @@
"type": "STRING"
}, {
"advancedOption": null,
"controlType": "TEXT",
"controlType": "TEXT_AREA",
"defaultValue": null,
"description": "Content of the config.xml file.",
"displayCondition": null,
Expand Down Expand Up @@ -211,14 +214,20 @@
"type": "BASIC_AUTH"
} ],
"baseUri": { },
"help": null,
"help": {
"body": "",
"learnMoreUrl": "https://docs.bytechef.io/reference/components/jenkins_v1#connection-setup"
},
"processErrorResponse": null,
"properties": null,
"test": null,
"version": 1
},
"customAction": true,
"customActionHelp": null,
"customActionHelp": {
"body": "",
"learnMoreUrl": "https://www.jenkins.io/doc/book/using/remote-access-api/"
},
"description": "Jenkins is leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.",
"icon": "path:assets/jenkins.svg",
"metadata": null,
Expand All @@ -232,7 +241,10 @@
"deprecated": null,
"description": "Triggers when job statuses are changed.",
"dynamicWebhookRefresh": null,
"help": null,
"help": {
"body": "",
"learnMoreUrl": "https://docs.bytechef.io/reference/components/jenkins_v1#new-job-status-notification"
},
"listenerDisable": null,
"listenerEnable": null,
"name": "newJobStatusNotification",
Expand Down
Loading