Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#92 Provide task metadata to event consumer. Expose in debug script. #104

Merged
merged 41 commits into from
Mar 10, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8538946
#92 Provide task metadata to event consumer. Expose in debug script.
Feb 14, 2020
0f86541
#92 Provide alternative implementation of exposing Task Graph metadata.
Feb 21, 2020
ea5aa91
#92 Fix regression in Fragment Processing. Make consumer more null-safe.
Feb 22, 2020
93ef44f
#92 Rebase with master.
tomaszmichalak Feb 24, 2020
062f050
#92 Rebase with master.
tomaszmichalak Feb 24, 2020
5688495
#92 Unit tests for MetadataConverter.
Feb 24, 2020
b00a7c6
#92 Wrap single invocation log with JsonArray in MetadataConverter.
Feb 24, 2020
9b991a1
#92 remove factory from node metadata
tomaszmichalak Feb 25, 2020
d546fc2
#92 Introduce factory methods for single / composite node matadata.
tomaszmichalak Feb 25, 2020
7ef2a4f
#92 Unit test for EventLogConverter. Handle NodeStatus.UNPROCESSED.
Feb 25, 2020
afd1ee9
#92 Unit test for EventLogConverter. Handle NodeStatus.UNPROCESSED.
Feb 25, 2020
01cc5ac
#92 Adding OperationMetadata model.
tomaszmichalak Feb 25, 2020
270590b
Merge branch 'feature/expose-task-metadata' of github.com:Knotx/knotx…
tomaszmichalak Feb 25, 2020
c46134a
#92 Unique nodeId for missing nodes.
Feb 26, 2020
1165e8b
#92 Unify log and graph debug data into single data structure.
Feb 26, 2020
5c40425
#92 Add label field to NodeMetadata. Action alias is the default label.
Feb 26, 2020
743d63a
#92 Improve action factory tests with TODO left.
tomaszmichalak Mar 2, 2020
d413e22
#92 Improve subtasks factory tests with TODO left.
tomaszmichalak Mar 2, 2020
5845fbb
#92 Added javadocs, fixed default task factory method reference.
tomaszmichalak Mar 2, 2020
dbae417
#92 default task factory test cleanup.
tomaszmichalak Mar 2, 2020
d02dcb4
#92 Fix subtasks node factory tests so they don't crash
Voycawojka Mar 3, 2020
50be8c9
#92 Fix tests, adjust log statuses
Voycawojka Mar 3, 2020
771523e
#92 node factory tests.
tomaszmichalak Mar 4, 2020
8bb7ac0
#92 composite node metadata test.
tomaszmichalak Mar 4, 2020
bd72cdc
#92 javadoc fix.
tomaszmichalak Mar 4, 2020
05c4691
#92 refactor event log converter logic
Voycawojka Mar 4, 2020
bd14d71
Merge branch 'feature/expose-task-metadata' of github.com:Knotx/knotx…
Voycawojka Mar 4, 2020
5ec77b3
#92 Introduce node execution data class.
tomaszmichalak Mar 5, 2020
d6bda62
#92 Adjust metadata converter
Voycawojka Mar 5, 2020
55cc31a
Merge branch 'feature/expose-task-metadata' of github.com:Knotx/knotx…
Mar 5, 2020
489aaa8
Refactor LoggedNodeStatus enum
Voycawojka Mar 5, 2020
5894d16
Refactor EventLogConverter
Voycawojka Mar 5, 2020
41b5e79
#92 Adjust json structure to match frontend contract
Voycawojka Mar 5, 2020
0554841
#92 Cover LoggedNodeStatus with tests
Voycawojka Mar 5, 2020
40121bd
#92 Fix CodeFactor issues
Voycawojka Mar 6, 2020
ab3f944
#92 Refactor caching mechanism in ActionProvider
Voycawojka Mar 6, 2020
a59c8e8
#92 Revert changes in Action provider.
Voycawojka Mar 6, 2020
3fffeeb
Merge branch 'feature/expose-task-metadata' of github.com:Knotx/knotx…
tomaszmichalak Mar 6, 2020
5e45ad6
#92 remove redundant dependencies, added license headers.
tomaszmichalak Mar 9, 2020
8122cdd
#92 add response json models (#116)
tomaszmichalak Mar 10, 2020
e945ff6
#92 CR fixes.
tomaszmichalak Mar 10, 2020
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
1 change: 1 addition & 0 deletions handler/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {
implementation(group = "org.apache.commons", name = "commons-lang3")
implementation(group = "com.google.guava", name = "guava")

testImplementation("io.knotx:knotx-junit5:${project.version}")
testImplementation(group = "org.mockito", name = "mockito-core")
testImplementation(group = "org.mockito", name = "mockito-junit-jupiter")
testImplementation(group = "io.vertx", name = "vertx-web-client")
Expand Down
28 changes: 28 additions & 0 deletions handler/core/docs/asciidoc/dataobjects.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ The factory name.
+++
|===

[[FragmentExecutionLog]]
== FragmentExecutionLog


[cols=">25%,25%,50%"]
[frame="topbot"]
|===
^|Name | Type ^| Description
|[[finishTime]]`@finishTime`|`Number (long)`|-
|[[fragmentId]]`@fragmentId`|`String`|-
|[[graph]]`@graph`|`Json object`|-
|[[startTime]]`@startTime`|`Number (long)`|-
|[[status]]`@status`|`link:enums.html#Status[Status]`|-
|[[type]]`@type`|`String`|-
|===

[[FragmentsHandlerOptions]]
== FragmentsHandlerOptions

Expand Down Expand Up @@ -208,6 +224,18 @@ Sets node factory name
+++
|===

[[OperationMetadata]]
== OperationMetadata


[cols=">25%,25%,50%"]
[frame="topbot"]
|===
^|Name | Type ^| Description
|[[data]]`@data`|`Json object`|-
|[[factory]]`@factory`|`String`|-
|===

[[SubtasksNodeConfig]]
== SubtasksNodeConfig

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2019 Knot.x Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.knotx.fragments.engine;

import io.knotx.fragments.engine.api.node.NodeType;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class NodeMetadata {

private String nodeId;
private String label;
private NodeType type;
private Map<String, String> transitions;
private List<String> nestedNodes;
private OperationMetadata operation;

public static NodeMetadata single(String nodeId, String label, Map<String, String> transitions,
OperationMetadata operation) {
return new NodeMetadata(nodeId, label, NodeType.SINGLE, transitions, Collections.emptyList(),
operation);
}

public static NodeMetadata composite(String nodeId, String label, Map<String, String> transitions,
List<String> nestedNodes, OperationMetadata operation) {
return new NodeMetadata(nodeId, label, NodeType.COMPOSITE, transitions, nestedNodes, operation);
}

private NodeMetadata(String nodeId, String label, NodeType type, Map<String, String> transitions,
List<String> nestedNodes, OperationMetadata operation) {
this.nodeId = nodeId;
this.label = label;
this.type = type;
this.transitions = transitions;
this.nestedNodes = nestedNodes;
this.operation = operation;
}

public String getNodeId() {
return nodeId;
}

public String getLabel() {
return label;
}

public NodeType getType() {
return type;
}

/**
* @return transition name to node id map
*/
public Map<String, String> getTransitions() {
return transitions;
}

/**
* @return list of composite nodes identifiers
*/
public List<String> getNestedNodes() {
return nestedNodes;
}

public OperationMetadata getOperation() {
return operation;
}

@Override
public String toString() {
return "NodeMetadata{" +
"nodeId='" + nodeId + '\'' +
", label='" + label + '\'' +
", type=" + type +
", transitions=" + transitions +
", nestedNodes=" + nestedNodes +
", operation=" + operation +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2019 Knot.x Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.knotx.fragments.engine;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;

@DataObject(generateConverter = true)
public class OperationMetadata {

private String factory;

private JsonObject data;

public OperationMetadata() {
// empty
}

public OperationMetadata(JsonObject obj) {
OperationMetadataConverter.fromJson(obj, this);
}

public JsonObject toJson() {
JsonObject json = new JsonObject();
OperationMetadataConverter.toJson(this, json);
return json;
}

public String getFactory() {
return factory;
}

public OperationMetadata setFactory(String factory) {
this.factory = factory;
return this;
}

public JsonObject getData() {
return data;
}

public OperationMetadata setData(JsonObject data) {
this.data = data;
return this;
}

@Override
public String toString() {
return "OperationMetadata{" +
"factory='" + factory + '\'' +
", data=" + data +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (C) 2019 Knot.x Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.knotx.fragments.engine;

import java.util.HashMap;
import java.util.Map;

public class TaskMetadata {

private String taskName;
private String rootNodeId;
private Map<String, NodeMetadata> nodesMetadata;

private TaskMetadata(String taskName, String rootNodeId,
Map<String, NodeMetadata> nodesMetadata) {
this.taskName = taskName;
this.rootNodeId = rootNodeId;
this.nodesMetadata = nodesMetadata;
}

public static TaskMetadata create(String taskName, String rootNodeId,
Map<String, NodeMetadata> nodesMetadata) {
return new TaskMetadata(taskName, rootNodeId, nodesMetadata);
}

public static TaskMetadata noMetadata(String taskName, String rootNodeId) {
return new TaskMetadata(taskName, rootNodeId, new HashMap<>());
}

public static TaskMetadata notDefined() {
return noMetadata("_NOT_DEFINED", "");
}

public String getTaskName() {
return taskName;
}

public String getRootNodeId() {
return rootNodeId;
}

public Map<String, NodeMetadata> getNodesMetadata() {
return nodesMetadata;
}

@Override
public String toString() {
return "TaskMetadata{" +
"taskName='" + taskName + '\'' +
", rootNodeId='" + rootNodeId + '\'' +
", nodesMetadata=" + nodesMetadata +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 Knot.x Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.knotx.fragments.engine;

import io.knotx.fragments.engine.api.Task;

public class TaskWithMetadata {

private final Task task;
private final TaskMetadata taskMetadata;

public TaskWithMetadata(Task task, TaskMetadata taskMetadata) {
this.task = task;
this.taskMetadata = taskMetadata;
}

public Task getTask() {
return task;
}

public TaskMetadata getTaskMetadata() {
return taskMetadata;
}

}
Loading