[atlas] branch branch-1.0 updated: ATLAS-3067: fix for IT failure in EntityJerseyResourceIT.testCompleteUpdate()
This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch branch-1.0 in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/branch-1.0 by this push: new c4ce2b4 ATLAS-3067: fix for IT failure in EntityJerseyResourceIT.testCompleteUpdate() c4ce2b4 is described below commit c4ce2b4c06e9ae5aae62161828658ce4df6561f8 Author: Sarath Subramanian AuthorDate: Wed Mar 20 14:16:04 2019 -0700 ATLAS-3067: fix for IT failure in EntityJerseyResourceIT.testCompleteUpdate() (cherry picked from commit 2c0a8bcc1afe1588a1ffc3ea175bb29055c55894) --- .../web/integration/EntityJerseyResourceIT.java| 25 +++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java index 15a06e3..edb4568 100755 --- a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java +++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java @@ -35,6 +35,7 @@ import org.apache.atlas.type.AtlasType; import org.apache.atlas.v1.typesystem.types.utils.TypesUtil; import org.apache.atlas.utils.AuthenticationUtil; import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang.StringUtils; import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -998,8 +999,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT { List refs = (List) hiveTableInstance.get("columns"); Assert.assertEquals(refs.size(), 2); -Assert.assertEquals(refs.get(0).getValuesMap(), values1); -Assert.assertEquals(refs.get(1).getValuesMap(), values2); +Referenceable col3 = getReferenceable(refs, "col3"); +Referenceable col4 = getReferenceable(refs, "col4"); + +Assert.assertEquals(col3.getValuesMap(), values1); +Assert.assertEquals(col4.getValuesMap(), values2); } @Test @@ -1117,4 +1121,19 @@ public class EntityJerseyResourceIT extends BaseResourceIT { } } -} +private Referenceable getReferenceable(List refs, String name) { +Referenceable ret = null; + +for (Referenceable ref : refs) { +Map values = ref.getValuesMap(); +String entityName = (String) values.get("name"); + +if (StringUtils.equalsIgnoreCase(name, entityName)) { +ret = ref; +break; +} +} + +return ret; +} +} \ No newline at end of file
[atlas] branch master updated: ATLAS-3067: fix for IT failure in EntityJerseyResourceIT.testCompleteUpdate()
This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/master by this push: new 2c0a8bc ATLAS-3067: fix for IT failure in EntityJerseyResourceIT.testCompleteUpdate() 2c0a8bc is described below commit 2c0a8bcc1afe1588a1ffc3ea175bb29055c55894 Author: Sarath Subramanian AuthorDate: Wed Mar 20 14:16:04 2019 -0700 ATLAS-3067: fix for IT failure in EntityJerseyResourceIT.testCompleteUpdate() --- .../web/integration/EntityJerseyResourceIT.java| 25 +++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java index 15a06e3..edb4568 100755 --- a/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java +++ b/webapp/src/test/java/org/apache/atlas/web/integration/EntityJerseyResourceIT.java @@ -35,6 +35,7 @@ import org.apache.atlas.type.AtlasType; import org.apache.atlas.v1.typesystem.types.utils.TypesUtil; import org.apache.atlas.utils.AuthenticationUtil; import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang.StringUtils; import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -998,8 +999,11 @@ public class EntityJerseyResourceIT extends BaseResourceIT { List refs = (List) hiveTableInstance.get("columns"); Assert.assertEquals(refs.size(), 2); -Assert.assertEquals(refs.get(0).getValuesMap(), values1); -Assert.assertEquals(refs.get(1).getValuesMap(), values2); +Referenceable col3 = getReferenceable(refs, "col3"); +Referenceable col4 = getReferenceable(refs, "col4"); + +Assert.assertEquals(col3.getValuesMap(), values1); +Assert.assertEquals(col4.getValuesMap(), values2); } @Test @@ -1117,4 +1121,19 @@ public class EntityJerseyResourceIT extends BaseResourceIT { } } -} +private Referenceable getReferenceable(List refs, String name) { +Referenceable ret = null; + +for (Referenceable ref : refs) { +Map values = ref.getValuesMap(); +String entityName = (String) values.get("name"); + +if (StringUtils.equalsIgnoreCase(name, entityName)) { +ret = ref; +break; +} +} + +return ret; +} +} \ No newline at end of file
[atlas] branch branch-1.0 updated: ATLAS-3031: UI : Allow user to export the lineage in PNG formatt
This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch branch-1.0 in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/branch-1.0 by this push: new 622d7d3 ATLAS-3031: UI : Allow user to export the lineage in PNG formatt 622d7d3 is described below commit 622d7d32073bbe037da3a38d11da06acfe7503e6 Author: gutkaBinit AuthorDate: Wed Mar 20 12:20:44 2019 -0700 ATLAS-3031: UI : Allow user to export the lineage in PNG formatt Signed-off-by: Sarath Subramanian (cherry picked from commit 27916dd49f854678b84bde8023aee6e47cbeb7ce) --- dashboardv2/public/css/scss/graph.scss | 4 + .../js/templates/graph/LineageLayoutView_tmpl.html | 10 +- .../public/js/views/graph/LineageLayoutView.js | 156 +++-- 3 files changed, 157 insertions(+), 13 deletions(-) diff --git a/dashboardv2/public/css/scss/graph.scss b/dashboardv2/public/css/scss/graph.scss index b72236a..3073aee 100644 --- a/dashboardv2/public/css/scss/graph.scss +++ b/dashboardv2/public/css/scss/graph.scss @@ -421,4 +421,8 @@ span#zoom_in { word-break: break-all; } +} + +.hidden-svg { +visibility: hidden; } \ No newline at end of file diff --git a/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html b/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html index 8e10e7f..71edcba 100644 --- a/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html @@ -90,6 +90,11 @@ + + + + + @@ -127,12 +132,11 @@ - Current Entity Lineage Impact - http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; version="1.1"> - \ No newline at end of file + + \ No newline at end of file diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js index 790e8cf..de510cb 100644 --- a/dashboardv2/public/js/views/graph/LineageLayoutView.js +++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js @@ -63,7 +63,8 @@ define(['require', searchNode: '[data-id="searchNode"]', nodeDetailTable: '[data-id="nodeDetailTable"]', showOnlyHoverPath: '[data-id="showOnlyHoverPath"]', -showTooltip: '[data-id="showTooltip"]' +showTooltip: '[data-id="showTooltip"]', +saveSvg: '[data-id="saveSvg"]', }, templateHelpers: function() { return { @@ -82,6 +83,7 @@ define(['require', events["click " + this.ui.settingToggler] = 'onClickSettingToggler'; events["click " + this.ui.lineageFullscreenToggler] = 'onClickLineageFullscreenToggler'; events["click " + this.ui.searchToggler] = 'onClickSearchToggler'; +events["click " + this.ui.saveSvg] = 'onClickSaveSvg'; return events; }, @@ -488,7 +490,8 @@ define(['require', createGraph: function() { var that = this, width = this.$('svg').width(), -height = this.$('svg').height(); +height = this.$('svg').height(), +imageObject = {}; this.g.nodes().forEach(function(v) { var node = that.g.node(v); // Round the corners of the nodes @@ -500,6 +503,8 @@ define(['require', var render = new dagreD3.render(); // Add our custom arrow (a hollow-point) render.arrows().arrowPoint = function normal(parent, id, edge, type) { +var parentNode = parent && parent[0] && parent[0][0] && parent[0][0].parentNode ? parent[0][0].parentNode : parent; + d3.select(parentNode).select('path.path').attr('marker-end', "url(#" + id + ")"); var marker = parent.append("marker") .attr("id", id) .attr("viewBox", "0 0 10 10") @@ -536,17 +541,49 @@ define(['require', .attr("height", "100%") .append('image') .attr("xlink:href", function(d) { +var that = this; if (node) { -return Utils.getEntityIconPath({ entityData: node }); +var imageIconPath = Utils.getEntityIconPath({ entityData: node }), +imagePath = ((window.location.origin + Utils.getBaseUrl(window.location.pathname)) + imageIconPath); + +var xhr = new XMLHttpRequest(); +
[atlas] branch master updated: ATLAS-3031: UI : Allow user to export the lineage in PNG formatt
This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/master by this push: new 27916dd ATLAS-3031: UI : Allow user to export the lineage in PNG formatt 27916dd is described below commit 27916dd49f854678b84bde8023aee6e47cbeb7ce Author: gutkaBinit AuthorDate: Wed Mar 20 12:20:44 2019 -0700 ATLAS-3031: UI : Allow user to export the lineage in PNG formatt Signed-off-by: Sarath Subramanian --- dashboardv2/public/css/scss/graph.scss | 4 + .../js/templates/graph/LineageLayoutView_tmpl.html | 10 +- .../public/js/views/graph/LineageLayoutView.js | 156 +++-- 3 files changed, 157 insertions(+), 13 deletions(-) diff --git a/dashboardv2/public/css/scss/graph.scss b/dashboardv2/public/css/scss/graph.scss index b72236a..3073aee 100644 --- a/dashboardv2/public/css/scss/graph.scss +++ b/dashboardv2/public/css/scss/graph.scss @@ -421,4 +421,8 @@ span#zoom_in { word-break: break-all; } +} + +.hidden-svg { +visibility: hidden; } \ No newline at end of file diff --git a/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html b/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html index 8e10e7f..71edcba 100644 --- a/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html +++ b/dashboardv2/public/js/templates/graph/LineageLayoutView_tmpl.html @@ -90,6 +90,11 @@ + + + + + @@ -127,12 +132,11 @@ - Current Entity Lineage Impact - http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; version="1.1"> - \ No newline at end of file + + \ No newline at end of file diff --git a/dashboardv2/public/js/views/graph/LineageLayoutView.js b/dashboardv2/public/js/views/graph/LineageLayoutView.js index 790e8cf..de510cb 100644 --- a/dashboardv2/public/js/views/graph/LineageLayoutView.js +++ b/dashboardv2/public/js/views/graph/LineageLayoutView.js @@ -63,7 +63,8 @@ define(['require', searchNode: '[data-id="searchNode"]', nodeDetailTable: '[data-id="nodeDetailTable"]', showOnlyHoverPath: '[data-id="showOnlyHoverPath"]', -showTooltip: '[data-id="showTooltip"]' +showTooltip: '[data-id="showTooltip"]', +saveSvg: '[data-id="saveSvg"]', }, templateHelpers: function() { return { @@ -82,6 +83,7 @@ define(['require', events["click " + this.ui.settingToggler] = 'onClickSettingToggler'; events["click " + this.ui.lineageFullscreenToggler] = 'onClickLineageFullscreenToggler'; events["click " + this.ui.searchToggler] = 'onClickSearchToggler'; +events["click " + this.ui.saveSvg] = 'onClickSaveSvg'; return events; }, @@ -488,7 +490,8 @@ define(['require', createGraph: function() { var that = this, width = this.$('svg').width(), -height = this.$('svg').height(); +height = this.$('svg').height(), +imageObject = {}; this.g.nodes().forEach(function(v) { var node = that.g.node(v); // Round the corners of the nodes @@ -500,6 +503,8 @@ define(['require', var render = new dagreD3.render(); // Add our custom arrow (a hollow-point) render.arrows().arrowPoint = function normal(parent, id, edge, type) { +var parentNode = parent && parent[0] && parent[0][0] && parent[0][0].parentNode ? parent[0][0].parentNode : parent; + d3.select(parentNode).select('path.path').attr('marker-end', "url(#" + id + ")"); var marker = parent.append("marker") .attr("id", id) .attr("viewBox", "0 0 10 10") @@ -536,17 +541,49 @@ define(['require', .attr("height", "100%") .append('image') .attr("xlink:href", function(d) { +var that = this; if (node) { -return Utils.getEntityIconPath({ entityData: node }); +var imageIconPath = Utils.getEntityIconPath({ entityData: node }), +imagePath = ((window.location.origin + Utils.getBaseUrl(window.location.pathname)) + imageIconPath); + +var xhr = new XMLHttpRequest(); +xhr.responseType = 'blob'; + +
[atlas] branch master updated: ATLAS-2945 UI - If a Term is assigned to an Category then to user is able to assign the same term again
This is an automated email from the ASF dual-hosted git repository. nixon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/master by this push: new f92e06c ATLAS-2945 UI - If a Term is assigned to an Category then to user is able to assign the same term again f92e06c is described below commit f92e06cda0833d5840015a18ec8f5c5f30b582a3 Author: gutkaBinit AuthorDate: Wed Mar 20 17:03:34 2019 +0530 ATLAS-2945 UI - If a Term is assigned to an Category then to user is able to assign the same term again Signed-off-by: nixonrodrigues --- dashboardv2/public/js/utils/CommonViewFunction.js | 14 + .../js/views/detail_page/DetailPageLayoutView.js | 23 +++- .../js/views/glossary/AssignTermLayoutView.js | 5 +- .../js/views/glossary/GlossaryDetailLayoutView.js | 2 + .../public/js/views/glossary/GlossaryLayoutView.js | 63 +++--- .../js/views/search/SearchResultLayoutView.js | 4 +- 6 files changed, 50 insertions(+), 61 deletions(-) diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js index 4265a09..feb8dd3 100644 --- a/dashboardv2/public/js/utils/CommonViewFunction.js +++ b/dashboardv2/public/js/utils/CommonViewFunction.js @@ -16,7 +16,7 @@ * limitations under the License. */ -define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Globals', 'utils/Enums', 'moment'], function(require, Utils, Modal, Messages, Globals, Enums, moment) { +define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Enums', 'moment'], function(require, Utils, Modal, Messages, Enums, moment) { 'use strict'; var CommonViewFunction = {}; @@ -335,18 +335,6 @@ define(['require', 'utils/Utils', 'modules/Modal', 'utils/Messages', 'utils/Glob } if (!Enums.entityStateReadOnly[obj.status]) { if (obj.guid) { -var newD = { "guid": obj.guid, "termLinks": obj.meanings }; -Globals.termMeanings = Globals.termMeanings ? Globals.termMeanings : []; -if (Globals.termMeanings.length > 0) { -for (var x in Globals.termMeanings) { -if (Globals.termMeanings[x]['guid'] == obj.guid) { -Globals.termMeanings[x].termLinks = obj.meanings; -} -} -} -if (newD.termLinks.length > 0 && Globals.termMeanings == 0) { -Globals.termMeanings.push(newD); -} addTerm += ''; } else { addTerm += ''; diff --git a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js index 6727d6a..00dfe2b 100644 --- a/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js +++ b/dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js @@ -198,7 +198,7 @@ define(['require', this.generateTag([]); } if (collectionJSON.relationshipAttributes && collectionJSON.relationshipAttributes.meanings) { - this.generateTerm(collectionJSON.relationshipAttributes.meanings, collectionJSON); + this.generateTerm(collectionJSON.relationshipAttributes.meanings); } if (Globals.entityTypeConfList && _.isEmptyArray(Globals.entityTypeConfList)) { this.ui.editButtonContainer.html(ButtonsTmpl({ btn_edit: true })); @@ -403,21 +403,9 @@ define(['require', this.ui.propagatedTagList.html(propagatedTagListData); }, -generateTerm: function(data, obj) { +generateTerm: function(data) { var that = this, termData = ""; -var newD = { "guid": obj.guid, "termLinks": obj.relationshipAttributes.meanings }; -Globals.termMeanings = Globals.termMeanings ? Globals.termMeanings : []; -if (Globals.termMeanings.length > 0) { -for (var x in Globals.termMeanings) { -if (Globals.termMeanings[x]['guid'] == obj.guid) { -Globals.termMeanings[x].termLinks = obj.relationshipAttributes.meanings; -} -} -} -if (newD.termLinks.length > 0 && Globals.termMeanings == 0) { -Globals.termMeanings.push(newD); -} _.each(data, function(val) { if (val.relationshipStatus == "ACTIVE") { termData += '' + val.displayText + ''; @@ -458,13 +446,18 @@ define(['require', }); },
[atlas] branch master updated: ATLAS-3083 :- Disable SSLAndKerberosTest & SSLTest etc Unitcases
This is an automated email from the ASF dual-hosted git repository. nixon pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/master by this push: new 4c7c911 ATLAS-3083 :- Disable SSLAndKerberosTest & SSLTest etc Unitcases 4c7c911 is described below commit 4c7c911c3d64ede6bbb2d8cafb9cbc50c399cbc1 Author: nixonrodrigues AuthorDate: Wed Mar 20 14:35:04 2019 +0530 ATLAS-3083 :- Disable SSLAndKerberosTest & SSLTest etc Unitcases Change-Id: I55f6ea20b0643821996721d3a7370a44729d5ea2 --- .../apache/atlas/web/security/NegativeSSLAndKerberosTest.java| 6 +++--- .../java/org/apache/atlas/web/security/SSLAndKerberosTest.java | 9 - webapp/src/test/java/org/apache/atlas/web/security/SSLTest.java | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/webapp/src/test/java/org/apache/atlas/web/security/NegativeSSLAndKerberosTest.java b/webapp/src/test/java/org/apache/atlas/web/security/NegativeSSLAndKerberosTest.java index 98ec401..d3cf35c 100755 --- a/webapp/src/test/java/org/apache/atlas/web/security/NegativeSSLAndKerberosTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/security/NegativeSSLAndKerberosTest.java @@ -47,7 +47,7 @@ public class NegativeSSLAndKerberosTest extends BaseSSLAndKerberosTest { private String originalConf; private AtlasClient dgiClient; -@BeforeClass +//@BeforeClass public void setUp() throws Exception { jksPath = new Path(Files.createTempDirectory("tempproviders").toString(), "test.jks"); providerUrl = JavaKeyStoreProvider.SCHEME_NAME + "://file/" + jksPath.toUri(); @@ -115,7 +115,7 @@ public class NegativeSSLAndKerberosTest extends BaseSSLAndKerberosTest { secureEmbeddedServer.getServer().start(); } -@AfterClass +//@AfterClass public void tearDown() throws Exception { if (secureEmbeddedServer != null) { secureEmbeddedServer.getServer().stop(); @@ -130,7 +130,7 @@ public class NegativeSSLAndKerberosTest extends BaseSSLAndKerberosTest { } } -@Test (enabled = false) +@Test(enabled = false) public void testUnsecuredClient() throws Exception { try { dgiClient.listTypes(); diff --git a/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java b/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java index e039d6c..417a19a 100755 --- a/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/security/SSLAndKerberosTest.java @@ -29,7 +29,7 @@ import org.apache.hadoop.security.alias.JavaKeyStoreProvider; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; - +import org.junit.Ignore; import java.io.File; import java.io.IOException; import java.net.URL; @@ -59,7 +59,7 @@ public class SSLAndKerberosTest extends BaseSSLAndKerberosTest { private String originalConf; private String originalHomeDir; -@BeforeClass +//@BeforeClass public void setUp() throws Exception { jksPath = new Path(Files.createTempDirectory("tempproviders").toString(), "test.jks"); providerUrl = JavaKeyStoreProvider.SCHEME_NAME + "://file/" + jksPath.toUri(); @@ -103,7 +103,6 @@ public class SSLAndKerberosTest extends BaseSSLAndKerberosTest { + "/users-credentials"); configuration.setProperty("atlas.auth.policy.file",persistDir + "/policy-store.txt" ); - TestUtils.writeConfiguration(configuration, persistDir + File.separator + "atlas-application.properties"); @@ -140,7 +139,7 @@ public class SSLAndKerberosTest extends BaseSSLAndKerberosTest { secureEmbeddedServer.getServer().start(); } -@AfterClass +//@AfterClass public void tearDown() throws Exception { if (secureEmbeddedServer != null) { secureEmbeddedServer.getServer().stop(); @@ -181,7 +180,7 @@ public class SSLAndKerberosTest extends BaseSSLAndKerberosTest { return lc.getSubject(); } -@Test +@Test(enabled = false) public void testService() throws Exception { dgiCLient.listTypes(); } diff --git a/webapp/src/test/java/org/apache/atlas/web/security/SSLTest.java b/webapp/src/test/java/org/apache/atlas/web/security/SSLTest.java index 124a231..ee652f0 100755 --- a/webapp/src/test/java/org/apache/atlas/web/security/SSLTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/security/SSLTest.java @@ -68,7 +68,7 @@ public class SSLTest extends BaseSSLAndKerberosTest { } } -@BeforeClass +//@BeforeClass public void setUp() throws Exception { jksPath = new Path(Files.createTempDirectory("tempproviders").toString(), "test.jks"); providerUrl =
[atlas] branch master updated: ATLAS-3070: Create patch framework to persist typedef patches applied to atlas #2 fix getPatches() method
This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/master by this push: new fa2c3e2 ATLAS-3070: Create patch framework to persist typedef patches applied to atlas #2 fix getPatches() method fa2c3e2 is described below commit fa2c3e2cc6afc8d06a943a589502d0e1004cdd62 Author: Sarath Subramanian AuthorDate: Wed Mar 20 00:38:04 2019 -0700 ATLAS-3070: Create patch framework to persist typedef patches applied to atlas #2 fix getPatches() method --- .../store/graph/v2/AtlasGraphUtilsV2.java | 32 ++ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java index 5827dad..2d5fd97 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java @@ -484,23 +484,31 @@ public class AtlasGraphUtilsV2 { } public static AtlasPatches getPatches() { -List patches= new ArrayList<>(); -String indexQuery = getIndexSearchPrefix() + "\"" + PATCH_ID_PROPERTY_KEY + "\" : (*)"; -Iterator> results= AtlasGraphProvider.getGraphInstance().indexQuery(VERTEX_INDEX, indexQuery).vertices(); +List ret= new ArrayList<>(); +String idxQueryString = getIndexSearchPrefix() + "\"" + PATCH_ID_PROPERTY_KEY + "\" : (*)"; +AtlasIndexQuery idxQuery = AtlasGraphProvider.getGraphInstance().indexQuery(VERTEX_INDEX, idxQueryString); +Iterator> results; -while (results != null && results.hasNext()) { -AtlasVertex patchVertex = results.next().getVertex(); -AtlasPatch patch = toAtlasPatch(patchVertex); +try { +results = idxQuery.vertices(); -patches.add(patch); -} +while (results != null && results.hasNext()) { +AtlasVertex patchVertex = results.next().getVertex(); +AtlasPatch patch = toAtlasPatch(patchVertex); -// Sort the patches based on patch id -if (CollectionUtils.isNotEmpty(patches)) { -Collections.sort(patches, (p1, p2) -> p1.getId().compareTo(p2.getId())); +ret.add(patch); +} + +// Sort the patches based on patch id +if (CollectionUtils.isNotEmpty(ret)) { +Collections.sort(ret, (p1, p2) -> p1.getId().compareTo(p2.getId())); +} +} catch (Throwable t) { +// first time idx query is fired, returns no field exists in solr exception +LOG.warn("getPatches() returned empty result!"); } -return new AtlasPatches(patches); +return new AtlasPatches(ret); } private static AtlasPatch toAtlasPatch(AtlasVertex vertex) {