From 204462fcd6a0ee1f66d7d562df79767d1307e6b7 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Date: Mon, 30 Oct 2023 19:04:54 +0100 Subject: [PATCH] Remove astyanx dependencies and imports. --- META-INF/MANIFEST.MF | 2 +- .../server/DatabookCassandraTest.java | 4 -- .../portal/databook/server/DatabookStore.java | 5 +-- .../gcube/portal/databook/server/Tester.java | 45 +++++++++++++++++++ 4 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 src/main/java/org/gcube/portal/databook/server/Tester.java diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index 5e94951..ed49fc3 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Class-Path: +Main-Class: org.gcube.portal.databook.server.Tester diff --git a/src/main/java/org/gcube/portal/databook/server/DatabookCassandraTest.java b/src/main/java/org/gcube/portal/databook/server/DatabookCassandraTest.java index 33df1eb..8d02836 100644 --- a/src/main/java/org/gcube/portal/databook/server/DatabookCassandraTest.java +++ b/src/main/java/org/gcube/portal/databook/server/DatabookCassandraTest.java @@ -5,10 +5,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import com.google.common.collect.ImmutableMap; -import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; -import com.netflix.astyanax.model.ColumnFamily; -import com.netflix.astyanax.serializers.StringSerializer; public class DatabookCassandraTest { private static DBCassandraAstyanaxImpl store; diff --git a/src/main/java/org/gcube/portal/databook/server/DatabookStore.java b/src/main/java/org/gcube/portal/databook/server/DatabookStore.java index 263946f..95af072 100644 --- a/src/main/java/org/gcube/portal/databook/server/DatabookStore.java +++ b/src/main/java/org/gcube/portal/databook/server/DatabookStore.java @@ -30,8 +30,6 @@ import org.gcube.portal.databook.shared.ex.NotificationIDNotFoundException; import org.gcube.portal.databook.shared.ex.NotificationTypeNotFoundException; import org.gcube.portal.databook.shared.ex.PrivacyLevelTypeNotFoundException; -import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; - /** * @author Massimiliano Assante ISTI-CNR * @author Costantino Perciante ISTI-CNR @@ -659,9 +657,8 @@ public interface DatabookStore { /** * Retrieve all the ids of the vre * @return the set of ids of the vre available or empty list in case of errors. - * @throws ConnectionException */ - public List getAllVREIds() throws ConnectionException; + public List getAllVREIds(); /** * close the connection to the underlying database diff --git a/src/main/java/org/gcube/portal/databook/server/Tester.java b/src/main/java/org/gcube/portal/databook/server/Tester.java new file mode 100644 index 0000000..522de5b --- /dev/null +++ b/src/main/java/org/gcube/portal/databook/server/Tester.java @@ -0,0 +1,45 @@ +package org.gcube.portal.databook.server; + +import org.gcube.portal.databook.shared.*; +import org.gcube.portal.databook.shared.ex.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class Tester { + private static DBCassandraAstyanaxImpl store; + private static Logger LOGGER = LoggerFactory.getLogger(Tester.class); + + public Tester() { + store = new DBCassandraAstyanaxImpl("gcube"); //set to true if you want to drop the KeySpace and recreate it + } + + public static void main(String[] args) throws ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException, FeedIDNotFoundException, FeedTypeNotFoundException { + Tester test = new Tester(); + //test.getComment(); + test.testFunc(); + System.exit(0); + + } + public void testFunc() throws ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException, FeedIDNotFoundException, FeedTypeNotFoundException { + String postIdToUpdate = "047c601d-2291-4974-9224-d6732b1fbe26"; + Post read = store.readPost(postIdToUpdate); + + List readC = store.getAllCommentByPost("047c601d-2291-4974-9224-d6732b1fbe26"); + System.out.println(read); + readC.forEach(c -> System.out.println(c.getText())); + } + public void getComment(){ + String uuid = "820969b2-4632-4197-9fd6-5aafab781faa"; + + Comment c; + try { + c = store.readCommentById(uuid); + System.out.println(c); + } catch (CommentIDNotFoundException e) { + // TODO Auto-generated catch block + System.err.println(e.toString()); + } + } +} \ No newline at end of file