@@ -65,26 +65,26 @@ public static void afterClass() throws DatatypeConfigurationException {
6565 @ Test
6666 public void testBitemporalDocument () {
6767 String doc1 = "<test>" +
68- uniqueTerm1 + " doc1" +
69- "<system-start></system-start>" +
70- "<system-end></system-end>" +
71- "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
72- "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
73- "</test>" ;
68+ uniqueTerm1 + " doc1" +
69+ "<system-start></system-start>" +
70+ "<system-end></system-end>" +
71+ "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
72+ "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
73+ "</test>" ;
7474 String doc2 = "<test>" +
75- uniqueTerm2 + " doc1" +
76- "<system-start></system-start>" +
77- "<system-end></system-end>" +
78- "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
79- "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
80- "</test>" ;
75+ uniqueTerm2 + " doc1" +
76+ "<system-start></system-start>" +
77+ "<system-end></system-end>" +
78+ "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
79+ "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
80+ "</test>" ;
8181 String doc3 = "<test>" +
82- uniqueTerm3 + " doc1" +
83- "<system-start></system-start>" +
84- "<system-end></system-end>" +
85- "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
86- "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
87- "</test>" ;
82+ uniqueTerm3 + " doc1" +
83+ "<system-start></system-start>" +
84+ "<system-end></system-end>" +
85+ "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
86+ "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
87+ "</test>" ;
8888 StringHandle handle1 = new StringHandle (doc1 ).withFormat (Format .XML );
8989 docMgr .write (docId1 , temporalDocument1 , null , handle1 , null , null , temporalCollection );
9090 StringHandle handle2 = new StringHandle (doc2 ).withFormat (Format .XML );
@@ -104,33 +104,33 @@ public void testBitemporalDocument() {
104104 public void testBitemporalDocumentBulk () {
105105 String prefix = "test_" + uniqueBulkTerm ;
106106 String doc1 = "<test>" +
107- uniqueBulkTerm + " doc1" +
108- "<system-start></system-start>" +
109- "<system-end></system-end>" +
110- "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
111- "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
112- "</test>" ;
107+ uniqueBulkTerm + " doc1" +
108+ "<system-start></system-start>" +
109+ "<system-end></system-end>" +
110+ "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
111+ "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
112+ "</test>" ;
113113 String doc2 = "<test>" +
114- uniqueBulkTerm + " doc2" +
115- "<system-start></system-start>" +
116- "<system-end></system-end>" +
117- "<valid-start>2014-08-19T00:00:02Z</valid-start>" +
118- "<valid-end>2014-08-19T00:00:03Z</valid-end>" +
119- "</test>" ;
114+ uniqueBulkTerm + " doc2" +
115+ "<system-start></system-start>" +
116+ "<system-end></system-end>" +
117+ "<valid-start>2014-08-19T00:00:02Z</valid-start>" +
118+ "<valid-end>2014-08-19T00:00:03Z</valid-end>" +
119+ "</test>" ;
120120 String doc3 = "<test>" +
121- uniqueBulkTerm + " doc3" +
122- "<system-start></system-start>" +
123- "<system-end></system-end>" +
124- "<valid-start>2014-08-19T00:00:03Z</valid-start>" +
125- "<valid-end>2014-08-19T00:00:04Z</valid-end>" +
126- "</test>" ;
121+ uniqueBulkTerm + " doc3" +
122+ "<system-start></system-start>" +
123+ "<system-end></system-end>" +
124+ "<valid-start>2014-08-19T00:00:03Z</valid-start>" +
125+ "<valid-end>2014-08-19T00:00:04Z</valid-end>" +
126+ "</test>" ;
127127 String doc4 = "<test>" +
128- uniqueBulkTerm + " doc4" +
129- "<system-start></system-start>" +
130- "<system-end></system-end>" +
131- "<valid-start>2014-08-19T00:00:05Z</valid-start>" +
132- "<valid-end>2014-08-19T00:00:06Z</valid-end>" +
133- "</test>" ;
128+ uniqueBulkTerm + " doc4" +
129+ "<system-start></system-start>" +
130+ "<system-end></system-end>" +
131+ "<valid-start>2014-08-19T00:00:05Z</valid-start>" +
132+ "<valid-end>2014-08-19T00:00:06Z</valid-end>" +
133+ "</test>" ;
134134 DocumentWriteSet writeSet = docMgr .newWriteSet ();
135135 writeSet .add (prefix + "_A.xml" , new StringHandle (doc1 ).withFormat (Format .XML ), temporalDocument1 );
136136 writeSet .add (prefix + "_B.xml" , new StringHandle (doc2 ).withFormat (Format .XML ), temporalDocument2 );
@@ -155,17 +155,17 @@ public void testBitemporalDocumentBulk() {
155155 @ Test
156156 public void testTemporalDocumentPatch () throws XpathException , SAXException , IOException {
157157 String doc1 = "<test>" +
158- uniqueTerm1 + " doc1" +
159- "<system-start></system-start>" +
160- "<system-end></system-end>" +
161- "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
162- "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
163- "<song>Here without you</song>" +
164- "</test>" ;
165-
158+ uniqueTerm1 + " doc1" +
159+ "<system-start></system-start>" +
160+ "<system-end></system-end>" +
161+ "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
162+ "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
163+ "<song>Here without you</song>" +
164+ "</test>" ;
165+
166166 StringHandle handle1 = new StringHandle (doc1 ).withFormat (Format .XML );
167167 docMgr .write (temporalDocument5 , null , handle1 , null , null , temporalCollection );
168-
168+
169169 DocumentPatchBuilder patchBldr = docMgr .newPatchBuilder ();
170170 patchBldr .insertFragment ("/test/song" , Position .AFTER , "<song>Kryptonite</song>" );
171171 DocumentPatchHandle patchHandle = patchBldr .build ();
@@ -175,7 +175,7 @@ public void testTemporalDocumentPatch() throws XpathException, SAXException, IOE
175175
176176 DocumentMetadataPatchBuilder metadatapatchBldr = docMgr .newPatchBuilder (Format .XML );
177177 DocumentPatchHandle metadatapatchHandle = metadatapatchBldr
178- .addMetadataValue ("key1" , "value1" ).build ();
178+ .addMetadataValue ("key1" , "value1" ).build ();
179179 docMgr .patch (temporalDocument5 , temporalCollection , metadatapatchHandle );
180180 String metadata = docMgr .readMetadata (temporalDocument5 , new StringHandle ().withFormat (Format .XML )).get ();
181181 assertXpathEvaluatesTo ("2" ,"count(/*[local-name()='metadata']/*[local-name()='metadata-values']/*[local-name()='metadata-value'])" ,metadata );
@@ -197,48 +197,48 @@ public void testTemporalDocumentPatch() throws XpathException, SAXException, IOE
197197
198198 @ Test
199199 public void testProtectWipe () throws DatatypeConfigurationException {
200- String protectDocID = "protectedDocument.xml" ;
201- String protectDocIDv2 = "protectedDocumentv2.xml" ;
202- String logicalID = "protectDocument.xml" ;
203- String doc1 = "<test>" +
204- "protect doc1" +
205- "<system-start></system-start>" +
206- "<system-end></system-end>" +
207- "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
208- "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
200+ String protectDocID = "protectedDocument.xml" ;
201+ String protectDocIDv2 = "protectedDocumentv2.xml" ;
202+ String logicalID = "protectDocument.xml" ;
203+ String doc1 = "<test>" +
204+ "protect doc1" +
205+ "<system-start></system-start>" +
206+ "<system-end></system-end>" +
207+ "<valid-start>2014-08-19T00:00:00Z</valid-start>" +
208+ "<valid-end>2014-08-19T00:00:01Z</valid-end>" +
209+ "</test>" ;
210+ String doc2 = "<test>" +
211+ "protect doc2" +
212+ "<system-start></system-start>" +
213+ "<system-end></system-end>" +
214+ "<valid-start>2014-08-19T00:00:01Z</valid-start>" +
215+ "<valid-end>2014-08-19T00:00:02Z</valid-end>" +
209216 "</test>" ;
210- String doc2 = "<test>" +
211- "protect doc2" +
212- "<system-start></system-start>" +
213- "<system-end></system-end>" +
214- "<valid-start>2014-08-19T00:00:01Z</valid-start>" +
215- "<valid-end>2014-08-19T00:00:02Z</valid-end>" +
216- "</test>" ;
217- StringHandle handle1 = new StringHandle (doc1 ).withFormat (Format .XML );
218- docMgr .write (protectDocID , logicalID , null , handle1 , null , null , temporalCollection );
219- StringHandle handle2 = new StringHandle (doc2 ).withFormat (Format .XML );
220- docMgr .write (protectDocIDv2 , logicalID , null , handle2 , null , null , temporalCollection );
221- docMgr .protect (logicalID , temporalCollection , ProtectionLevel .NOWIPE , DatatypeFactory .newInstance ().newDuration ("PT1S" ));
222- try {
223- Thread .sleep (1500 );
224- } catch (InterruptedException e ) {
225- e .printStackTrace ();
226- }
227- docMgr .wipe (logicalID , temporalCollection );
228- QueryManager queryMgr = Common .adminClient .newQueryManager ();
229- queryMgr .setPageLength (1000 );
230- QueryDefinition query = queryMgr .newStringDefinition ();
231- query .setCollections (logicalID );
232- SearchHandle handle = queryMgr .search (query , new SearchHandle ());
233- MatchDocumentSummary [] docs = handle .getMatchResults ();
234- assertEquals ("Incorrect number of docs" ,0 , docs .length );
217+ StringHandle handle1 = new StringHandle (doc1 ).withFormat (Format .XML );
218+ docMgr .write (protectDocID , logicalID , null , handle1 , null , null , temporalCollection );
219+ StringHandle handle2 = new StringHandle (doc2 ).withFormat (Format .XML );
220+ docMgr .write (protectDocIDv2 , logicalID , null , handle2 , null , null , temporalCollection );
221+ docMgr .protect (logicalID , temporalCollection , ProtectionLevel .NOWIPE , DatatypeFactory .newInstance ().newDuration ("PT1S" ));
222+ try {
223+ Thread .sleep (1500 );
224+ } catch (InterruptedException e ) {
225+ e .printStackTrace ();
235226 }
227+ docMgr .wipe (logicalID , temporalCollection );
228+ QueryManager queryMgr = Common .adminClient .newQueryManager ();
229+ queryMgr .setPageLength (1000 );
230+ QueryDefinition query = queryMgr .newStringDefinition ();
231+ query .setCollections (logicalID );
232+ SearchHandle handle = queryMgr .search (query , new SearchHandle ());
233+ MatchDocumentSummary [] docs = handle .getMatchResults ();
234+ assertEquals ("Incorrect number of docs" ,0 , docs .length );
235+ }
236236
237237 static public void cleanUp () throws DatatypeConfigurationException {
238238 String temporalDoc = "temporal-document" ;
239239 for (int i = 1 ; i < 6 ; i ++) {
240240 docMgr .protect (temporalDoc + i , temporalCollection , ProtectionLevel .NOWIPE ,
241- DatatypeFactory .newInstance ().newDuration ("PT1S" ));
241+ DatatypeFactory .newInstance ().newDuration ("PT1S" ));
242242 }
243243 try {
244244 Thread .sleep (1500 );
0 commit comments