Skip to content

Commit

Permalink
clean up naming
Browse files Browse the repository at this point in the history
  • Loading branch information
chillleader committed Nov 15, 2024
1 parent 8e47f7a commit b436df1
Show file tree
Hide file tree
Showing 29 changed files with 90 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ server.port=8080

management.server.port=9080
management.endpoints.web.exposure.include=metrics,health,prometheus,loggers
management.endpoint.health.group.readiness.include[]=zeebeClient,operate
management.endpoint.health.group.readiness.include[]=zeebeClient,processDefinitionImport

camunda.connector.polling.enabled=true
camunda.connector.polling.interval=5000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
server.port=8080
server.port=8081

management.context-path=/actuator
management.endpoints.web.exposure.include=metrics,health,prometheus
management.endpoint.health.group.readiness.include[]=zeebeClient,operate
management.endpoint.health.group.readiness.include[]=zeebeClient,processDefinitionImport
management.endpoint.health.show-components=always
management.endpoint.health.show-details=always

Expand All @@ -14,13 +14,16 @@ camunda.client.zeebe.defaults.stream-enabled=true
camunda.client.mode=self-managed

# Config for use with docker-compose.yml
camunda.client.zeebe.rest-address=http://localhost:8080
camunda.client.auth.client-id=connectors
camunda.client.auth.client-secret=XALaRPl5qwTEItdwCMiPS62nVpKs7dL7
camunda.client.auth.oidc-type=keycloak
camunda.client.auth.issuer=http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
camunda.client.identity.audience=connectors
camunda.client.identity.base-url=http://localhost:8084

camunda.client.zeebe.max-message-size=4194304

# Config for use with docker-compose-core.yml
#camunda.client.auth.username=demo
#camunda.client.auth.password=demo
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
management.context-path=/actuator
management.endpoints.web.exposure.include=metrics,health,prometheus,loggers
management.endpoint.health.group.readiness.include[]=zeebeClient,operate
management.endpoint.health.group.readiness.include[]=zeebeClient,processDefinitionImport
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@
public class InboundIntermediateConnectorContextImpl
implements InboundIntermediateConnectorContext, InboundConnectorReportingContext {
private final InboundConnectorReportingContext inboundContext;
private final ProcessInstanceClient operateClient;
private final ProcessInstanceClient processInstanceClient;
private final ValidationProvider validationProvider;
private final ObjectMapper objectMapper;
private final InboundCorrelationHandler correlationHandler;

public InboundIntermediateConnectorContextImpl(
final InboundConnectorReportingContext inboundContext,
final ProcessInstanceClient operateClient,
final ProcessInstanceClient processInstanceClient,
final ValidationProvider validationProvider,
final ObjectMapper objectMapper,
final InboundCorrelationHandler correlationHandler) {
this.inboundContext = inboundContext;
this.operateClient = operateClient;
this.processInstanceClient = processInstanceClient;
this.validationProvider = validationProvider;
this.objectMapper = objectMapper;
this.correlationHandler = correlationHandler;
Expand All @@ -72,7 +72,7 @@ public List<ProcessInstanceContext> getProcessInstanceContexts() {
if (elementInfo.correlationPoint() instanceof BoundaryEventCorrelationPoint point) {
elementId = point.attachedTo().elementId();
}
return operateClient.fetchActiveProcessInstanceKeyByDefinitionKeyAndElementId(
return processInstanceClient.fetchActiveProcessInstanceKeyByDefinitionKeyAndElementId(
elementInfo.element().processDefinitionKey(), elementId);
})
.flatMap(List::stream)
Expand All @@ -82,7 +82,8 @@ public List<ProcessInstanceContext> getProcessInstanceContexts() {

private ProcessInstanceContext createProcessInstanceContext(FlowNodeInstance node) {
Supplier<Map<String, Object>> variableSupplier =
() -> operateClient.fetchVariablesByProcessInstanceKey(node.getProcessInstanceKey());
() ->
processInstanceClient.fetchVariablesByProcessInstanceKey(node.getProcessInstanceKey());

return new DefaultProcessInstanceContext(
this, node, validationProvider, correlationHandler, objectMapper, variableSupplier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import io.camunda.connector.runtime.inbound.executable.InboundExecutableRegistry;
import io.camunda.connector.runtime.inbound.executable.InboundExecutableRegistryImpl;
import io.camunda.connector.runtime.inbound.importer.ProcessDefinitionImportConfiguration;
import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.operate.OperateClientImpl;
import io.camunda.connector.runtime.inbound.operate.ProcessInstanceClientConfiguration;
import io.camunda.connector.runtime.inbound.search.ProcessInstanceClientConfiguration;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClientImpl;
import io.camunda.connector.runtime.inbound.state.ProcessDefinitionInspector;
import io.camunda.connector.runtime.inbound.state.ProcessStateStore;
import io.camunda.connector.runtime.inbound.state.TenantAwareProcessStateStoreImpl;
Expand Down Expand Up @@ -124,12 +124,12 @@ public InboundExecutableRegistry inboundExecutableRegistry(
}

@Bean
OperateClient operateClient(ZeebeClient zeebeClient) {
return new OperateClientImpl(zeebeClient);
SearchQueryClient operateClient(ZeebeClient zeebeClient) {
return new SearchQueryClientImpl(zeebeClient);
}

@Bean
public ProcessDefinitionInspector processDefinitionInspector(OperateClient operateClient) {
public ProcessDefinitionInspector processDefinitionInspector(SearchQueryClient operateClient) {
return new ProcessDefinitionInspector(operateClient);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package io.camunda.connector.runtime.inbound.importer;

import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import io.camunda.connector.runtime.inbound.state.ProcessStateStore;
import io.camunda.zeebe.spring.client.metrics.MetricsRecorder;
import org.springframework.context.annotation.Bean;
Expand All @@ -26,7 +26,7 @@
public class ProcessDefinitionImportConfiguration {

@Bean
public ProcessDefinitionSearch processDefinitionSearch(OperateClient client) {
public ProcessDefinitionSearch processDefinitionSearch(SearchQueryClient client) {
return new ProcessDefinitionSearch(client);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package io.camunda.connector.runtime.inbound.importer;

import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import io.camunda.zeebe.client.api.search.response.ProcessDefinition;
import io.camunda.zeebe.client.api.search.response.SearchQueryResponse;
import java.util.ArrayList;
Expand All @@ -35,10 +35,10 @@
public class ProcessDefinitionSearch {

private static final Logger LOG = LoggerFactory.getLogger(ProcessDefinitionSearch.class);
private final OperateClient operateClient;
private final SearchQueryClient searchQueryClient;

public ProcessDefinitionSearch(OperateClient operateClient) {
this.operateClient = operateClient;
public ProcessDefinitionSearch(SearchQueryClient operateClient) {
this.searchQueryClient = operateClient;
}

/**
Expand All @@ -55,7 +55,7 @@ public List<ProcessDefinition> query() {
final Set<String> encounteredBpmnProcessIds = new HashSet<>();

do {
processDefinitionResult = operateClient.queryProcessDefinitions(paginationIndex);
processDefinitionResult = searchQueryClient.queryProcessDefinitions(paginationIndex);
List<Object> newPaginationIdx = processDefinitionResult.page().lastSortValues();

LOG.debug("A page of process definitions has been fetched, continuing...");
Expand All @@ -80,7 +80,7 @@ public List<ProcessDefinition> query() {
processDefinitions.addAll(items);

} while (processDefinitionResult.items() != null && !processDefinitionResult.items().isEmpty());
LOG.debug("Fetching from Operate has been correctly executed.");
LOG.debug("Fetching process definitions has been correctly executed.");
return processDefinitions;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.connector.runtime.inbound.operate;
package io.camunda.connector.runtime.inbound.search;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.camunda.connector.runtime.core.inbound.ProcessInstanceClient;
Expand All @@ -25,7 +25,7 @@
public class ProcessInstanceClientConfiguration {
@Bean
public ProcessInstanceClient springOperateClientAdapter(
OperateClient operateClient, ObjectMapper mapper) {
SearchQueryClient operateClient, ObjectMapper mapper) {
return new ProcessInstanceClientImpl(operateClient, mapper);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.connector.runtime.inbound.operate;
package io.camunda.connector.runtime.inbound.search;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand All @@ -33,12 +33,13 @@

public class ProcessInstanceClientImpl implements ProcessInstanceClient {

private final OperateClient operateClient;
private final SearchQueryClient operateClient;
private final ObjectMapper mapper;
private final Lock fetchActiveProcessLock;
private final Lock fetchVariablesLock;

public ProcessInstanceClientImpl(final OperateClient operateClient, final ObjectMapper mapper) {
public ProcessInstanceClientImpl(
final SearchQueryClient operateClient, final ObjectMapper mapper) {
this.operateClient = operateClient;
this.mapper = mapper;
this.fetchActiveProcessLock = new ReentrantLock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.connector.runtime.inbound.operate;
package io.camunda.connector.runtime.inbound.search;

import io.camunda.zeebe.client.api.search.response.FlowNodeInstance;
import io.camunda.zeebe.client.api.search.response.ProcessDefinition;
Expand All @@ -23,8 +23,8 @@
import io.camunda.zeebe.model.bpmn.BpmnModelInstance;
import java.util.List;

/** Wrapper over Zeebe client for Operate methods. Enables easier mocking and testing. */
public interface OperateClient {
/** Wrapper over Zeebe client for search query methods. Enables easier mocking and testing. */
public interface SearchQueryClient {

SearchQueryResponse<ProcessDefinition> queryProcessDefinitions(List<Object> paginationIndex);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.connector.runtime.inbound.operate;
package io.camunda.connector.runtime.inbound.search;

import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.client.api.search.response.FlowNodeInstance;
Expand All @@ -26,13 +26,13 @@
import java.io.ByteArrayInputStream;
import java.util.List;

public class OperateClientImpl implements OperateClient {
public class SearchQueryClientImpl implements SearchQueryClient {

private static final int PAGE_SIZE = 50;

private final ZeebeClient zeebeClient;

public OperateClientImpl(ZeebeClient zeebeClient) {
public SearchQueryClientImpl(ZeebeClient zeebeClient) {
this.zeebeClient = zeebeClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.camunda.connector.runtime.core.inbound.correlation.MessageStartEventCorrelationPoint;
import io.camunda.connector.runtime.core.inbound.correlation.ProcessCorrelationPoint;
import io.camunda.connector.runtime.core.inbound.correlation.StartEventCorrelationPoint;
import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult.ProcessDefinitionIdentifier;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult.ProcessDefinitionVersion;
import io.camunda.zeebe.model.bpmn.BpmnModelInstance;
Expand Down Expand Up @@ -76,9 +76,9 @@ public class ProcessDefinitionInspector {
INBOUND_ELIGIBLE_TYPES.add(BoundaryEvent.class);
}

private final OperateClient operateClient;
private final SearchQueryClient operateClient;

public ProcessDefinitionInspector(OperateClient operateClient) {
public ProcessDefinitionInspector(SearchQueryClient operateClient) {
this.operateClient = operateClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static org.mockito.Mockito.when;

import io.camunda.connector.runtime.core.inbound.InboundConnectorElement;
import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import io.camunda.connector.runtime.inbound.state.ProcessDefinitionInspector;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult.ProcessDefinitionIdentifier;
Expand Down Expand Up @@ -120,7 +120,7 @@ public void testDuplicatePropertiesAreRemoved() {

private List<InboundConnectorElement> fromModel(String fileName, String processId) {
try {
var operateClientMock = mock(OperateClient.class);
var operateClientMock = mock(SearchQueryClient.class);
var inspector = new ProcessDefinitionInspector(operateClientMock);
var modelFile = ResourceUtils.getFile("classpath:bpmn/" + fileName);
var model = Bpmn.readModelFromStream(new FileInputStream(modelFile));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.camunda.connector.runtime.inbound.operate;
package io.camunda.connector.runtime.inbound.search;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyLong;
Expand Down Expand Up @@ -45,7 +45,7 @@
@ExtendWith(MockitoExtension.class)
class ProcessInstanceClientImplTest {

@Mock private OperateClient operateClient;
@Mock private SearchQueryClient operateClient;
private ObjectMapper objectMapper;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public ZeebeHealthIndicator zeebeClientHealthIndicator(ZeebeClient zeebeClient)
}

@Bean
public OperateHealthIndicator operateHealthIndicator(
public ProcessDefinitionImportHealthIndicator processDefinitionImportHealthIndicator(
@Autowired(required = false) ProcessDefinitionImporter processDefinitionImporter) {
return new OperateHealthIndicator(processDefinitionImporter);
return new ProcessDefinitionImportHealthIndicator(processDefinitionImporter);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health.Builder;

public class OperateHealthIndicator extends AbstractHealthIndicator {
public class ProcessDefinitionImportHealthIndicator extends AbstractHealthIndicator {

private final ProcessDefinitionImporter processDefinitionImporter;

public OperateHealthIndicator(@Nullable ProcessDefinitionImporter processDefinitionImporter) {
public ProcessDefinitionImportHealthIndicator(
@Nullable ProcessDefinitionImporter processDefinitionImporter) {
this.processDefinitionImporter = processDefinitionImporter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package io.camunda.connector.e2e.app;

import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -28,7 +28,7 @@
io.camunda.connector.runtime.OutboundConnectorsAutoConfiguration.class,
io.camunda.connector.runtime.WebhookConnectorAutoConfiguration.class
})
@MockBean(OperateClient.class)
@MockBean(SearchQueryClient.class)
public class TestConnectorRuntimeApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import io.camunda.connector.http.base.model.auth.BearerAuthentication;
import io.camunda.connector.http.base.model.auth.OAuthAuthentication;
import io.camunda.connector.runtime.inbound.importer.ProcessDefinitionSearch;
import io.camunda.connector.runtime.inbound.operate.OperateClient;
import io.camunda.connector.runtime.inbound.search.SearchQueryClient;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult.ProcessDefinitionIdentifier;
import io.camunda.connector.runtime.inbound.state.ProcessImportResult.ProcessDefinitionVersion;
Expand Down Expand Up @@ -87,7 +87,7 @@ public class HttpTests {

@Autowired ProcessStateStore stateStore;

@MockBean OperateClient operateClient;
@MockBean SearchQueryClient searchQueryClient;

@LocalServerPort int serverPort;

Expand Down Expand Up @@ -338,7 +338,7 @@ void successfulWebhookModelRun() throws Exception {
var model = replace("webhook_connector.bpmn", replace("http://webhook", mockUrl));

// Prepare a mocked process connectorData backed by our test model
when(operateClient.getProcessModel(1L)).thenReturn(model);
when(searchQueryClient.getProcessModel(1L)).thenReturn(model);
var processDef = mock(ProcessDefinition.class);
when(processDef.getProcessDefinitionKey()).thenReturn(1L);
when(processDef.getTenantId()).thenReturn(zeebeClient.getConfiguration().getDefaultTenantId());
Expand Down Expand Up @@ -367,7 +367,7 @@ void successfulWebhookModelWithQueryParamsRun() throws Exception {
var model = replace("webhook_connector.bpmn", replace("http://webhook", mockUrl));

// Prepare a mocked process connectorData backed by our test model
when(operateClient.getProcessModel(1L)).thenReturn(model);
when(searchQueryClient.getProcessModel(1L)).thenReturn(model);
var processDef = mock(ProcessDefinition.class);
when(processDef.getProcessDefinitionKey()).thenReturn(1L);
when(processDef.getTenantId()).thenReturn(zeebeClient.getConfiguration().getDefaultTenantId());
Expand Down
Loading

0 comments on commit b436df1

Please sign in to comment.