perfsonar-dev - perfsonar: r5328 - in branches/new-structure-with-base2/ps-mdm-ls/src: main/java/org/perfsonar/service/lookupservice/storage/exist test/java/org/perfsonar/tests/dao
Subject: perfsonar development work
List archive
perfsonar: r5328 - in branches/new-structure-with-base2/ps-mdm-ls/src: main/java/org/perfsonar/service/lookupservice/storage/exist test/java/org/perfsonar/tests/dao
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5328 - in branches/new-structure-with-base2/ps-mdm-ls/src: main/java/org/perfsonar/service/lookupservice/storage/exist test/java/org/perfsonar/tests/dao
- Date: Mon, 26 Oct 2009 11:31:03 -0400
Author: trzaszcz
Date: 2009-10-26 11:31:03 -0400 (Mon, 26 Oct 2009)
New Revision: 5328
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/SummarizationDAOImpl.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryExistDAOImpl.java
branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/dao/SummarizationDaoTests.java
Log:
unit testing, refactorization
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/SummarizationDAOImpl.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/SummarizationDAOImpl.java
2009-10-26 14:30:40 UTC (rev 5327)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/SummarizationDAOImpl.java
2009-10-26 15:31:03 UTC (rev 5328)
@@ -10,6 +10,11 @@
import org.perfsonar.base2.xml.StringBufferOutputStream;
import org.perfsonar.service.lookupservice.storage.SummarizationDAO;
+/**
+ *
+ *
+ * @author trzaszcz
+ */
public class SummarizationDAOImpl extends XQueryExistDAOImpl implements
SummarizationDAO {
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
2009-10-26 14:30:40 UTC (rev 5327)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryDAOSupportImpl.java
2009-10-26 15:31:03 UTC (rev 5328)
@@ -15,5 +15,22 @@
return res;
}
+
+ public boolean isDBCollection(String collection) throws
PerfSONARException {
+ String xquery = DECLARE_NMWG_NAMESPACE + "
count(/nmwg:store[@type='"
+ + collection + "'])";
+ XMLDBResult res = performXQuery(xquery);
+ int result = res.getTotal();
+ return (result > 0);
+ }
+
+ public boolean isDBConnectivity() throws PerfSONARException {
+
+ String xquery = "fn:current-dateTime()";
+ performXQuery(xquery);
+ return true;
+
+ }
+
}
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryExistDAOImpl.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryExistDAOImpl.java
2009-10-26 14:30:40 UTC (rev 5327)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/storage/exist/XQueryExistDAOImpl.java
2009-10-26 15:31:03 UTC (rev 5328)
@@ -253,21 +253,4 @@
}
- public boolean isDBCollection(String collection) throws
PerfSONARException {
-
- String xquery = DECLARE_NMWG_NAMESPACE + "
count(/nmwg:store[@type='"
- + collection + "'])";
- XMLDBResult res = performXQuery(xquery);
- int result = res.getTotal();
- return (result > 0);
- }
-
- public boolean isDBConnectivity() throws PerfSONARException {
-
- String xquery = "fn:current-dateTime()";
- performXQuery(xquery);
- return true;
-
- }
-
}
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/dao/SummarizationDaoTests.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/dao/SummarizationDaoTests.java
2009-10-26 14:30:40 UTC (rev 5327)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/dao/SummarizationDaoTests.java
2009-10-26 15:31:03 UTC (rev 5328)
@@ -14,7 +14,6 @@
public class SummarizationDaoTests extends TestCase{
- private SummarizationDAO summarizationDAO;
private SummarizationDAO getSummarizationDao() throws
PerfSONARException{
return
(SummarizationDAO)ConfigurationManager.getInstanceWithoutRunningComponents().getConfiguration().getAuxiliaryComponent("summarizationdao");
@@ -23,7 +22,7 @@
public void testPutSingleSummaryData() throws Exception{
- summarizationDAO=getSummarizationDao();
+ SummarizationDAO summarizationDAO=getSummarizationDao();
summarizationDAO.removeSummaryData();
@@ -45,8 +44,9 @@
public void testPutBatchOfSummaryData() throws Exception{
- summarizationDAO=getSummarizationDao();
+ SummarizationDAO summarizationDAO=getSummarizationDao();
+
summarizationDAO.removeSummaryData();
Metadata meta1=new Metadata();
@@ -62,11 +62,16 @@
elements.add(meta1);
elements.add(meta2);
-
summarizationDAO.putBatchData(elements);
assertTrue(summarizationDAO.getSummaryData().getTotal()==elements.size());
summarizationDAO.removeSummaryData();
+
+ summarizationDAO.putBatchData(elements, 1);
+
+
assertTrue(summarizationDAO.getSummaryData().getTotal()==elements.size());
+
+ summarizationDAO.removeSummaryData();
}
}
- perfsonar: r5328 - in branches/new-structure-with-base2/ps-mdm-ls/src: main/java/org/perfsonar/service/lookupservice/storage/exist test/java/org/perfsonar/tests/dao, svnlog, 10/26/2009
Archive powered by MHonArc 2.6.16.