You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2019/03/24 16:31:22 UTC

[atlas] branch branch-1.0 updated (3cfe5dc -> 40dc26e)

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a change to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git.


    from 3cfe5dc  ATLAS-3093 UI : Fix to add missing tooltips to lineage page.
     new 2360a22  ATLAS-3064: Resolving repo URL and Maven version.
     new 40dc26e  ATLAS-3001: fixed serialization error in AtlasClientV2.updateClassifications()

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/atlas/AtlasClientV2.java  |   4 +-
 .../java/org.apache.atlas/AtlasClientV2Test.java   | 129 +++++++++++++++++++++
 dev-support/atlas-docker/Dockerfile                |   4 +-
 3 files changed, 133 insertions(+), 4 deletions(-)
 create mode 100644 client/client-v2/src/test/java/org.apache.atlas/AtlasClientV2Test.java


[atlas] 01/02: ATLAS-3064: Resolving repo URL and Maven version.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 2360a22683ba9c83b8b8cca162349dc142209e75
Author: jzonthemtn <je...@mtnfog.com>
AuthorDate: Mon Mar 4 09:09:20 2019 -0500

    ATLAS-3064: Resolving repo URL and Maven version.
    
    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit 5b9430daa7463a6328ba7a0175c8e15b5378131f)
---
 dev-support/atlas-docker/Dockerfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dev-support/atlas-docker/Dockerfile b/dev-support/atlas-docker/Dockerfile
index 4805135..89d9502 100644
--- a/dev-support/atlas-docker/Dockerfile
+++ b/dev-support/atlas-docker/Dockerfile
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM ubuntu:16.04
+FROM ubuntu:18.04
 
 # Install Git, which is missing from the Ubuntu base images.
 RUN apt-get update && apt-get install -y git python
@@ -35,7 +35,7 @@ ENV PATH /usr/java/bin:/usr/local/apache-maven/bin:/usr/local/sbin:/usr/local/bi
 WORKDIR /root
 
 # Pull down Atlas and build it into /root/atlas-bin.
-RUN git clone http://git.apache.org/atlas.git -b master
+RUN git clone https://github.com/apache/atlas.git -b master
 
 # Remove -DskipTests if unit tests are to be included
 RUN mvn clean install -DskipTests -Pdist,embedded-hbase-solr -f ./atlas/pom.xml


[atlas] 02/02: ATLAS-3001: fixed serialization error in AtlasClientV2.updateClassifications()

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 40dc26e55b535b61026fee650c1c6e72ef1c2bf5
Author: chaitali <ch...@freestoneinfotech.com>
AuthorDate: Fri Mar 22 18:33:10 2019 +0530

    ATLAS-3001: fixed serialization error in AtlasClientV2.updateClassifications()
    
    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit af1719a3472d1d436d0fc685fe9f88d8a754ef94)
---
 .../main/java/org/apache/atlas/AtlasClientV2.java  |   4 +-
 .../java/org.apache.atlas/AtlasClientV2Test.java   | 129 +++++++++++++++++++++
 2 files changed, 131 insertions(+), 2 deletions(-)

diff --git a/client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java b/client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java
index 33466e5..f81a7d5 100644
--- a/client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java
+++ b/client/client-v2/src/main/java/org/apache/atlas/AtlasClientV2.java
@@ -326,7 +326,7 @@ public class AtlasClientV2 extends AtlasBaseClient {
     }
 
     public void updateClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
-        callAPI(formatPathParameters(API_V2.UPDATE_CLASSIFICATIONS, guid), AtlasClassifications.class, classifications);
+        callAPI(formatPathParameters(API_V2.UPDATE_CLASSIFICATIONS, guid), (Class<?>)null, classifications);
     }
 
     public void deleteClassifications(String guid, List<AtlasClassification> classifications) throws AtlasServiceException {
@@ -486,7 +486,7 @@ public class AtlasClientV2 extends AtlasBaseClient {
         public static final API_V2 DELETE_ENTITIES_BY_GUIDS    = new API_V2(ENTITY_BULK_API, HttpMethod.DELETE, Response.Status.OK);
         public static final API_V2 GET_CLASSIFICATIONS         = new API_V2(ENTITY_API + "guid/%s/classifications", HttpMethod.GET, Response.Status.OK);
         public static final API_V2 ADD_CLASSIFICATIONS         = new API_V2(ENTITY_API + "guid/%s/classifications", HttpMethod.POST, Response.Status.NO_CONTENT);
-        public static final API_V2 UPDATE_CLASSIFICATIONS      = new API_V2(ENTITY_API + "guid/%s/classifications", HttpMethod.PUT, Response.Status.OK);
+        public static final API_V2 UPDATE_CLASSIFICATIONS      = new API_V2(ENTITY_API + "guid/%s/classifications", HttpMethod.PUT, Response.Status.NO_CONTENT);
         public static final API_V2 DELETE_CLASSIFICATION       = new API_V2(ENTITY_API + "guid/%s/classification/%s", HttpMethod.DELETE, Response.Status.NO_CONTENT);
         public static final API_V2 LINEAGE_INFO                = new API_V2(LINEAGE_URI, HttpMethod.GET, Response.Status.OK);
         public static final API_V2 DSL_SEARCH                  = new API_V2(DSL_URI, HttpMethod.GET, Response.Status.OK);
diff --git a/client/client-v2/src/test/java/org.apache.atlas/AtlasClientV2Test.java b/client/client-v2/src/test/java/org.apache.atlas/AtlasClientV2Test.java
new file mode 100644
index 0000000..83a3391
--- /dev/null
+++ b/client/client-v2/src/test/java/org.apache.atlas/AtlasClientV2Test.java
@@ -0,0 +1,129 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.atlas;
+
+
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.commons.configuration.Configuration;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.Collections;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+
+public class AtlasClientV2Test {
+    @Mock
+    private WebResource service;
+
+    @Mock
+    private WebResource.Builder resourceBuilderMock;
+
+    @Mock
+    private Configuration configuration;
+
+
+    @BeforeMethod
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    private WebResource.Builder setupBuilder(AtlasClientV2.API_V2 api, WebResource webResource) {
+        when(webResource.path(api.getPath())).thenReturn(service);
+        when(webResource.path(api.getNormalizedPath())).thenReturn(service);
+        return getBuilder(service);
+    }
+
+
+    private WebResource.Builder getBuilder(WebResource resourceObject) {
+        when(resourceObject.getRequestBuilder()).thenReturn(resourceBuilderMock);
+        when(resourceObject.path(anyString())).thenReturn(resourceObject);
+        when(resourceBuilderMock.accept(AtlasBaseClient.JSON_MEDIA_TYPE)).thenReturn(resourceBuilderMock);
+        when(resourceBuilderMock.accept(MediaType.APPLICATION_JSON)).thenReturn(resourceBuilderMock);
+        when(resourceBuilderMock.type(AtlasBaseClient.JSON_MEDIA_TYPE)).thenReturn(resourceBuilderMock);
+        when(resourceBuilderMock.type(MediaType.MULTIPART_FORM_DATA)).thenReturn(resourceBuilderMock);
+        return resourceBuilderMock;
+    }
+
+
+    @Test
+    public void updateClassificationsShouldNotThrowExceptionIfResponseIs204() {
+
+        AtlasClientV2 atlasClient = new AtlasClientV2(service, configuration);
+
+
+        AtlasClassification atlasClassification = new AtlasClassification("Testdb");
+        atlasClassification.setEntityGuid("abb672b1-e4bd-402d-a98f-73cd8f775e2a");
+        WebResource.Builder builder = setupBuilder(AtlasClientV2.API_V2.UPDATE_CLASSIFICATIONS, service);
+
+
+        ClientResponse response = mock(ClientResponse.class);
+        when(response.getStatus()).thenReturn(Response.Status.NO_CONTENT.getStatusCode());
+
+
+        when(builder.method(anyString(), Matchers.<Class>any(), anyString())).thenReturn(response);
+
+        try {
+            atlasClient.updateClassifications("abb672b1-e4bd-402d-a98f-73cd8f775e2a", Collections.singletonList(atlasClassification));
+
+        } catch (AtlasServiceException e) {
+            Assert.fail("Failed with Exception");
+        }
+
+    }
+
+
+    @Test
+    public void updateClassificationsShouldThrowExceptionIfResponseIsNot204() {
+
+        AtlasClientV2 atlasClient = new AtlasClientV2(service, configuration);
+
+
+        AtlasClassification atlasClassification = new AtlasClassification("Testdb");
+        atlasClassification.setEntityGuid("abb672b1-e4bd-402d-a98f-73cd8f775e2a");
+        WebResource.Builder builder = setupBuilder(AtlasClientV2.API_V2.UPDATE_CLASSIFICATIONS, service);
+
+
+        ClientResponse response = mock(ClientResponse.class);
+        when(response.getStatus()).thenReturn(Response.Status.OK.getStatusCode());
+
+
+        when(builder.method(anyString(), Matchers.<Class>any(), anyString())).thenReturn(response);
+
+        try {
+            atlasClient.updateClassifications("abb672b1-e4bd-402d-a98f-73cd8f775e2a", Collections.singletonList(atlasClassification));
+            Assert.fail("Failed with Exception");
+        } catch (AtlasServiceException e) {
+            Assert.assertTrue(e.getMessage().contains(" failed with status 200 "));
+        }
+
+    }
+
+
+}
+