Search in sources :

Example 1 with EventExecution

use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.

the class AbstractProtoMapper method fromProto.

public EventExecution fromProto(EventExecutionPb.EventExecution from) {
    EventExecution to = new EventExecution();
    to.setId(from.getId());
    to.setMessageId(from.getMessageId());
    to.setName(from.getName());
    to.setEvent(from.getEvent());
    to.setCreated(from.getCreated());
    to.setStatus(fromProto(from.getStatus()));
    to.setAction(fromProto(from.getAction()));
    Map<String, Object> outputMap = new HashMap<String, Object>();
    for (Map.Entry<String, Value> pair : from.getOutputMap().entrySet()) {
        outputMap.put(pair.getKey(), fromProto(pair.getValue()));
    }
    to.setOutput(outputMap);
    return to;
}
Also used : HashMap(java.util.HashMap) EventExecution(com.netflix.conductor.common.metadata.events.EventExecution) Value(com.google.protobuf.Value) Object(java.lang.Object) String(java.lang.String) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with EventExecution

use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldAddEventExecution.

@Test
public void shouldAddEventExecution() {
    String event = "event";
    EventExecution execution1 = createEventExecution(event);
    EventExecution execution2 = createEventExecution(event);
    indexDAO.addEventExecution(execution1);
    indexDAO.addEventExecution(execution2);
    List<EventExecution> indexedExecutions = tryFindResults(() -> indexDAO.getEventExecutions(event), 2);
    assertEquals(2, indexedExecutions.size());
    assertTrue("Not all event executions was indexed", indexedExecutions.containsAll(Arrays.asList(execution1, execution2)));
}
Also used : EventExecution(com.netflix.conductor.common.metadata.events.EventExecution) Test(org.junit.Test)

Example 3 with EventExecution

use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldAsyncAddEventExecution.

@Test
public void shouldAsyncAddEventExecution() throws Exception {
    String event = "event2";
    EventExecution execution1 = createEventExecution(event);
    EventExecution execution2 = createEventExecution(event);
    indexDAO.asyncAddEventExecution(execution1).get();
    indexDAO.asyncAddEventExecution(execution2).get();
    List<EventExecution> indexedExecutions = tryFindResults(() -> indexDAO.getEventExecutions(event), 2);
    assertEquals(2, indexedExecutions.size());
    assertTrue("Not all event executions was indexed", indexedExecutions.containsAll(Arrays.asList(execution1, execution2)));
}
Also used : EventExecution(com.netflix.conductor.common.metadata.events.EventExecution) Test(org.junit.Test)

Example 4 with EventExecution

use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.

the class ElasticSearchRestDAOV5 method mapEventExecutionsResponse.

private List<EventExecution> mapEventExecutionsResponse(SearchResponse response) throws IOException {
    SearchHit[] hits = response.getHits().getHits();
    List<EventExecution> executions = new ArrayList<>(hits.length);
    for (SearchHit hit : hits) {
        String source = hit.getSourceAsString();
        EventExecution tel = objectMapper.readValue(source, EventExecution.class);
        executions.add(tel);
    }
    return executions;
}
Also used : SearchHit(org.elasticsearch.search.SearchHit) EventExecution(com.netflix.conductor.common.metadata.events.EventExecution) ArrayList(java.util.ArrayList)

Example 5 with EventExecution

use of com.netflix.conductor.common.metadata.events.EventExecution in project conductor by Netflix.

the class ElasticSearchDAOV6 method mapEventExecutionsResponse.

private List<EventExecution> mapEventExecutionsResponse(SearchResponse response) throws IOException {
    SearchHit[] hits = response.getHits().getHits();
    List<EventExecution> executions = new ArrayList<>(hits.length);
    for (SearchHit hit : hits) {
        String source = hit.getSourceAsString();
        EventExecution tel = objectMapper.readValue(source, EventExecution.class);
        executions.add(tel);
    }
    return executions;
}
Also used : SearchHit(org.elasticsearch.search.SearchHit) EventExecution(com.netflix.conductor.common.metadata.events.EventExecution) ArrayList(java.util.ArrayList)

Aggregations

EventExecution (com.netflix.conductor.common.metadata.events.EventExecution)28 Test (org.junit.Test)13 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)7 ArrayList (java.util.ArrayList)7 SearchHit (org.elasticsearch.search.SearchHit)7 HashMap (java.util.HashMap)6 Map (java.util.Map)6 Action (com.netflix.conductor.common.metadata.events.EventHandler.Action)5 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 EventHandler (com.netflix.conductor.common.metadata.events.EventHandler)4 Message (com.netflix.conductor.core.events.queue.Message)4 ObservableQueue (com.netflix.conductor.core.events.queue.ObservableQueue)4 JsonUtils (com.netflix.conductor.core.utils.JsonUtils)4 ExecutionService (com.netflix.conductor.service.ExecutionService)4 MetadataService (com.netflix.conductor.service.MetadataService)4 Collections (java.util.Collections)4 TimeUnit (java.util.concurrent.TimeUnit)4 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)3 Type (com.netflix.conductor.common.metadata.events.EventHandler.Action.Type)3 StartWorkflow (com.netflix.conductor.common.metadata.events.EventHandler.StartWorkflow)3