Commit d9d487bc by apoorvnaik Committed by Suma Shivaprasad

ATLAS-1357: NPE Fix for search filter changes & callAPI related fixes

parent 28410df5
...@@ -73,7 +73,13 @@ public class SearchFilter { ...@@ -73,7 +73,13 @@ public class SearchFilter {
} }
public String getParam(String name) { public String getParam(String name) {
return getParams(name).get(0); String ret = null;
if (name != null && params != null) {
ret = params.getFirst(name);
}
return ret;
} }
public List<String> getParams(String name) { public List<String> getParams(String name) {
......
...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1358 NPE Fix for search filter changes & callAPI related fixes (apoorvnaik via sumasai)
ATLAS-1357: Fixes for test failures from ATLAS-1307 (apoorvnaik via sumasai) ATLAS-1357: Fixes for test failures from ATLAS-1307 (apoorvnaik via sumasai)
ATLAS-1307: Integration test calls routing via the Client. (apoorvnaik via sumasai) ATLAS-1307: Integration test calls routing via the Client. (apoorvnaik via sumasai)
ATLAS-1355: Fix for bad error translation from V2 API (apoorvnaik via sumasai) ATLAS-1355: Fix for bad error translation from V2 API (apoorvnaik via sumasai)
......
...@@ -429,10 +429,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT { ...@@ -429,10 +429,10 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
@Test(expectedExceptions = AtlasServiceException.class) @Test(expectedExceptions = AtlasServiceException.class)
public void testGetEntityListForBadEntityType() throws Exception { public void testGetEntityListForBadEntityType() throws Exception {
Map<String, String> queryParams = new HashMap<>(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.put("type", "blah"); queryParams.add("type", "blah");
JSONObject response = serviceClient.callAPIWithBody(AtlasClient.API.GET_ENTITY, queryParams); JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.GET_ENTITY, queryParams);
assertNotNull(response); assertNotNull(response);
Assert.assertNotNull(response.get(AtlasClient.ERROR)); Assert.assertNotNull(response.get(AtlasClient.ERROR));
Assert.assertNotNull(response.get(AtlasClient.STACKTRACE)); Assert.assertNotNull(response.get(AtlasClient.STACKTRACE));
......
...@@ -20,6 +20,7 @@ package org.apache.atlas.web.resources; ...@@ -20,6 +20,7 @@ package org.apache.atlas.web.resources;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasClient;
import org.apache.atlas.AtlasServiceException; import org.apache.atlas.AtlasServiceException;
import org.apache.atlas.typesystem.TypesDef; import org.apache.atlas.typesystem.TypesDef;
...@@ -41,12 +42,11 @@ import org.testng.annotations.AfterClass; ...@@ -41,12 +42,11 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef; import static org.apache.atlas.typesystem.types.utils.TypesUtil.createOptionalAttrDef;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
...@@ -187,10 +187,10 @@ public class TypesJerseyResourceIT extends BaseResourceIT { ...@@ -187,10 +187,10 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
public void testGetTraitNames() throws Exception { public void testGetTraitNames() throws Exception {
String[] traitsAdded = addTraits(); String[] traitsAdded = addTraits();
Map<String, String> queryParams = new HashMap<>(); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
queryParams.put("type", DataTypes.TypeCategory.TRAIT.name()); queryParams.add("type", DataTypes.TypeCategory.TRAIT.name());
JSONObject response = serviceClient.callAPIWithBody(AtlasClient.API.LIST_TYPES, queryParams); JSONObject response = serviceClient.callAPIWithQueryParams(AtlasClient.API.LIST_TYPES, queryParams);
Assert.assertNotNull(response); Assert.assertNotNull(response);
Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID)); Assert.assertNotNull(response.get(AtlasClient.REQUEST_ID));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment