Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Fixed local server start issues. Updated docs.
Browse files Browse the repository at this point in the history
Updates to BaseDynoDAOTest per code review.
  • Loading branch information
kishorebanala committed Jun 12, 2018
1 parent 8c952e4 commit 4866e0c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 18 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ Conductor is an _orchestration_ engine that runs in the cloud.
## Get Conductor
Binaries are available from Maven Central and jcenter.

|Group|Artifact|Latest Stable Version|
|-----------|---------------|---------------------|
|com.netflix.conductor|conductor-*|1.5.+|

Below are the various artifacts published:

|Artifact|Description|
Expand Down Expand Up @@ -73,7 +69,7 @@ Conductor is maintained by Media Workflow Infrastructure team at Netflix. Use g

## LICENSE

Copyright (c) 2016 Netflix, Inc.
Copyright (c) 2018 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/license.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2016 Netflix, Inc.
Copyright 2018 Netflix, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public Client getClient(Configuration config) throws Exception {
log.warn("workflow.elasticsearch.url is not set. Indexing will remain DISABLED.");
}

Settings settings = Settings.builder().put("client.transport.ignore_cluster_name",true).put("client.transport.sniff", true).build();
Settings settings = Settings.builder()
.put("client.transport.ignore_cluster_name",true)
.put("client.transport.sniff", true)
.build();

TransportClient tc = new PreBuiltTransportClient(settings);
String[] hosts = clusterAddress.split(",");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.conductor.core.config.Configuration;
import com.netflix.conductor.metrics.Monitors;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -49,23 +49,21 @@ protected BaseDynoDAO(DynoProxy dynoClient, ObjectMapper objectMapper, Configura

String nsKey(String... nsValues) {
String rootNamespace = config.getProperty("workflow.namespace.prefix", null);
StringBuilder namespacedKey = new StringBuilder(rootNamespace).append(NAMESPACE_SEP);
StringBuilder namespacedKey = new StringBuilder();
if (StringUtils.isNotBlank(rootNamespace)) {
namespacedKey.append(rootNamespace).append(NAMESPACE_SEP);
}
String stack = config.getStack();
if (stack != null && !stack.isEmpty()) {
if (StringUtils.isNotBlank(stack)) {
namespacedKey.append(stack).append(NAMESPACE_SEP);
}
if (domain != null && !domain.isEmpty()) {
if (StringUtils.isNotBlank(domain)) {
namespacedKey.append(domain).append(NAMESPACE_SEP);
}
for (int i = 0; i < nsValues.length; i++) {
namespacedKey.append(nsValues[i]);
if (i < nsValues.length - 1) {
namespacedKey.append(NAMESPACE_SEP);
}
namespacedKey.append(nsValues[i]).append(NAMESPACE_SEP);
}
//QUES cpewf.devint.test.WORKFLOW.UUID isSystemTask the stack in here same as the NETFLIX_STACK ? and what about the domain?
//Looking at the data saved in dynomite cpewf.WORKFLOW.UUID
return namespacedKey.toString();
return StringUtils.removeEnd(namespacedKey.toString(), NAMESPACE_SEP);
}

public DynoProxy getDyno() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.netflix.conductor.dao.dynomite;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.conductor.core.config.Configuration;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

import static org.junit.Assert.*;

@RunWith(MockitoJUnitRunner.class)
public class BaseDynoDAOTest {

@Mock
private DynoProxy dynoClient;

@Mock
private ObjectMapper objectMapper;

@Mock
private Configuration config;

private BaseDynoDAO baseDynoDAO;

@Before
public void setUp() {
this.baseDynoDAO = new BaseDynoDAO(dynoClient, objectMapper, config);
}

@Test
public void testNsKey() {
assertEquals("", baseDynoDAO.nsKey());

String[] keys = {"key1", "key2"};
assertEquals("key1.key2", baseDynoDAO.nsKey(keys));

Mockito.when(config.getProperty("workflow.namespace.prefix", null)).thenReturn("test");
assertEquals("test", baseDynoDAO.nsKey());

assertEquals("test.key1.key2", baseDynoDAO.nsKey(keys));

Mockito.when(config.getStack()).thenReturn("stack");
assertEquals("test.stack.key1.key2", baseDynoDAO.nsKey(keys));
}
}

0 comments on commit 4866e0c

Please sign in to comment.