diff --git a/pom.xml b/pom.xml
index 8d91e9d..cf569e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -107,9 +107,9 @@
- 0.1.5
+ 0.1.6
19.0
- 4.2.3
+ 5.1.0
diff --git a/tef-impl/src/main/java/flipkart/tef/execution/FlowBuilder.java b/tef-impl/src/main/java/flipkart/tef/execution/FlowBuilder.java
index 13110a5..eb184e2 100644
--- a/tef-impl/src/main/java/flipkart/tef/execution/FlowBuilder.java
+++ b/tef-impl/src/main/java/flipkart/tef/execution/FlowBuilder.java
@@ -31,7 +31,7 @@
import flipkart.tef.capability.AdapterConflictRuntimeException;
import flipkart.tef.exceptions.UnableToResolveDataFromAdapterRuntimeException;
import flipkart.tef.flow.SimpleFlow;
-import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
+import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Field;
import java.util.ArrayList;
@@ -168,6 +168,9 @@ SimpleFlow build() {
for (Class extends IBizlogic> e : excludedBizlogics) {
bizlogics.remove(e);
bizlogicDependencyMap.removeAll(e);
+ if (reverseBizlogicDependencyMap.containsValue(e)){
+ reverseBizlogicDependencyMap.entries().removeIf(entry -> entry.getValue().equals(e));
+ }
}
int idx = 0;
@@ -293,13 +296,13 @@ private void populateDataAdapterMap(Class extends IBizlogic> bizlogic) {
@SuppressWarnings("unchecked")
private Class> getReturnTypeFromBizlogicUsingSunApi(Class extends DataAdapterBizlogic>> dataAdapterBizLogic, List>> classHierarchy) {
classHierarchy.add(dataAdapterBizLogic);
- if (dataAdapterBizLogic.getGenericSuperclass() instanceof ParameterizedTypeImpl) {
- ParameterizedTypeImpl genericSuperClass = (ParameterizedTypeImpl) dataAdapterBizLogic.getGenericSuperclass();
+ if (dataAdapterBizLogic.getGenericSuperclass() instanceof ParameterizedType) {
+ ParameterizedType genericSuperClass = (ParameterizedType) dataAdapterBizLogic.getGenericSuperclass();
if (genericSuperClass.getActualTypeArguments()[0] instanceof Class) {
return (Class>) genericSuperClass.getActualTypeArguments()[0];
- } else if (genericSuperClass.getActualTypeArguments()[0] instanceof ParameterizedTypeImpl) {
+ } else if (genericSuperClass.getActualTypeArguments()[0] instanceof ParameterizedType) {
// The type itself is parameterized
- return ((ParameterizedTypeImpl) genericSuperClass.getActualTypeArguments()[0]).getRawType();
+ return (Class>)((ParameterizedType) genericSuperClass.getActualTypeArguments()[0]).getRawType();
}
} else {
// This could be a case of a data adapter being a subclass of another
diff --git a/tef-impl/src/test/java/flipkart/tef/execution/FluentCapabilityBuilderTest.java b/tef-impl/src/test/java/flipkart/tef/execution/FluentCapabilityBuilderTest.java
index 46fc2aa..d1c034b 100644
--- a/tef-impl/src/test/java/flipkart/tef/execution/FluentCapabilityBuilderTest.java
+++ b/tef-impl/src/test/java/flipkart/tef/execution/FluentCapabilityBuilderTest.java
@@ -31,6 +31,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -163,6 +164,60 @@ public List> exclusions() {
}
+ @Test
+ public void testThatExclusionIsHonoredWhenControlDependencyIsExcluded() throws Exception {
+
+ CapabilityDefinition capabilityDefinition = new EmptyCapabilityDefinition() {
+ @Override
+ public String name() {
+ return "C1";
+ }
+
+ @Override
+ public List extends CapabilityDefinition> dependentCapabilities() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public List> validators() {
+ return ImmutableList.of(BasicValidationBizlogic1.class);
+ }
+
+ @Override
+ public List> enrichers() {
+ return ImmutableList.of(BasicEnrichmentBizlogic1.class);
+ }
+
+ @Override
+ public List> adapters() {
+ return ImmutableList.of(DataAdapterBizlogic1.class, DataAdapterBizlogic2.class);
+ }
+
+ @Override
+ public List> exclusions() {
+ return ImmutableList.of(DataAdapterBizlogic2.class);
+ }
+
+ @Override
+ public List bizlogicDependencies() {
+ List list = new ArrayList<>();
+ // Adding adapter 2 on adapter 1
+ list.add(new BizlogicDependency(DataAdapterBizlogic2.class, new Class[]{DataAdapterBizlogic1.class, DataAdapterBizlogic3.class}));
+ return list;
+ }
+ };
+
+ FluentCapabilityBuilder manager = new FluentCapabilityBuilder();
+ SimpleFlow flow = manager.withCapability(capabilityDefinition).dataflow();
+
+ assertNotNull(flow);
+ assertEquals(4, flow.getBizlogics().size());
+ assertEquals(flow.getBizlogics().get(0), BasicEnrichmentBizlogic1.class);
+ assertEquals(flow.getBizlogics().get(1), BasicValidationBizlogic1.class);
+ assertEquals(flow.getBizlogics().get(2), DataAdapterBizlogic1.class);
+ assertEquals(flow.getBizlogics().get(3), DataAdapterBizlogic3.class);
+ }
+
class BasicValidationBizlogic1 extends BasicValidationBizlogic {
@Override
@@ -206,4 +261,20 @@ public Object adapt(TefContext tefContext) {
return null;
}
}
+
+ class DataAdapterBizlogic2 extends DataAdapterBizlogic