Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
igpetrov committed Feb 26, 2024
1 parent 6cc17bd commit 5220c24
Show file tree
Hide file tree
Showing 16 changed files with 147 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
"label" : "Type",
"optional" : false,
"value" : "BEARER",
"constraints" : {
"notEmpty" : true
},
"group" : "authentication",
"binding" : {
"name" : "authentication.authType",
Expand All @@ -70,9 +67,6 @@
"label" : "Bearer token",
"description" : "Enter a valid Google API Bearer token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -90,9 +84,6 @@
"label" : "Client ID",
"description" : "Enter Google API Client ID",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -110,9 +101,6 @@
"label" : "Client secret",
"description" : "Enter Google API client Secret",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -130,9 +118,6 @@
"label" : "Refresh token",
"description" : "Enter a valid Google API refresh token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
"label" : "Type",
"optional" : false,
"value" : "BEARER",
"constraints" : {
"notEmpty" : true
},
"group" : "authentication",
"binding" : {
"name" : "authentication.authType",
Expand All @@ -65,9 +62,6 @@
"label" : "Bearer token",
"description" : "Enter a valid Google API Bearer token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -85,9 +79,6 @@
"label" : "Client ID",
"description" : "Enter Google API Client ID",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -105,9 +96,6 @@
"label" : "Client secret",
"description" : "Enter Google API client Secret",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -125,9 +113,6 @@
"label" : "Refresh token",
"description" : "Enter a valid Google API refresh token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,25 @@
"type" : "zeebe:taskDefinition"
},
"type" : "String"
}, {
"id" : "operation.type",
"label" : "Type",
"feel" : "optional",
"binding" : {
"name" : "operation.type",
"type" : "zeebe:input"
},
"condition" : {
"property" : "operation.operation",
"equals" : "createEmptyColumnOrRow",
"type" : "simple"
},
"type" : "String"
}, {
"id" : "authentication.authType",
"label" : "Type",
"optional" : false,
"value" : "BEARER",
"constraints" : {
"notEmpty" : true
},
"group" : "authentication",
"binding" : {
"name" : "authentication.authType",
Expand All @@ -70,9 +81,6 @@
"label" : "Bearer token",
"description" : "Enter a valid Google API Bearer token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -90,9 +98,6 @@
"label" : "Client ID",
"description" : "Enter Google API Client ID",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -110,9 +115,6 @@
"label" : "Client secret",
"description" : "Enter Google API client Secret",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -130,9 +132,6 @@
"label" : "Refresh token",
"description" : "Enter a valid Google API refresh token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema" : "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name" : "Google Sheets Outbound Connector v2",
"id" : "io.camunda.connectors.GoogleSheets.v2",
"name" : "Google Sheets Outbound Connector",
"id" : "io.camunda.connectors.GoogleSheets.v1",
"description" : "Work with spreadsheets",
"documentationRef" : "https://docs.camunda.io/docs/components/connectors/out-of-the-box-connectors/google-sheets/",
"version" : 2,
Expand Down Expand Up @@ -39,14 +39,25 @@
"type" : "zeebe:taskDefinition"
},
"type" : "Hidden"
}, {
"id" : "operation.type",
"label" : "Type",
"feel" : "optional",
"binding" : {
"name" : "operation.type",
"type" : "zeebe:input"
},
"condition" : {
"property" : "operation.operation",
"equals" : "createEmptyColumnOrRow",
"type" : "simple"
},
"type" : "String"
}, {
"id" : "authentication.authType",
"label" : "Type",
"optional" : false,
"value" : "BEARER",
"constraints" : {
"notEmpty" : true
},
"group" : "authentication",
"binding" : {
"name" : "authentication.authType",
Expand All @@ -65,9 +76,6 @@
"label" : "Bearer token",
"description" : "Enter a valid Google API Bearer token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -85,9 +93,6 @@
"label" : "Client ID",
"description" : "Enter Google API Client ID",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -105,9 +110,6 @@
"label" : "Client secret",
"description" : "Enter Google API client Secret",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -125,9 +127,6 @@
"label" : "Refresh token",
"description" : "Enter a valid Google API refresh token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ private static void verifyAuthentication(Authentication authentication) {

if (authentication.authType() == AuthenticationType.REFRESH) {
assertThat(authentication.oauthClientId()).isNotNull().isEqualTo(ACTUAL_OAUTH_CLIENT_ID);
assertThat(authentication.oauthClientSecret())
.isNotNull()
.isEqualTo(ACTUAL_OAUTH_SECRET_ID);
assertThat(authentication.oauthClientSecret()).isNotNull().isEqualTo(ACTUAL_OAUTH_SECRET_ID);
assertThat(authentication.oauthRefreshToken()).isNotNull().isEqualTo(ACTUAL_REFRESH_TOKEN);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.camunda.google.model.AuthenticationType;
import java.io.IOException;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -62,10 +61,14 @@ void addValue_shouldAddValue() throws IOException {
.thenReturn(null);

// When
new AddValuesOperation(model).execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));
new AddValuesOperation(model)
.execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));

// Then
mockedServiceSupplier.verify(() -> GoogleSheetsServiceSupplier.getGoogleSheetsService(new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
mockedServiceSupplier.verify(
() ->
GoogleSheetsServiceSupplier.getGoogleSheetsService(
new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
verify(
service
.spreadsheets()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CreateEmptyColumnOrRowOperationTest extends BaseTest {
private Sheets service;

@Captor private ArgumentCaptor<BatchUpdateSpreadsheetRequest> requestsCaptor;

private BatchUpdateSpreadsheetResponse response;

@BeforeEach
Expand Down Expand Up @@ -82,10 +82,14 @@ void createEmptyColumnOrRow_shouldAppendEmptyRow() throws IOException {
.thenReturn(response);

// When
new CreateEmptyColumnOrRowOperation(model).execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));
new CreateEmptyColumnOrRowOperation(model)
.execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));

// Then
mockedServiceSupplier.verify(() -> GoogleSheetsServiceSupplier.getGoogleSheetsService(new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
mockedServiceSupplier.verify(
() ->
GoogleSheetsServiceSupplier.getGoogleSheetsService(
new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));

List<Request> requests = requestsCaptor.getValue().getRequests();
assertThat(requests, hasSize(1));
Expand Down Expand Up @@ -124,10 +128,14 @@ void createEmptyColumnOrRow_shouldInsertEmptyColumn() throws IOException {
.thenReturn(response);

// When
new CreateEmptyColumnOrRowOperation(model).execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));
new CreateEmptyColumnOrRowOperation(model)
.execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));

// Then
mockedServiceSupplier.verify(() -> GoogleSheetsServiceSupplier.getGoogleSheetsService(new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
mockedServiceSupplier.verify(
() ->
GoogleSheetsServiceSupplier.getGoogleSheetsService(
new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));

List<Request> requests = requestsCaptor.getValue().getRequests();
assertThat(requests, hasSize(1));
Expand Down Expand Up @@ -164,7 +172,11 @@ void createEmptyColumnOrRow_shouldThrowExceptionWhenStartIndexIsEmpty() {
CreateEmptyColumnOrRowOperation operation = new CreateEmptyColumnOrRowOperation(model);
// When and Then

assertThrows(IllegalArgumentException.class, () -> operation.execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
assertThrows(
IllegalArgumentException.class,
() ->
operation.execute(
new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
mockedServiceSupplier.verifyNoInteractions();
}
}
Expand All @@ -186,7 +198,11 @@ void createEmptyColumnOrRow_shouldThrowExceptionWhenEndIndexIsEmpty() {
CreateEmptyColumnOrRowOperation operation = new CreateEmptyColumnOrRowOperation(model);

// When and Then
assertThrows(IllegalArgumentException.class, () -> operation.execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
assertThrows(
IllegalArgumentException.class,
() ->
operation.execute(
new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
mockedServiceSupplier.verifyNoInteractions();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.camunda.google.model.AuthenticationType;
import java.io.IOException;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand All @@ -36,8 +35,7 @@ class CreateRowOperationTest extends BaseTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Sheets service;

//private Authentication auth;

// private Authentication auth;

@DisplayName("Should create row in defined worksheet")
@Test
Expand All @@ -64,10 +62,14 @@ void createRow_shouldCreateRowInDefinedWorksheet() throws IOException {
.thenReturn(null);

// When
new CreateRowOperation(model).execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));
new CreateRowOperation(model)
.execute(new Authentication(AuthenticationType.BEARER, "abc", null, null, null));

// Then
mockedServiceSupplier.verify(() -> GoogleSheetsServiceSupplier.getGoogleSheetsService(new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
mockedServiceSupplier.verify(
() ->
GoogleSheetsServiceSupplier.getGoogleSheetsService(
new Authentication(AuthenticationType.BEARER, "abc", null, null, null)));
verify(
service
.spreadsheets()
Expand Down
Loading

0 comments on commit 5220c24

Please sign in to comment.