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


Java LoadStrategyEnum类代码示例

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


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

示例1: newUserGetsSaved

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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());
}
 
开发者ID:hollannikas,项目名称:ssoidh,代码行数:19,代码来源:UserControllerIT.java

示例2: updateWithImageTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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,代码行数:22,代码来源:MemberControllerTests.java

示例3: updateWithImageTEST2

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void updateWithImageTEST2() 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 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,代码行数:22,代码来源:MemberControllerTests.java

示例4: updateWithImageTEST3

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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,代码行数:22,代码来源:MemberControllerTests.java

示例5: showClubsTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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,代码行数:19,代码来源:ClubControllerTests.java

示例6: updateClubTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@Test
@UsingDataSet(locations={"ClubControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void updateClubTEST() throws Exception {

	String content = "{\"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\"}, \"website\" : \"http://www.rotaryandria.it\", \"email\" : \"[email protected]\", \"version\": \"0\"}";
	JSONObject json = new JSONObject(content);

	String result = mvc.perform(put("/api/club/56fab17ee4b074b1e6b6ca80")
			.content(json.toString())
			.contentType("application/json")
			.accept(MediaType.APPLICATION_JSON))
			.andExpect(status().isOk())
			.andReturn().getResponse().getContentAsString();

	json = new JSONObject(result);
	assertTrue(json.getString("version").equals("1"));
	assertTrue(json.getString("email").equals("[email protected]"));
	assertTrue(json.getString("website").equals("http://www.rotaryandria.it"));
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:20,代码来源:ClubControllerTests.java

示例7: updateWithImageTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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,代码行数:18,代码来源:ClubControllerTests.java

示例8: showUsersTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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,代码行数:17,代码来源:UserControllerTests.java

示例9: showUsersAdminTEST2

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@Test
@UsingDataSet(locations={"AttachControllerTests.json", "ClubControllerTests.json", "UserControllerTests.json"}, loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void showUsersAdminTEST2() throws Exception {
	UsernamePasswordAuthenticationToken principal = this.getPrincipal("flavio");
	
	String result = mvc.perform(get("/api/user").contentType("application/json")
			.accept(MediaType.APPLICATION_JSON).principal(principal))
			.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,代码行数:19,代码来源:UserControllerTests.java

示例10: showUsersFilterTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:19,代码来源:UserControllerTests.java

示例11: showUsersFilterTEST3

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:19,代码来源:UserControllerTests.java

示例12: showUsersFilterTEST2

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:20,代码来源:UserControllerTests.java

示例13: showUsersFilterTEST4

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:20,代码来源:UserControllerTests.java

示例14: showUsersFilterTEST5

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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"));
	}
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:20,代码来源:UserControllerTests.java

示例15: crateUserTEST

import com.lordofthejars.nosqlunit.core.LoadStrategyEnum; //导入依赖的package包/类
@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,代码行数:18,代码来源:UserControllerTests.java


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