Skip to content

Commit

Permalink
Merge branch 'develop' into fix/AAE-23566-Audit-Events-Messages-dont-…
Browse files Browse the repository at this point in the history
…follow-schema
  • Loading branch information
revatilimaye authored Aug 28, 2024
2 parents 7f4a0ac + caa4c6b commit f03ef60
Show file tree
Hide file tree
Showing 307 changed files with 2,097 additions and 4,053 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,9 @@ jobs:
- name: Delete Helm chart for ${{ matrix.messaging-broker }}
if: always()
env:
IS_PREVIEW: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'preview') }}
run: |
if [ $IS_PREVIEW = true ]
then
echo "Skipping delete Helm release for preview"
else
echo "Delete Helm release"
make delete
fi
echo "Delete Helm release"
make delete
delete-test-images:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion activiti-cloud-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<name>Activiti Cloud :: Runtime API Parent</name>
<packaging>pom</packaging>
<properties>
<activiti.version>8.7.0-alpha.16</activiti.version>
<activiti.version>8.7.0-alpha.20</activiti.version>
</properties>
<modules>
<module>activiti-cloud-api-dependencies</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@
<artifactId>activiti-cloud-services-audit-parent</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-audit-consumer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-audit-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-audit-jpa</artifactId>
<artifactId>activiti-cloud-services-audit-rest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand All @@ -40,6 +45,16 @@
<artifactId>activiti-cloud-services-audit-liquibase</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-starter-audit-rest</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-starter-audit-consumer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-starter-audit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-api-process-model-impl</artifactId>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-service-messaging-config</artifactId>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-dbp-rest</artifactId>
Expand Down Expand Up @@ -60,14 +56,6 @@
<artifactId>spring-boot-autoconfigure</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
import org.activiti.cloud.services.audit.api.resources.EventsLinkRelationProvider;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

@AutoConfiguration
@Import(AuditConsumerChannelsConfiguration.class)
public class AuditAPIAutoConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-audit-dependencies</artifactId>
<version>8.7.0-SNAPSHOT</version>
<relativePath>../activiti-cloud-audit-dependencies</relativePath>
</parent>
<artifactId>activiti-cloud-services-audit-consumer</artifactId>
<name>Activiti Cloud Audit :: Services :: Audit Events Consumer</name>

<properties>
</properties>
<dependencies>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-api-model-shared</artifactId>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-service-messaging-config</artifactId>
</dependency>
<dependency>
<groupId>org.activiti.cloud</groupId>
<artifactId>activiti-cloud-services-audit-model</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.cloud.services.audit.jpa.controllers.config;
package org.activiti.cloud.services.audit.api.config;

import org.activiti.cloud.services.audit.jpa.controllers.AuditEventsAdminControllerImpl;
import org.activiti.cloud.services.audit.jpa.controllers.AuditEventsControllerImpl;
import org.activiti.cloud.services.audit.jpa.controllers.AuditEventsDeleteController;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Import;

@AutoConfiguration
@Import({ AuditEventsAdminControllerImpl.class, AuditEventsControllerImpl.class, AuditEventsDeleteController.class })
public class AuditJPAControllersAutoConfiguration {}
@Import(AuditConsumerChannelsConfiguration.class)
public class AuditConsumerChannelsAutoConfiguration {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.activiti.cloud.services.audit.api.converters.APIEventToEntityConverters;
import org.activiti.cloud.services.audit.api.converters.EventToEntityConverter;
import org.activiti.cloud.services.audit.api.streams.AuditConsumerChannelHandler;
import org.activiti.cloud.services.audit.api.streams.AuditConsumerChannels;
import org.activiti.cloud.services.audit.jpa.events.AuditEventEntity;
import org.activiti.cloud.services.audit.jpa.repository.EventsRepository;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.activiti.cloud.services.audit.api.config.AuditConsumerChannelsAutoConfiguration
org.activiti.cloud.services.audit.jpa.streams.config.AuditJPAStreamsAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.activiti.cloud.services.audit.jpa.streams;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.*;

import java.util.HashMap;
import java.util.UUID;
import org.activiti.api.process.model.events.ProcessRuntimeEvent;
Expand All @@ -28,12 +25,14 @@
import org.activiti.cloud.services.audit.jpa.events.AuditEventEntity;
import org.activiti.cloud.services.audit.jpa.events.ProcessCreatedAuditEventEntity;
import org.activiti.cloud.services.audit.jpa.repository.EventsRepository;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
Expand All @@ -54,13 +53,14 @@ public class AuditConsumerChannelHandlerImplTest {
@Test
public void receiveEventShouldStoreEntity() {
//given
CloudRuntimeEvent cloudRuntimeEvent = mock(CloudRuntimeEventImpl.class);
when(cloudRuntimeEvent.getEventType()).thenReturn(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED);
EventToEntityConverter converter = mock(EventToEntityConverter.class);
when(converters.getConverterByEventTypeName(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED.name()))
CloudRuntimeEvent cloudRuntimeEvent = Mockito.mock(CloudRuntimeEventImpl.class);
Mockito.when(cloudRuntimeEvent.getEventType()).thenReturn(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED);
EventToEntityConverter converter = Mockito.mock(EventToEntityConverter.class);
Mockito
.when(converters.getConverterByEventTypeName(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED.name()))
.thenReturn(converter);
ProcessCreatedAuditEventEntity entity = mock(ProcessCreatedAuditEventEntity.class);
when(converter.convertToEntity(cloudRuntimeEvent)).thenReturn(entity);
ProcessCreatedAuditEventEntity entity = Mockito.mock(ProcessCreatedAuditEventEntity.class);
Mockito.when(converter.convertToEntity(cloudRuntimeEvent)).thenReturn(entity);

CloudRuntimeEvent[] events = { cloudRuntimeEvent };

Expand All @@ -75,20 +75,21 @@ public void receiveEventShouldStoreEntity() {
);

//then
verify(eventsRepository).saveAll(argumentCaptor.capture());
assertThat(argumentCaptor.getValue()).containsOnly(entity);
Mockito.verify(eventsRepository).saveAll(argumentCaptor.capture());
Assertions.assertThat(argumentCaptor.getValue()).containsOnly(entity);
}

@Test
public void messageIdShouldBeSet() {
//given
CloudRuntimeEvent cloudRuntimeEvent = mock(CloudRuntimeEventImpl.class);
when(cloudRuntimeEvent.getEventType()).thenReturn(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED);
EventToEntityConverter converter = mock(EventToEntityConverter.class);
when(converters.getConverterByEventTypeName(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED.name()))
CloudRuntimeEvent cloudRuntimeEvent = Mockito.mock(CloudRuntimeEventImpl.class);
Mockito.when(cloudRuntimeEvent.getEventType()).thenReturn(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED);
EventToEntityConverter converter = Mockito.mock(EventToEntityConverter.class);
Mockito
.when(converters.getConverterByEventTypeName(ProcessRuntimeEvent.ProcessEvents.PROCESS_CREATED.name()))
.thenReturn(converter);
AuditEventEntity entity = mock(AuditEventEntity.class);
when(converter.convertToEntity(cloudRuntimeEvent)).thenReturn(entity);
AuditEventEntity entity = Mockito.mock(AuditEventEntity.class);
Mockito.when(converter.convertToEntity(cloudRuntimeEvent)).thenReturn(entity);

CloudRuntimeEvent[] events = { cloudRuntimeEvent };

Expand All @@ -99,6 +100,6 @@ public void messageIdShouldBeSet() {
handler.receiveCloudRuntimeEvent(headers, events);

//then
verify((CloudRuntimeEventImpl) cloudRuntimeEvent).setMessageId(headers.get("id").toString());
Mockito.verify((CloudRuntimeEventImpl) cloudRuntimeEvent).setMessageId(headers.get("id").toString());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.Set;
import org.activiti.cloud.services.audit.api.converters.APIEventToEntityConverters;
import org.activiti.cloud.services.audit.api.converters.EventToEntityConverter;
import org.activiti.cloud.services.audit.jpa.assembler.EventRepresentationModelAssembler;
import org.activiti.cloud.services.audit.jpa.converters.ActivityCancelledEventConverter;
import org.activiti.cloud.services.audit.jpa.converters.ActivityCompletedEventConverter;
import org.activiti.cloud.services.audit.jpa.converters.ActivityStartedEventConverter;
Expand Down Expand Up @@ -68,20 +67,13 @@
import org.activiti.cloud.services.audit.jpa.converters.VariableDeletedEventConverter;
import org.activiti.cloud.services.audit.jpa.converters.VariableUpdatedEventConverter;
import org.activiti.cloud.services.audit.jpa.repository.EventsRepository;
import org.activiti.cloud.services.audit.jpa.service.AuditEventsAdminService;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

@AutoConfiguration
public class AuditJPAAutoConfiguration {

@ConditionalOnMissingBean
@Bean
public EventRepresentationModelAssembler eventRepresentationModelAssembler() {
return new EventRepresentationModelAssembler();
}

@ConditionalOnMissingBean
@Bean
public EventContextInfoAppender eventContextInfoAppender() {
Expand Down Expand Up @@ -448,9 +440,4 @@ public ApplicationRollbackEventConverter applicationRollbackEventConverter(
) {
return new ApplicationRollbackEventConverter(eventContextInfoAppender);
}

@Bean
public AuditEventsAdminService auditEventsAdminService(EventsRepository eventsRepository) {
return new AuditEventsAdminService(eventsRepository);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.activiti.api.process.model.MessageSubscription;
import org.activiti.cloud.api.process.model.events.CloudMessageSubscriptionCancelledEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.MessageSubscriptionJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity
@DiscriminatorValue(value = MessageSubscriptionCancelledAuditEventEntity.MESSAGE_SUBSCRIPTION_CANCELLED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.activiti.api.runtime.model.impl.ProcessCandidateStarterGroupImpl;
import org.activiti.cloud.api.process.model.events.CloudProcessCandidateStarterGroupAddedEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.ProcessCandidateStarterGroupJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = ProcessCandidateStarterGroupAddedEventEntity.PROCESS_CANDIDATE_STARTER_GROUP_ADDED_EVENT)
@DiscriminatorValue(value = ProcessCandidateStarterGroupAddedEventEntity.PROCESS_CANDIDATE_STARTER_GROUP_ADDED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.activiti.api.runtime.model.impl.ProcessCandidateStarterUserImpl;
import org.activiti.cloud.api.process.model.events.CloudProcessCandidateStarterUserAddedEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.ProcessCandidateStarterUserJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = ProcessCandidateStarterUserAddedEventEntity.PROCESS_CANDIDATE_STARTER_USER_ADDED_EVENT)
@DiscriminatorValue(value = ProcessCandidateStarterUserAddedEventEntity.PROCESS_CANDIDATE_STARTER_USER_ADDED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.activiti.api.runtime.model.impl.ProcessCandidateStarterUserImpl;
import org.activiti.cloud.api.process.model.events.CloudProcessCandidateStarterUserRemovedEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.ProcessCandidateStarterUserJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = ProcessCandidateStarterUserRemovedEventEntity.PROCESS_CANDIDATE_STARTER_USER_REMOVED_EVENT)
@DiscriminatorValue(value = ProcessCandidateStarterUserRemovedEventEntity.PROCESS_CANDIDATE_STARTER_USER_REMOVED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.activiti.api.process.model.ProcessDefinition;
import org.activiti.cloud.api.process.model.events.CloudProcessDeployedEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.ProcessDefinitionJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = ProcessDeployedAuditEventEntity.PROCESS_DEPLOYED_EVENT)
@DiscriminatorValue(value = ProcessDeployedAuditEventEntity.PROCESS_DEPLOYED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.activiti.api.process.model.BPMNSequenceFlow;
import org.activiti.cloud.api.process.model.events.CloudSequenceFlowTakenEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.SequenceFlowJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = SequenceFlowAuditEventEntity.SEQUENCE_FLOW_TAKEN_EVENT)
@DiscriminatorValue(value = SequenceFlowAuditEventEntity.SEQUENCE_FLOW_TAKEN_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.activiti.api.task.model.impl.TaskCandidateGroupImpl;
import org.activiti.cloud.api.task.model.events.CloudTaskCandidateGroupAddedEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.TaskCandidateGroupJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = TaskCandidateGroupAddedEventEntity.TASK_CANDIDATE_GROUP_ADDED_EVENT)
@DiscriminatorValue(value = TaskCandidateGroupAddedEventEntity.TASK_CANDIDATE_GROUP_ADDED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.activiti.api.task.model.impl.TaskCandidateGroupImpl;
import org.activiti.cloud.api.task.model.events.CloudTaskCandidateGroupRemovedEvent;
import org.activiti.cloud.services.audit.jpa.converters.json.TaskCandidateGroupJpaJsonConverter;
import org.hibernate.annotations.DynamicInsert;

@Entity(name = TaskCandidateGroupRemovedEventEntity.TASK_CANDIDATE_GROUP_REMOVED_EVENT)
@DiscriminatorValue(value = TaskCandidateGroupRemovedEventEntity.TASK_CANDIDATE_GROUP_REMOVED_EVENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

@RepositoryRestResource(exported = false)
public interface EventsRepository<T extends AuditEventEntity>
extends PagingAndSortingRepository<T, Long>, JpaSpecificationExecutor<T>, CrudRepository<T, Long> {
Optional<T> findByEventId(String eventId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.activiti.cloud.services.audit.jpa.conf.AuditJPAAutoConfiguration
org.activiti.cloud.services.audit.jpa.repository.config.AuditJPARepositoryAutoConfiguration
Loading

0 comments on commit f03ef60

Please sign in to comment.