Skip to content

Commit

Permalink
[Fix #3721] Adding addons
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Oct 23, 2024
1 parent 50dcd6c commit 61cd8e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ static void populateCloudEvent(ProcessInstanceDataEvent<?> event, ProcessInstanc
event.setKogitoRootProcessInstanceId(info.getRootInstanceId());
event.setKogitoIdentity(info.getIdentity());
event.setSource(info.getSource());
event.setKogitoAddons(info.getAddons());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class ProcessInstanceDataEventExtensionRecord implements KogitoMarshallEventSupport {

// addons, referenceId, and starFromNode are not used by process instance events
// referenceId and startFromNode are not used by process instance events
private String id;
private String instanceId;
private String version;
Expand All @@ -44,6 +44,7 @@ class ProcessInstanceDataEventExtensionRecord implements KogitoMarshallEventSupp
private String identity;
private URI source;
private OffsetDateTime time;
private String addons;
private transient int ordinal;

public ProcessInstanceDataEventExtensionRecord() {
Expand All @@ -63,6 +64,7 @@ public ProcessInstanceDataEventExtensionRecord(int ordinal, ProcessInstanceDataE
identity = dataEvent.getKogitoIdentity();
time = dataEvent.getTime();
source = dataEvent.getSource();
addons = dataEvent.getKogitoAddons();
}

public int getOrdinal() {
Expand Down Expand Up @@ -117,6 +119,10 @@ public URI getSource() {
return source;
}

public String getAddons() {
return addons;
}

@Override
public void writeEvent(DataOutput out) throws IOException {
out.writeUTF(id);
Expand All @@ -131,6 +137,7 @@ public void writeEvent(DataOutput out) throws IOException {
writeUTF(out, identity);
writeTime(out, time);
out.writeUTF(source.toString());
writeUTF(out, addons);
}

@Override
Expand All @@ -147,5 +154,6 @@ public void readEvent(DataInput in) throws IOException {
identity = readUTF(in);
time = readTime(in);
source = URI.create(in.readUTF());
addons = readUTF(in);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ProcessEventsTest {
CloudEventExtensionConstants.PROCESS_ROOT_PROCESS_INSTANCE_ID,
CloudEventExtensionConstants.PROCESS_ID,
CloudEventExtensionConstants.PROCESS_ROOT_PROCESS_ID,
CloudEventExtensionConstants.ADDONS,
CloudEventExtensionConstants.PROCESS_INSTANCE_VERSION,
CloudEventExtensionConstants.PROCESS_PARENT_PROCESS_INSTANCE_ID,
CloudEventExtensionConstants.PROCESS_INSTANCE_STATE,
Expand Down Expand Up @@ -86,6 +87,7 @@ class ProcessEventsTest {
private static final String PROCESS_INSTANCE_STATE = "PROCESS_INSTANCE_STATE";
private static final String BUSINESS_KEY = "BUSINESS_KEY";
private static final String PROCESS_TYPE = "PROCESS_TYPE";
private static final String ADDONS = "ADDONS";
private static final int PROCESS_STATE = 1;
private static final String NODE_CONTAINER_ID = "323";
private static final String NODE_CONTAINER_INSTANCEID = "323-3232-3232";
Expand Down Expand Up @@ -350,6 +352,7 @@ private static void setBaseEventValues(AbstractDataEvent<?> event, String eventT
event.setKogitoProcessInstanceState(PROCESS_INSTANCE_STATE);
event.setKogitoBusinessKey(BUSINESS_KEY);
event.setKogitoProcessType(PROCESS_TYPE);
event.setKogitoAddons(ADDONS);
event.setKogitoIdentity(SUBJECT);
}

Expand All @@ -376,6 +379,7 @@ private static void assertBaseEventValues(AbstractDataEvent<?> deserializedEvent
assertThat(deserializedEvent.getKogitoBusinessKey()).isEqualTo(BUSINESS_KEY);
assertThat(deserializedEvent.getKogitoProcessType()).isEqualTo(PROCESS_TYPE);
assertThat(deserializedEvent.getKogitoIdentity()).isEqualTo(SUBJECT);
assertThat(deserializedEvent.getKogitoAddons()).isEqualTo(ADDONS);
}

private static void assertExtensionNames(AbstractDataEvent<?> event, Set<String> baseNames, String... names) {
Expand Down

0 comments on commit 61cd8e2

Please sign in to comment.