当前位置: 首页>>代码示例>>Java>>正文


Java LoadStrategyEnum.CLEAN_INSERT属性代码示例

本文整理汇总了Java中com.lordofthejars.nosqlunit.core.LoadStrategyEnum.CLEAN_INSERT属性的典型用法代码示例。如果您正苦于以下问题:Java LoadStrategyEnum.CLEAN_INSERT属性的具体用法?Java LoadStrategyEnum.CLEAN_INSERT怎么用?Java LoadStrategyEnum.CLEAN_INSERT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.lordofthejars.nosqlunit.core.LoadStrategyEnum的用法示例。


在下文中一共展示了LoadStrategyEnum.CLEAN_INSERT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findAllEventsByQueryDateTEST3

@Test
@UsingDataSet(locations={"LocationControllerTests.json", "UserControllerTests.json", "EventControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void findAllEventsByQueryDateTEST3() throws Exception {
	
	String result = mvc.perform(get("/api/event").contentType("application/json")
			.param("d1", "2016/04/03")
			.accept(MediaType.APPLICATION_JSON))
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();

	
	JSONObject json = new JSONObject(result);
	JSONObject emb = json.getJSONObject("_embedded");
	JSONArray array = emb.getJSONArray("eventList");
	for (int i = 0; i < array.length(); i++) {
		JSONObject j = array.getJSONObject(i);
		assertTrue(j.get("name").equals("SIPE 2016"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:19,代码来源:EventControllerTests.java

示例2: crateUserTEST

@Test
@UsingDataSet(locations={"RoleControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void crateUserTEST() throws Exception {
	
	String content = "{\"name\":\"Lolli Pop\", \"club\": {\"id\":\"56fab17ee4b074b1e6b6ca80\", \"name\":\"Rotary Club Andria Castelli Svevi\", \"address\":{\"ref\": \"Hotel L'Ottagono\", \"street\": \"via Barletta 138\", \"zipCode\":\"76123\", \"city\":\"Andria\", \"province\":\"BT\", \"country\":\"Italy\"}, \"logoId\":\"56fab17ee4b074b1e6b6cb79\", \"version\":\"0\"}, \"username\":\"lollipop\",\"password\":\"test\", \"member\":{\"firstName\" : \"Lolli\", \"lastName\" : \"Pop\", \"email\":\"[email protected]\"} }";
	JSONObject json = new JSONObject(content);
	
	mvc.perform(post("/api/user")
			.content(json.toString())
			.contentType("application/json")
			.accept(MediaType.parseMediaType("application/json"))
			)
	.andExpect(status().isCreated());
	
	User user = userService.findByUsername("lollipop");
	assertTrue(user.getMember().getEmail().equals("[email protected]"));
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:17,代码来源:UserControllerTests.java

示例3: updateWithImageTEST

@Test
@UsingDataSet(locations={"AttachControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void updateWithImageTEST() throws Exception {
	FileInputStream fis = new FileInputStream("src/main/resources/static/flavio.jpeg");
	MockMultipartFile data = new MockMultipartFile("file","flavio.jpeg", "image/jpeg", fis);

	UsernamePasswordAuthenticationToken principal = this.getPrincipal("flavio");

	User user = userService.findOne(new ObjectId("56fab17ee4b074b1e6b6cb01"));
	ObjectId photoId = user.getMember() == null ? null : user.getMember().getPhotoId();

	String result = mvc.perform(MockMvcRequestBuilders.fileUpload("/api/member/56fab17ee4b074b1e6b6cb01/image").file(data)
			.accept(MediaType.APPLICATION_JSON).principal(principal))
			.andDo(print())
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();

	JSONObject json = new JSONObject(result);
	JSONObject member = json.getJSONObject("member");
	assertTrue(member.get("photoId")!=photoId.toString());
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:21,代码来源:MemberControllerTests.java

示例4: updateWithImageTEST3

@Test
@UsingDataSet(locations={"AttachControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void updateWithImageTEST3() throws Exception {
	FileInputStream fis = new FileInputStream("src/main/resources/static/flavio2.jpg");
	MockMultipartFile data = new MockMultipartFile("file","flavio2.jpg", "image/jpeg", fis);

	UsernamePasswordAuthenticationToken principal = this.getPrincipal("flavio");

	User silvio = userService.findOne(new ObjectId("56fab17ee4b074b1e6b6cb02"));
	ObjectId photoId = silvio.getMember() == null ? null : silvio.getMember().getPhotoId();

	String result = mvc.perform(MockMvcRequestBuilders.fileUpload("/api/member/56fab17ee4b074b1e6b6cb02/image").file(data)
			.accept(MediaType.APPLICATION_JSON).principal(principal))
			.andDo(print())
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();

	JSONObject json = new JSONObject(result);
	JSONObject member = json.getJSONObject("member");
	assertTrue(member.get("photoId")!=photoId.toString());
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:21,代码来源:MemberControllerTests.java

示例5: showClubsTEST

@Test
@UsingDataSet(locations={"ClubControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void showClubsTEST() throws Exception {
	String result = mvc.perform(get("/api/club")
			.param("q", "Cas")
			.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("clubList");
	for (int i = 0; i < array.length(); i++) {
		JSONObject j = array.getJSONObject(i);
		assertTrue(j.get("name").toString().contains("Castelli Svevi"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:18,代码来源:ClubControllerTests.java

示例6: findAllEventsByQueryDateTEST5

@Test
@UsingDataSet(locations={"LocationControllerTests.json", "UserControllerTests.json", "EventControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void findAllEventsByQueryDateTEST5() throws Exception {
	
	String result = mvc.perform(get("/api/event/timeline").contentType("application/json")
			.param("d1", "2016/04/01")
			.param("d2", "2016/04/01")
			.accept(MediaType.APPLICATION_JSON))
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();

	
	JSONObject json = new JSONObject(result);
	JSONObject emb = json.getJSONObject("_embedded");
	JSONArray array = emb.getJSONArray("eventList");
	assertTrue(array.length() == 1);
	for (int i = 0; i < array.length(); i++) {
		JSONObject j = array.getJSONObject(i);
		assertTrue(j.get("name").equals("SIPE 2016"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:21,代码来源:EventControllerTests.java

示例7: removeBookingTEST

@Test
@UsingDataSet(locations={"AttachControllerTests.json", "EventControllerTests.json", "UserControllerTests.json", "ClubControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void removeBookingTEST() throws Exception {
	UsernamePasswordAuthenticationToken principal = this.getPrincipal("flavio");

	String result = mvc.perform(MockMvcRequestBuilders.post("/api/event/5718ec5c3fa7db28901eeb9a/booking")
			.accept(MediaType.APPLICATION_JSON).principal(principal))
			.andDo(print())
			.andExpect(status().isCreated())
			.andReturn().getResponse().getContentAsString();

	JSONObject json = new JSONObject(result);
	JSONArray array = json.getJSONArray("booking");
	assertTrue(array.length() == 1);
	
	result = mvc.perform(MockMvcRequestBuilders.delete("/api/event/5718ec5c3fa7db28901eeb9a/booking")
			.accept(MediaType.APPLICATION_JSON).principal(principal))
			.andDo(print())
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();
	
	JSONObject json2 = new JSONObject(result);
	JSONArray array2 = json2.getJSONArray("booking");
	assertTrue(array2.length() == 0);
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:25,代码来源:EventControllerTests.java

示例8: showClubsTEST

@Test
@UsingDataSet(locations={"ClubControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void showClubsTEST() throws Exception {
	String result = mvc.perform(get("/club")
			.param("q", "cas")
			.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("clubList");
	for (int i = 0; i < array.length(); i++) {
		JSONObject j = array.getJSONObject(i);
		assertTrue(j.get("name").toString().contains("Castelli Svevi"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:18,代码来源:AccessControllerTests.java

示例9: updateWithImageTEST

@Test
@UsingDataSet(locations={"AttachControllerTests.json", "UserControllerTests.json", "ClubControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void updateWithImageTEST() throws Exception {
	FileInputStream fis = new FileInputStream("src/main/resources/static/logo.jpg");
	MockMultipartFile data = new MockMultipartFile("file","logo.jpg", "image/jpeg", fis);

	UsernamePasswordAuthenticationToken principal = this.getPrincipal("flavio");

	String result = mvc.perform(MockMvcRequestBuilders.fileUpload("/api/club/56fab17ee4b074b1e6b6ca80/image").file(data)
			.accept(MediaType.APPLICATION_JSON).principal(principal))
			.andDo(print())
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();

	JSONObject json = new JSONObject(result);
	assertTrue(json.get("logoId")!=null);
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:17,代码来源:ClubControllerTests.java

示例10: showUsersTEST

@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void showUsersTEST() throws Exception {
	String result = mvc.perform(get("/api/user").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.get("username")!=null);
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:16,代码来源:UserControllerTests.java

示例11: shouldReplaceDocument

@Test
@UsingDataSet(loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
@ShouldMatchDataSet()
public void shouldReplaceDocument() {
  // given
  final BlogEntry blogEntry =
      blogEntryCollection.filter(e -> e.id.equals("1") && e.authorName.equals("jdoe")).first();
  Assertions.assertThat(blogEntry).isNotNull();
  blogEntry.setAuthorName("John Doe");
  blogEntry.setContent("Updating documents...");
  final GregorianCalendar gregorianCalendar = new GregorianCalendar(2015, 05, 07, 16, 40, 0);
  gregorianCalendar.setTimeZone(TimeZone.getTimeZone("GMT"));
  final Date publishDate = gregorianCalendar.getTime();
  blogEntry.setPublishDate(publishDate);
  final List<String> tags = Arrays.asList("doc", "update");
  blogEntry.setTags(tags);
  // when
  blogEntryCollection.replace(blogEntry);
  // then... let NoSqlUnit perform post-update assertions using the file given in the
  // @ShouldMatchDataSet
  // annotation
}
 
开发者ID:lambdamatic,项目名称:lambdamatic-project,代码行数:22,代码来源:MongoUpdateTest.java

示例12: testCountNonEmptyCollection

@Test
@UsingDataSet(locations = "collectorsMultipleDocuments.json", loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testCountNonEmptyCollection() throws Exception {
    final long result = this.collectorService.count();

    assertEquals(3, result);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:7,代码来源:CollectorServiceImplTest.java

示例13: testFindByIdNonexisting

@Test
@UsingDataSet(locations = "collectorsMultipleDocuments.json", loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testFindByIdNonexisting() throws Exception {
    final String collector1id = "nonexisting";

    final Collector collector = this.collectorService.findById(collector1id);

    assertNull(collector);
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:9,代码来源:CollectorServiceImplTest.java

示例14: testFindByNodeId

@Test
@UsingDataSet(locations = "collectorsMultipleDocuments.json", loadStrategy = LoadStrategyEnum.CLEAN_INSERT)
public void testFindByNodeId() throws Exception {
    final String nodeId = "uniqueid1";

    final List<Collector> collectors = this.collectorService.findByNodeId(nodeId);

    assertNotNull(collectors);
    assertEquals(1, collectors.size());

    for (Collector collector : collectors) {
        assertNotNull(collector);
        assertEquals(nodeId, collector.getNodeId());
    }
}
 
开发者ID:Graylog2,项目名称:graylog-plugin-collector,代码行数:15,代码来源:CollectorServiceImplTest.java

示例15: forgotPasswordTEST

@Test
@UsingDataSet(locations={"RoleControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void forgotPasswordTEST() throws Exception {
	
	mvc.perform(post("/forgot_password")
			.param("username", "flavio")
			.contentType("application/x-www-form-urlencoded; charset=UTF-8")
			.accept(MediaType.parseMediaType("application/json"))
			)
	.andExpect(status().isOk());
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:11,代码来源:AccessControllerTests.java


注:本文中的com.lordofthejars.nosqlunit.core.LoadStrategyEnum.CLEAN_INSERT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。