diff options
author | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-18 19:45:38 +0300 |
---|---|---|
committer | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-18 19:45:38 +0300 |
commit | b8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch) | |
tree | f78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib | |
parent | 75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff) |
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535
Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib')
12 files changed, 76 insertions, 20 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml index 08a09273c6..bc05097e07 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/pom.xml @@ -31,14 +31,14 @@ <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-adaptor-inbound-api</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-datatypes-lib</artifactId> <version>${project.version}</version> </dependency> - <dependency> + <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java index 1495ed27a8..f4e8688d63 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-api/src/main/java/org/openecomp/core/zusammen/api/ZusammenAdaptor.java @@ -3,6 +3,7 @@ package org.openecomp.core.zusammen.api; import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.ElementContext; @@ -73,4 +74,8 @@ public interface ZusammenAdaptor { Optional<Element> saveElement(SessionContext context, ElementContext elementContext, ZusammenElement element, String message); + + Collection<HealthInfo> checkHealth(SessionContext context); + + String getVersion(SessionContext sessionContext); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml index c1870d8c64..4227f41374 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml @@ -21,17 +21,17 @@ <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-commons-utils</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-adaptor-inbound-api</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-adaptor-inbound-impl</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> <scope>runtime</scope> </dependency> <dependency> @@ -53,7 +53,7 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-search-index-empty-plugin</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> <scope>runtime</scope> </dependency> <dependency> diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java index f746d706e1..6381b2efd2 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/ZusammenConnector.java @@ -3,6 +3,7 @@ package org.openecomp.core.zusammen.db; import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.ElementContext; @@ -48,4 +49,8 @@ public interface ZusammenConnector { Optional<Element> saveElement(SessionContext context, ElementContext elementContext, ZusammenElement element, String message); + + Collection<HealthInfo> checkHealth(SessionContext sessionContext); + + String getVersion(SessionContext sessionContext); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java index f3916521dd..e6f9380c2b 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorFactoryImpl.java @@ -20,6 +20,7 @@ package org.openecomp.core.zusammen.db.impl; +import com.amdocs.zusammen.adaptor.inbound.api.health.HealthAdaptorFactory; import com.amdocs.zusammen.adaptor.inbound.api.item.ElementAdaptorFactory; import com.amdocs.zusammen.adaptor.inbound.api.item.ItemAdaptorFactory; import com.amdocs.zusammen.adaptor.inbound.api.item.ItemVersionAdaptorFactory; @@ -30,7 +31,7 @@ public class ZusammenConnectorFactoryImpl extends ZusammenConnectorFactory { private static final ZusammenConnector INSTANCE = new ZusammenConnectorImpl(ItemAdaptorFactory.getInstance(), ItemVersionAdaptorFactory.getInstance(), - ElementAdaptorFactory.getInstance()); + ElementAdaptorFactory.getInstance(), HealthAdaptorFactory.getInstance()); @Override public ZusammenConnector createInterface() { diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java index 8aa8e129df..fa08ba49a8 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/db/impl/ZusammenConnectorImpl.java @@ -3,9 +3,11 @@ package org.openecomp.core.zusammen.db.impl; import com.amdocs.zusammen.adaptor.inbound.api.item.ElementAdaptorFactory; import com.amdocs.zusammen.adaptor.inbound.api.item.ItemAdaptorFactory; import com.amdocs.zusammen.adaptor.inbound.api.item.ItemVersionAdaptorFactory; +import com.amdocs.zusammen.adaptor.inbound.api.health.HealthAdaptorFactory; import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.Space; @@ -33,18 +35,30 @@ public class ZusammenConnectorImpl implements ZusammenConnector { private ItemAdaptorFactory itemAdaptorFactory; private ItemVersionAdaptorFactory versionAdaptorFactory; private ElementAdaptorFactory elementAdaptorFactory; - + private HealthAdaptorFactory healthAdaptorFactory; public ZusammenConnectorImpl( ItemAdaptorFactory itemAdaptorFactory, ItemVersionAdaptorFactory versionAdaptorFactory, - ElementAdaptorFactory elementAdaptorFactory) { + ElementAdaptorFactory elementAdaptorFactory, + HealthAdaptorFactory healthAdaptorFactory) { this.itemAdaptorFactory = itemAdaptorFactory; this.versionAdaptorFactory = versionAdaptorFactory; this.elementAdaptorFactory = elementAdaptorFactory; + this.healthAdaptorFactory = healthAdaptorFactory; CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem(); } @Override + public Collection<HealthInfo> checkHealth(SessionContext sessionContext) { + return healthAdaptorFactory.createInterface(sessionContext).getHealthStatus(sessionContext); + } + + @Override + public String getVersion(SessionContext sessionContext) { + return healthAdaptorFactory.createInterface(sessionContext).getVersion(); + } + + @Override public Collection<Item> listItems(SessionContext context) { Response<Collection<Item>> response = itemAdaptorFactory.createInterface(context).list(context); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java index ad4839bd00..41ce0283a1 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/ZusammenAdaptorImpl.java @@ -3,14 +3,10 @@ package org.openecomp.core.zusammen.impl; import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo; import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; +import com.amdocs.zusammen.commons.health.data.HealthInfo; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.SessionContext; -import com.amdocs.zusammen.datatypes.item.Action; -import com.amdocs.zusammen.datatypes.item.ElementContext; -import com.amdocs.zusammen.datatypes.item.Info; -import com.amdocs.zusammen.datatypes.item.Item; -import com.amdocs.zusammen.datatypes.item.ItemVersion; -import com.amdocs.zusammen.datatypes.item.ItemVersionData; +import com.amdocs.zusammen.datatypes.item.*; import com.amdocs.zusammen.datatypes.itemversion.Tag; import com.amdocs.zusammen.datatypes.response.Response; import com.amdocs.zusammen.datatypes.response.ReturnCode; @@ -219,10 +215,20 @@ public class ZusammenAdaptorImpl implements ZusammenAdaptor { connector.updateItem(context, itemId, info); } + + @Override + public Collection<HealthInfo> checkHealth(SessionContext context) { + return connector.checkHealth(context); + } + private static void sortItemVersionListByModificationTimeDescOrder( List<ItemVersion> itemVersions) { itemVersions.sort((o1, o2) -> ((Integer)o2.getId().getValue().length()) .compareTo( (o1.getId().getValue().length()))); } + @Override + public String getVersion(SessionContext sessionContext) { + return connector.getVersion(sessionContext); + } } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml index 57f92f1b09..b3bd790bd5 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/pom.xml @@ -15,23 +15,23 @@ <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-sdk</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-commons-db-api</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>com.amdocs.zusammen</groupId> <artifactId>zusammen-commons-db-impl</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> </dependencies> </project> diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java index 93ee2d058b..76b0a900c1 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/collaboration/ElementCollaborationStore.java @@ -78,6 +78,10 @@ public class ElementCollaborationStore { ZusammenPluginUtil.getElementEntity(element)); } + public boolean checkHealth(SessionContext sessionContext){ + return getElementRepository(sessionContext).checkHealth(sessionContext); + } + private void deleteElementHierarchy(ElementRepository elementRepository, SessionContext context, ElementEntityContext elementEntityContext, ElementEntity elementEntity) { diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java index 468b6f0a28..967814c4d8 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/ElementRepository.java @@ -22,4 +22,6 @@ public interface ElementRepository { void createNamespace(SessionContext context, ElementEntityContext elementContext, ElementEntity element); + + boolean checkHealth(SessionContext context); } diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java index 12fd2dabba..c19e8799d1 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/dao/impl/CassandraElementRepository.java @@ -98,6 +98,12 @@ public class CassandraElementRepository implements ElementRepository { element.getNamespace().toString()); } + @Override + public boolean checkHealth(SessionContext context) { + ResultSet resultSet = getVersionElementsAccessor(context).checkHealth(); + return resultSet.getColumnDefinitions().contains("element_ids"); + } + private String getVersionId(ElementEntityContext elementContext) { return elementContext.getChangeRef() == null ? elementContext.getVersionId().toString() @@ -350,6 +356,9 @@ CREATE TABLE IF NOT EXISTS element ( @Query("SELECT element_ids FROM version_elements WHERE space=? AND item_id=? AND version_id=?") ResultSet get(String space, String itemId, String versionId); + + @Query("SELECT element_ids FROM version_elements LIMIT 1") + ResultSet checkHealth(); } private static final class VersionElementsField { diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java index 4bf9a8d25e..90fd3366fe 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-plugin/src/main/java/org/openecomp/core/zusammen/plugin/main/CassandraCollaborationStorePluginImpl.java @@ -17,6 +17,7 @@ package org.openecomp.core.zusammen.plugin.main; import com.amdocs.zusammen.commons.health.data.HealthInfo; +import com.amdocs.zusammen.commons.health.data.HealthStatus; import com.amdocs.zusammen.datatypes.Id; import com.amdocs.zusammen.datatypes.Namespace; import com.amdocs.zusammen.datatypes.SessionContext; @@ -155,6 +156,15 @@ public class CassandraCollaborationStorePluginImpl implements CollaborationStore @Override public Response<HealthInfo> checkHealth(SessionContext sessionContext) throws ZusammenException { - return null; + + boolean health = elementCollaborationStore.checkHealth(sessionContext); + HealthInfo healthInfo ; + if (health){ + healthInfo = new HealthInfo("Collaboration", HealthStatus.UP,""); + } else { + healthInfo = new HealthInfo("Collaboration", HealthStatus.DOWN,"No Schema Available"); + } + return new Response<HealthInfo>(healthInfo); + } }
\ No newline at end of file |