本文整理汇总了Java中com.lordofthejars.nosqlunit.core.LoadStrategyEnum.DELETE_ALL属性的典型用法代码示例。如果您正苦于以下问题:Java LoadStrategyEnum.DELETE_ALL属性的具体用法?Java LoadStrategyEnum.DELETE_ALL怎么用?Java LoadStrategyEnum.DELETE_ALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.lordofthejars.nosqlunit.core.LoadStrategyEnum
的用法示例。
在下文中一共展示了LoadStrategyEnum.DELETE_ALL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newUserGetsSaved
@Test
@ShouldMatchDataSet(location = "/expectedResults/newUserGetsSaved.json")
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
@IgnorePropertyValue(properties = {"password"})
public void newUserGetsSaved() {
given()
.request()
.contentType("application/json")
.body("{" +
" \"email\": \"[email protected]\",\n" +
" \"password\": \"bob\",\n" +
" \"name\": \"john\"\n" +
"}")
.when()
.post("/rest/users/")
.then()
.statusCode(HttpStatus.OK.value());
}
示例2: showUsersFilterTEST
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.DELETE_ALL)
public void showUsersFilterTEST() throws Exception {
String result = mvc.perform(get("/api/user")
.param("q", "troia")
.contentType("application/json")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
JSONObject json = new JSONObject(result);
JSONObject emb = json.getJSONObject("_embedded");
JSONArray array = emb.getJSONArray("userList");
for (int i = 0; i < array.length(); i++) {
JSONObject j = array.getJSONObject(i);
assertTrue(j.getString("name").equals("Flavio Troia") || j.getString("name").equals("Silvio Troia"));
}
}
示例3: showUsersFilterTEST3
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.DELETE_ALL)
public void showUsersFilterTEST3() throws Exception {
String result = mvc.perform(get("/api/user")
.param("q", "tro")
.contentType("application/json")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
JSONObject json = new JSONObject(result);
JSONObject emb = json.getJSONObject("_embedded");
JSONArray array = emb.getJSONArray("userList");
for (int i = 0; i < array.length(); i++) {
JSONObject j = array.getJSONObject(i);
assertTrue(j.getString("name").equals("Flavio Troia") || j.getString("name").equals("Silvio Troia"));
}
}
示例4: showUsersFilterTEST2
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.DELETE_ALL)
public void showUsersFilterTEST2() throws Exception {
String result = mvc.perform(get("/api/user")
.param("q", "34733423322")
.contentType("application/json")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.userList",hasSize(is(1))))
.andReturn().getResponse().getContentAsString();
JSONObject json = new JSONObject(result);
JSONObject emb = json.getJSONObject("_embedded");
JSONArray array = emb.getJSONArray("userList");
for (int i = 0; i < array.length(); i++) {
JSONObject j = array.getJSONObject(i);
assertTrue(j.getString("name").equals("Flavio Troia"));
}
}
示例5: showUsersFilterTEST4
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.DELETE_ALL)
public void showUsersFilterTEST4() throws Exception {
String result = mvc.perform(get("/api/user")
.param("q", "Ingegnere")
.contentType("application/json")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.userList",hasSize(is(1))))
.andReturn().getResponse().getContentAsString();
JSONObject json = new JSONObject(result);
JSONObject emb = json.getJSONObject("_embedded");
JSONArray array = emb.getJSONArray("userList");
for (int i = 0; i < array.length(); i++) {
JSONObject j = array.getJSONObject(i);
assertTrue(j.getString("name").equals("Flavio Troia"));
}
}
示例6: showUsersFilterTEST5
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.DELETE_ALL)
public void showUsersFilterTEST5() throws Exception {
String result = mvc.perform(get("/api/user")
.param("q", "Club Andria")
.contentType("application/json")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.userList",hasSize(is(1))))
.andReturn().getResponse().getContentAsString();
JSONObject json = new JSONObject(result);
JSONObject emb = json.getJSONObject("_embedded");
JSONArray array = emb.getJSONArray("userList");
for (int i = 0; i < array.length(); i++) {
JSONObject j = array.getJSONObject(i);
assertTrue(j.getString("name").equals("Flavio Troia"));
}
}
示例7: showUsersFilterTEST6
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.DELETE_ALL)
public void showUsersFilterTEST6() throws Exception {
String result = mvc.perform(get("/api/user")
.param("q", "3473342")
.contentType("application/json")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.userList",hasSize(is(1))))
.andReturn().getResponse().getContentAsString();
JSONObject json = new JSONObject(result);
JSONObject emb = json.getJSONObject("_embedded");
JSONArray array = emb.getJSONArray("userList");
for (int i = 0; i < array.length(); i++) {
JSONObject j = array.getJSONObject(i);
assertTrue(j.getString("name").equals("Flavio Troia"));
}
}
示例8: shouldInsertOneDocumentWithEmbeddedDocument
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void shouldInsertOneDocumentWithEmbeddedDocument() throws IOException {
// given
final Bar bar = new BarBuilder().withStringField("jbar").withPrimitiveIntField(21)
.withEnumBar(EnumBar.BAR).build();
final Foo foo = new FooBuilder().withStringField("jdoe").withPrimitiveIntField(42)
.withEnumFoo(EnumFoo.FOO).withBar(bar).build();
// when
fooCollection.add(foo);
// then
assertThat(foo.getId()).isNotNull();
assertThat(
getMongoClient().getDatabase(DATABASE_NAME).getCollection(getCollectionName()).count())
.isEqualTo(1);
final Document createdDoc = getMongoClient().getDatabase(DATABASE_NAME)
.getCollection(getCollectionName()).find().first();
final Document barSubdoc = (Document) createdDoc.get("bar");
assertThat(barSubdoc).isNotNull();
assertThat(barSubdoc.get("_id")).as("Check embedded doc has no '_id' field").isNull();
}
示例9: shouldInsertOneDocumentWithBinaryData
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void shouldInsertOneDocumentWithBinaryData() throws IOException {
// given
final byte[] bytes = new byte[]{0,1,2,3,4,5,6,7,9};
final Foo foo = new FooBuilder().withStringField("jdoe").withPrimitiveIntField(42)
.withEnumFoo(EnumFoo.FOO).withBytes(bytes).build();
// when
fooCollection.add(foo);
// then
assertThat(foo.getId()).isNotNull();
assertThat(
getMongoClient().getDatabase(DATABASE_NAME).getCollection(getCollectionName()).count())
.isEqualTo(1);
final Document createdDoc = getMongoClient().getDatabase(DATABASE_NAME)
.getCollection(getCollectionName()).find().first();
final Binary retrievedBinaryContent = (Binary) createdDoc.get("raw_content");
assertThat(retrievedBinaryContent).isNotNull();
assertThat(retrievedBinaryContent.getData()).as("Check insertion of byte[]").isEqualTo(bytes);
}
示例10: shouldInsertTwoDocuments
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void shouldInsertTwoDocuments() throws IOException {
// given
final Bar bar1 = new BarBuilder().withStringField("jbar1").withPrimitiveIntField(21)
.withEnumBar(EnumBar.BAR).build();
final Foo foo1 = new FooBuilder().withStringField("jdoe1").withPrimitiveIntField(42)
.withEnumFoo(EnumFoo.FOO).withBar(bar1).build();
final Bar bar2 = new BarBuilder().withStringField("jbar2").withPrimitiveIntField(21)
.withEnumBar(EnumBar.BAR).build();
final Foo foo2 = new FooBuilder().withStringField("jdoe2").withPrimitiveIntField(42)
.withEnumFoo(EnumFoo.FOO).withBar(bar2).build();
// when
fooCollection.add(foo1, foo2);
// then
assertThat(foo1.getId()).isNotNull();
assertThat(
getMongoClient().getDatabase(DATABASE_NAME).getCollection(getCollectionName()).count())
.isEqualTo(2);
final Document createdDoc = getMongoClient().getDatabase(DATABASE_NAME)
.getCollection(getCollectionName()).find().first();
final Document barSubdoc = (Document) createdDoc.get("bar");
assertThat(barSubdoc).isNotNull();
assertThat(barSubdoc.get("_id")).as("Check embedded doc has no '_id' field").isNull();
}
示例11: shouldUpsertOneFooTwice
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void shouldUpsertOneFooTwice() throws IOException {
// given
// when
final Foo foo = new FooBuilder().withId(new ObjectId("54c28b0b0f2dacc85ede5286"))
.withStringField("jdoe").withPrimitiveIntField(42).withEnumFoo(EnumFoo.FOO).build();
fooCollection.upsert(foo);
final Foo foo2 = new FooBuilder().withId(new ObjectId("54c28b0b0f2dacc85ede5286")).withStringField("j.doe")
.withPrimitiveIntField(42).withEnumFoo(EnumFoo.FOO).build();
fooCollection.upsert(foo2);
// then
assertThat(
getMongoClient().getDatabase(DATABASE_NAME).getCollection(getCollectionName()).count())
.isEqualTo(1);
final Document createdDoc = getMongoClient().getDatabase(DATABASE_NAME)
.getCollection(getCollectionName()).find().first();
assertThat(createdDoc.get("stringField")).isNotNull().isEqualTo("j.doe");
}
示例12: shouldInsertDocumentWithBinaryField
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void shouldInsertDocumentWithBinaryField() throws IOException {
// given
// when
final Foo foo = new FooBuilder().withId(new ObjectId("54c28b0b0f2dacc85ede5286"))
.withBytes(new byte[]{1,2,3,4}).build();
fooCollection.add(foo);
// then
assertThat(
getMongoClient().getDatabase(DATABASE_NAME).getCollection(getCollectionName()).count())
.isEqualTo(1);
final Document createdDoc = getMongoClient().getDatabase(DATABASE_NAME)
.getCollection(getCollectionName()).find().first();
assertThat(createdDoc.get("raw_content")).isNotNull().isEqualTo(new Binary(new byte[]{1,2,3,4}));
final Foo foundFoo = fooCollection.all().first();
assertThat(foundFoo.getBytes()).isNotNull().isEqualTo(new byte[]{1,2,3,4});
}
示例13: shouldFindGeoWithinPolygon
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void shouldFindGeoWithinPolygon() throws IOException {
// when
final Polygon corners = new Polygon(new Location(40.70, -73.90), new Location(40.75, -73.90),
new Location(40.75, -73.95), new Location(40.70, -73.95));
final List<Foo> matches = fooCollection.filter(f -> f.location.geoWithin(corners)).toList();
// then
assertThat(matches).isNotNull().hasSize(4).are(new Condition<Foo>("Checking location is set") {
@Override
public boolean matches(final Foo item) {
return item.getLocation() != null && item.getLocation().getLatitude() != 0
&& item.getLocation().getLongitude() != 0;
}
});
}
示例14: testCountEmptyCollection
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
public void testCountEmptyCollection() throws Exception {
final long result = this.collectorService.count();
assertEquals(0, result);
}
示例15: testSaveFirstRecord
@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.DELETE_ALL)
@ShouldMatchDataSet(location = "collectorsSingleDataset.json")
@IgnorePropertyValue(properties = {"_id", "last_seen"})
public void testSaveFirstRecord() throws Exception {
final Collector collector = CollectorImpl.create("collectorId", "nodeId", "0.0.1", CollectorNodeDetails.create("DummyOS 1.0", null, null, null, null, null), DateTime.now(DateTimeZone.UTC));
final Collector result = this.collectorService.save(collector);
assertNotNull(result);
}