diff --git a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java index 63a2930..91dd25e 100644 --- a/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java +++ b/src/main/java/org/gcube/portal/databook/server/DBCassandraAstyanaxImpl.java @@ -45,21 +45,33 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore { * use this constructor carefully from test classes * @param dropSchema set true if you want do drop the current and set up new one */ - protected DBCassandraAstyanaxImpl(boolean dropSchema) throws Exception { - conn = new CassandraClusterConnection(dropSchema); + protected DBCassandraAstyanaxImpl(boolean dropSchema) { + try { + conn = new CassandraClusterConnection(dropSchema); + } catch (Exception e) { + throw new RuntimeException(e); + } } /** * public constructor, no dropping schema is allowed */ - public DBCassandraAstyanaxImpl() throws Exception { - conn = new CassandraClusterConnection(false); + public DBCassandraAstyanaxImpl() { + try { + conn = new CassandraClusterConnection(false); + } catch (Exception e) { + throw new RuntimeException(e); + } } /** * public constructor, no dropping schema is allowed, infrastructureName is given. */ - public DBCassandraAstyanaxImpl(String infrastructureName) throws Exception { - conn = new CassandraClusterConnection(false, infrastructureName); + public DBCassandraAstyanaxImpl(String infrastructureName) { + try { + conn = new CassandraClusterConnection(false, infrastructureName); + } catch (Exception e) { + throw new RuntimeException(e); + } } /* diff --git a/src/main/java/org/gcube/portal/databook/server/RunningCluster.java b/src/main/java/org/gcube/portal/databook/server/RunningCluster.java index c249adf..70921c4 100644 --- a/src/main/java/org/gcube/portal/databook/server/RunningCluster.java +++ b/src/main/java/org/gcube/portal/databook/server/RunningCluster.java @@ -72,7 +72,7 @@ public class RunningCluster implements Serializable { * @param infrastructureName could be null * @return an instance of the RunningCluster */ - public static synchronized RunningCluster getInstance(String infrastructureName) throws Exception { + public static synchronized RunningCluster getInstance(String infrastructureName){ if (singleton == null) { singleton = new RunningCluster(infrastructureName); } @@ -81,7 +81,7 @@ public class RunningCluster implements Serializable { /** * private constructor */ - private RunningCluster(String infrastructureName) throws Exception { + private RunningCluster(String infrastructureName){ //Query the IS (for the future) try{ List resources = getConfigurationFromIS(infrastructureName); @@ -116,7 +116,7 @@ public class RunningCluster implements Serializable { * @return the * @throws Exception */ - private List getConfigurationFromIS(String infrastructureName) throws Exception { + private List getConfigurationFromIS(String infrastructureName) { _log.debug("getConfigurationFromIS infrastructureName="+infrastructureName ); String scope = "/"; if(infrastructureName != null && !infrastructureName.isEmpty()) diff --git a/src/main/java/org/gcube/portal/databook/server/Tester.java b/src/main/java/org/gcube/portal/databook/server/Tester.java index cb95a60..d7425ba 100644 --- a/src/main/java/org/gcube/portal/databook/server/Tester.java +++ b/src/main/java/org/gcube/portal/databook/server/Tester.java @@ -2,7 +2,6 @@ package org.gcube.portal.databook.server; import org.gcube.portal.databook.shared.*; import org.gcube.portal.databook.shared.ex.*; -import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,18 +18,17 @@ public class Tester { private static DBCassandraAstyanaxImpl store; private static Logger LOGGER = LoggerFactory.getLogger(Tester.class); - public Tester() throws Exception { + 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 Exception { + public static void main(String[] args) throws ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException, FeedIDNotFoundException, FeedTypeNotFoundException { Tester test = new Tester(); //test.getComment(); test.testFunc(); System.exit(0); } - @Test public void testFunc() throws ColumnNameNotFoundException, PrivacyLevelTypeNotFoundException, FeedIDNotFoundException, FeedTypeNotFoundException { String postIdToUpdate = "047c601d-2291-4974-9224-d6732b1fbe26"; Post read = store.readPost(postIdToUpdate);