Skip to content

Commit dc793b5

Browse files
committed
fix #687 - clean up indenting in tests
(cherry picked from commit a81ee6a)
1 parent 996a81d commit dc793b5

File tree

106 files changed

+12922
-12991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+12922
-12991
lines changed

src/test/java/com/marklogic/client/test/AlertingTest.java

Lines changed: 417 additions & 409 deletions
Large diffs are not rendered by default.

src/test/java/com/marklogic/client/test/BinaryDocumentTest.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -38,49 +38,49 @@
3838
import com.marklogic.client.io.InputStreamHandle;
3939

4040
public class BinaryDocumentTest {
41-
@BeforeClass
42-
public static void beforeClass() {
43-
Common.connect();
44-
//System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
45-
}
46-
@AfterClass
47-
public static void afterClass() {
48-
}
41+
@BeforeClass
42+
public static void beforeClass() {
43+
Common.connect();
44+
//System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
45+
}
46+
@AfterClass
47+
public static void afterClass() {
48+
}
4949

50-
// a simple base64-encoded binary
51-
final static public String ENCODED_BINARY =
52-
"iVBORw0KGgoAAAANSUhEUgAAAA0AAAATCAYAAABLN4eXAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oIEQEjMtAYogQAAAKvSURBVCjPlZLLbhxFAEVPVVdXVz/G8zCOn0CsKGyQkSIIKzas8xfsWbLkp/gJhCKheIlAJDaj2MYez6u7p7vrxQKUPVc6+yOdK77/4cfXQohJqlOVZdmBSpKY6jQKBM45oVMlgHvrvMuNWRljvlNKq69G2YyqLDg4mLE/2yPNYFRWlFXF/nTC2clRWbc7Fss1IcZzqTA8eWY5eu7p1Hv+WvyBVjnGZOQmI9UKISUqSXDO0bS7Tko0xfGSp18kjM7v+P3+NUMr8T5grWMYLCEErHM474khoCw1t78eU/8mEOpjXpxekJUORIZSCbkxSCnRWpPnBikTqbx31E1DjJHpeIzRhnW9xceI857H5Yr1Zku765jf3DIMtlUAIQRCiFhnabsOH1IEAmstAGWRY11ApykmM0oplTKZjNGZREpJoUueHI0ZFRV7exX7+1Nm0yn9YLm5u2fX96lUseLwxQ0vX8H04i2/XP9Et5H44OkHS920hBDo+56u77GDjcrHjvV1ya3TDO2M01mOUAEAhED+R5IkpKmCiFCOjoc/p+xuLbPpCc+P95HaEqIBIhHoB8t2W/PwsKBudl5FH7GxwUYYouJh5ci7nLbtWW02LBaPvLuef1AdrItKKolJpkivwGrG5QxTCsq8pCxLqqrk7PiIwTmW6y0xRCVTSg4vFnz+raM4+5ur1RtSUZHnOUWeMx5VVFWJTlOstfTWRuk96NIyOUgRRc188RZvgRg/3OffjoFESohxUMvmjqufP+X+MqDTU77+5EvMKKBUQpZpijxHSkluDHvjMW8uL79Rnz07bwSyzDLFqCzwDNw/PNI0O9bbhvVmQ7vb0bQdi+Wq327rl+rko8krodKnCHnofJju+r5oupBstg1KJT7Vuruev185O9zVm/WVUmouYoz83/0DxhRmafe2kasAAAAASUVORK5CYII=";
53-
final static public byte[] BYTES_BINARY = DatatypeConverter.parseBase64Binary(ENCODED_BINARY);
50+
// a simple base64-encoded binary
51+
final static public String ENCODED_BINARY =
52+
"iVBORw0KGgoAAAANSUhEUgAAAA0AAAATCAYAAABLN4eXAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oIEQEjMtAYogQAAAKvSURBVCjPlZLLbhxFAEVPVVdXVz/G8zCOn0CsKGyQkSIIKzas8xfsWbLkp/gJhCKheIlAJDaj2MYez6u7p7vrxQKUPVc6+yOdK77/4cfXQohJqlOVZdmBSpKY6jQKBM45oVMlgHvrvMuNWRljvlNKq69G2YyqLDg4mLE/2yPNYFRWlFXF/nTC2clRWbc7Fss1IcZzqTA8eWY5eu7p1Hv+WvyBVjnGZOQmI9UKISUqSXDO0bS7Tko0xfGSp18kjM7v+P3+NUMr8T5grWMYLCEErHM474khoCw1t78eU/8mEOpjXpxekJUORIZSCbkxSCnRWpPnBikTqbx31E1DjJHpeIzRhnW9xceI857H5Yr1Zku765jf3DIMtlUAIQRCiFhnabsOH1IEAmstAGWRY11ApykmM0oplTKZjNGZREpJoUueHI0ZFRV7exX7+1Nm0yn9YLm5u2fX96lUseLwxQ0vX8H04i2/XP9Et5H44OkHS920hBDo+56u77GDjcrHjvV1ya3TDO2M01mOUAEAhED+R5IkpKmCiFCOjoc/p+xuLbPpCc+P95HaEqIBIhHoB8t2W/PwsKBudl5FH7GxwUYYouJh5ci7nLbtWW02LBaPvLuef1AdrItKKolJpkivwGrG5QxTCsq8pCxLqqrk7PiIwTmW6y0xRCVTSg4vFnz+raM4+5ur1RtSUZHnOUWeMx5VVFWJTlOstfTWRuk96NIyOUgRRc188RZvgRg/3OffjoFESohxUMvmjqufP+X+MqDTU77+5EvMKKBUQpZpijxHSkluDHvjMW8uL79Rnz07bwSyzDLFqCzwDNw/PNI0O9bbhvVmQ7vb0bQdi+Wq327rl+rko8krodKnCHnofJju+r5oupBstg1KJT7Vuruev185O9zVm/WVUmouYoz83/0DxhRmafe2kasAAAAASUVORK5CYII=";
53+
final static public byte[] BYTES_BINARY = DatatypeConverter.parseBase64Binary(ENCODED_BINARY);
5454

55-
@Test
56-
public void testReadWrite() throws IOException, XpathException {
57-
String docId = "/test/binary-sample.png";
58-
String mimetype = "image/png";
55+
@Test
56+
public void testReadWrite() throws IOException, XpathException {
57+
String docId = "/test/binary-sample.png";
58+
String mimetype = "image/png";
5959

60-
BinaryDocumentManager docMgr = Common.client.newBinaryDocumentManager();
61-
docMgr.setMetadataExtraction(MetadataExtraction.PROPERTIES);
62-
docMgr.write(docId, new BytesHandle().with(BYTES_BINARY).withMimetype(mimetype));
60+
BinaryDocumentManager docMgr = Common.client.newBinaryDocumentManager();
61+
docMgr.setMetadataExtraction(MetadataExtraction.PROPERTIES);
62+
docMgr.write(docId, new BytesHandle().with(BYTES_BINARY).withMimetype(mimetype));
6363

64-
DocumentDescriptor desc = docMgr.exists(docId);
65-
assertTrue("Binary exists did not get number of bytes",
66-
desc.getByteLength() != DocumentDescriptor.UNKNOWN_LENGTH);
67-
assertEquals("Binary exists got wrong number of bytes", BYTES_BINARY.length, desc.getByteLength());
64+
DocumentDescriptor desc = docMgr.exists(docId);
65+
assertTrue("Binary exists did not get number of bytes",
66+
desc.getByteLength() != DocumentDescriptor.UNKNOWN_LENGTH);
67+
assertEquals("Binary exists got wrong number of bytes", BYTES_BINARY.length, desc.getByteLength());
6868

69-
byte[] buf = docMgr.read(docId, new BytesHandle()).get();
70-
assertEquals("Binary document read wrong number of bytes", BYTES_BINARY.length, buf.length);
69+
byte[] buf = docMgr.read(docId, new BytesHandle()).get();
70+
assertEquals("Binary document read wrong number of bytes", BYTES_BINARY.length, buf.length);
7171

72-
buf = Common.streamToBytes(docMgr.read(docId, new InputStreamHandle()).get());
73-
assertTrue("Binary document read binary empty input stream",buf.length > 0);
72+
buf = Common.streamToBytes(docMgr.read(docId, new InputStreamHandle()).get());
73+
assertTrue("Binary document read binary empty input stream",buf.length > 0);
7474

75-
BytesHandle handle = new BytesHandle();
76-
buf = docMgr.read(docId, handle, 9, 10).get();
77-
assertEquals("Binary range read wrong number of bytes", 10, buf.length);
78-
assertEquals("Binary range did not set length in handle", 10, handle.getByteLength());
75+
BytesHandle handle = new BytesHandle();
76+
buf = docMgr.read(docId, handle, 9, 10).get();
77+
assertEquals("Binary range read wrong number of bytes", 10, buf.length);
78+
assertEquals("Binary range did not set length in handle", 10, handle.getByteLength());
7979

80-
docMgr.setMetadataCategories(Metadata.PROPERTIES);
81-
Document metadataDocument = docMgr.readMetadata(docId, new DOMHandle()).get();
82-
assertXpathEvaluatesTo("image/png","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='content-type'])", metadataDocument);
83-
assertXpathEvaluatesTo("text HD-HTML","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='filter-capabilities'])", metadataDocument);
84-
assertXpathEvaluatesTo("815","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='size'])", metadataDocument);
85-
}
80+
docMgr.setMetadataCategories(Metadata.PROPERTIES);
81+
Document metadataDocument = docMgr.readMetadata(docId, new DOMHandle()).get();
82+
assertXpathEvaluatesTo("image/png","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='content-type'])", metadataDocument);
83+
assertXpathEvaluatesTo("text HD-HTML","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='filter-capabilities'])", metadataDocument);
84+
assertXpathEvaluatesTo("815","string(/*[local-name()='metadata']/*[local-name()='properties']/*[local-name()='size'])", metadataDocument);
85+
}
8686
}

src/test/java/com/marklogic/client/test/BitemporalFeaturesTest.java

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)