• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UsingDataSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: shouldDeleteItinerary

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = {"itinerary.yml","schedule.yml","guests.json","sectors.json", "flight.json"})
  public void shouldDeleteItinerary() {

 given()
        .contentType(ContentType.JSON)
    .when()
           .delete(basePath+"webapi/itineraries/1")  //dataset has itinerary with id =1
    .then()
           .statusCode(Status.NO_CONTENT.getStatusCode());

   //id 1 should not be in db anymore
given()
.when()
        .get(basePath + "webapi/itineraries")
   .then()
           .statusCode(Status.OK.getStatusCode())
           .body("", hasSize(0));

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:21,代码来源:ItineraryRestServiceTest.java


示例2: shouldFindFlight

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
 @UsingDataSet(value = {"sectors.json", "flight.json"})
 public void shouldFindFlight() {

 	String json = given().
	when().
			get(basePath+"webapi/flights/1"). //dataset has flight with id =1
	then().
			statusCode(Status.OK.getStatusCode()).
			body("id", equalTo(1)).
			body("name", equalTo("AA056")).extract().asString();

try (JsonReader reader = Json.createReader(new StringReader(json))) {
    JsonObject jsonObject = reader.readObject();
    assertEquals("AA056", jsonObject.getString("name"));
}
 }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:18,代码来源:FlightRestServiceTest.java


示例3: shouldDeleteFlight

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = {"sectors.json", "flight.json"})
  public void shouldDeleteFlight() {

 given().
        	contentType(ContentType.JSON).
    when().
        	delete(basePath+"webapi/flights/1").  //dataset has flight with id =1
    then().
        	statusCode(Status.NO_CONTENT.getStatusCode());

   //AA056 should not be in db anymore
given().
   when().
        	get(basePath + "webapi/flights").
   then().
        	statusCode(Status.OK.getStatusCode()).
        	body("", hasSize(0)).
        	body("name", not(hasItem("AA056")));

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:22,代码来源:FlightRestServiceTest.java


示例4: shouldFindSector

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = { "sectors.json" })
public void shouldFindSector() {

	String json = given()
			.when()
				.get(basePath + "webapi/sectors/1"). // dataset has sector with id =1
			then().statusCode(Status.OK.getStatusCode())
				.body("id", equalTo(1))
				.body("sector", equalTo("BLR")).extract().asString();

	try (JsonReader reader = Json.createReader(new StringReader(json))) {
		JsonObject jsonObject = reader.readObject();
		assertEquals("BLR", jsonObject.getString("sector"));
	}
}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:17,代码来源:SectorRestServiceTest.java


示例5: shouldUpdateSector

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = { "sectors.json" })
public void shouldUpdateSector() {

	JsonObject sectorToUpdate = Json.createObjectBuilder()
								.add("id", 1)
								.add("sector", "FL")
								.build();

	given().content(sectorToUpdate.toString())
		   .contentType("application/json")
	.when()
			.put(basePath + "webapi/sectors/1"). // dataset has sector with id =1
	then()
	        .statusCode(Status.NO_CONTENT.getStatusCode());

}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:18,代码来源:SectorRestServiceTest.java


示例6: shouldDeleteSector

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = { "sectors.json" })
public void shouldDeleteSector() {

	given().contentType(ContentType.JSON).when()
			.delete(basePath + "webapi/sectors/1"). // dataset has sector
													// with id =1
			then().statusCode(Status.NO_CONTENT.getStatusCode());

	// BLR should not be in db anymore
	given()
	.when()
			.get(basePath + "webapi/sectors")
	.then()
			.statusCode(Status.OK.getStatusCode())
			.body("", hasSize(3))
			.body("sector", not(hasItem("BLR")));

}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:20,代码来源:SectorRestServiceTest.java


示例7: shouldListGuests

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = { "guests.json" })
  public void shouldListGuests() {

System.out.println(basePath+"webapi/guests");

given()
.when()
		.get(basePath+"webapi/guests")
.then()
		.statusCode(Status.OK.getStatusCode())
		.body("", hasSize(2))
		.body("firstname", hasItem("Frank"))
		.body("lastname", hasItem("Jennings"));

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:17,代码来源:GuestRestServiceTest.java


示例8: shouldFindGuest

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = { "guests.json" })
  public void shouldFindGuest() {
String json = given().
				when().
						get(basePath + "webapi/guests/1"). //dataset has guest with id =1
				then().
						statusCode(Status.OK.getStatusCode()).
						body("id", equalTo(1)).
						body("firstname", equalTo("Frank")).
						body("lastname", equalTo("Jennings")).extract().asString();

try (JsonReader reader = Json.createReader(new StringReader(json))) {
    JsonObject jsonObject = reader.readObject();
    assertEquals("Jennings", jsonObject.getString("lastname"));
}

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:19,代码来源:GuestRestServiceTest.java


示例9: shouldFailToCreateGuestWithoutName

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test @Ignore
 @UsingDataSet(value = { "guests.json" })
 public void shouldFailToCreateGuestWithoutName() {

JsonObject guestToCreate = Json.createObjectBuilder()
							  .add("lastname","Lovelace")
							  .build();

given().
          content(guestToCreate.toString()).
          contentType("application/json")

   .expect()
             .statusCode(Status.BAD_REQUEST.getStatusCode())

  .when().
          post(basePath+"webapi/guests");


 }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:21,代码来源:GuestRestServiceTest.java


示例10: shouldFailToCreateGuestWithNonUniqueName

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test @Ignore
  @UsingDataSet(value = { "guests.json" })
  public void shouldFailToCreateGuestWithNonUniqueName() {

	JsonObject guestToCreate = Json.createObjectBuilder()
                		  .add("firstname", "Frank")
                		  .add("lastname","Jennings")
                		  .build();


given().
            content(guestToCreate.toString()).
            contentType("application/json").
   when().
       	post(basePath+"webapi/guests").
   then().
       	statusCode(Status.BAD_REQUEST.getStatusCode()).
       	body("message", equalTo("Guest firstname must be unique"));
  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:20,代码来源:GuestRestServiceTest.java


示例11: shouldUpdateGuest

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = { "guests.json" })
  public void shouldUpdateGuest() {

JsonObject guestToUpdate = Json.createObjectBuilder()
							  .add("id", 1)
	                		  .add("firstname", "Frank updated")
	                		  .add("lastname","Jennings updated")
	                		  .build();

given().
       	content(guestToUpdate.toString()).
       	contentType("application/json").
   when().
       	put(basePath+"webapi/guests/1").  //dataset has guest with id =1
   then().
       	statusCode(Status.NO_CONTENT.getStatusCode());

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:20,代码来源:GuestRestServiceTest.java


示例12: shouldDeleteGuest

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = { "guests.json" })
  public void shouldDeleteGuest() {

 given().
        	contentType(ContentType.JSON).
    when().
        	delete(basePath+"webapi/guests/1").  //dataset has guest with id =1
    then().
        	statusCode(Status.NO_CONTENT.getStatusCode());

   //Frank should not be in db anymore
given().
   when().
        	get(basePath + "webapi/guests").
   then().
        	statusCode(Status.OK.getStatusCode()).
        	body("", hasSize(1)).
        	body("firstname", not(hasItem("Frank")));

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:22,代码来源:GuestRestServiceTest.java


示例13: shouldDeleteSchedule

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
  @UsingDataSet(value = {"schedule.yml","guests.json","sectors.json", "flight.json"})
  public void shouldDeleteSchedule() {

 given().
        	contentType(ContentType.JSON).
    when().
        	delete(basePath+"webapi/schedules/1").  //dataset has schedule with id =1
    then().
        	statusCode(Status.NO_CONTENT.getStatusCode());

   //id 1 should not be in db anymore
given().
   when().
        	get(basePath + "webapi/schedules").
   then().
        	statusCode(Status.OK.getStatusCode()).
        	body("", hasSize(0));

  }
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:21,代码来源:ScheduleRestServiceTest.java


示例14: repositoryFinderTest

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@OperateOnDeployment("test-candidate")
@UsingDataSet("datasets/SampleRepositoryIT.xml")
public void repositoryFinderTest() {
    assertThat(repository).isNotNull();
    assertThat(repository.findById(1l)).isNotNull().isInstanceOf(Sample.class);
    assertThat(repository.findById(1).getName()).isEqualTo("bodo");
    assertThat(repository.findById(2).getName()).isEqualTo("duke");
    assertThat(repository.findAllByQuery()).hasSize(15).onProperty("name").contains("bodo", "duke");
    assertThat(repository.findAll()).hasSize(15).onProperty("name").contains("bodo", "duke");
    assertThat(repository.getSampleCount()).isEqualTo(15l);
    assertThat(repository.getSampleName(2l)).isEqualTo("duke");
    assertThat(repository.findAllPagedWithDefaultPageSize(5)).hasSize(10).onProperty("name").excludes("bodo", "duke", "robert", "martin", "nadja");
    assertThat(repository.findAllPagedWithDynamicPageSize(2, 3)).hasSize(3).onProperty("name").containsOnly("robert", "martin", "nadja");

    assertThat(repository.getSampleString(1l)).isEqualTo("bodo::1");

    try {
        repository.findByIdWithException(200l);
        fail("must throw MyException!");
    } catch (MyException ex) {
        System.out.println(String.format("Correct exception caught: %s (%s)", ex.getClass().getSimpleName(), ex.getMessage()));
    }
}
 
开发者ID:etecture,项目名称:dynamic-repositories,代码行数:25,代码来源:SampleRepositoryIT.java


示例15: shouldUpdateEntity

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet("datasets/before_update.xml")
@ShouldMatchDataSet("datasets/after_update.xml")
@InSequence(2)
public void shouldUpdateEntity() throws Exception {        // <5>
    MyEntity myentity = em.find(MyEntity.class, "Key 1");
    myentity.setValue("Another Value 1");
}
 
开发者ID:robertpanzer,项目名称:persistence-test,代码行数:9,代码来源:PersistenceTest.java


示例16: shouldMakeACleanup

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet("datasets/seats.yml")
@ShouldMatchDataSet("datasets/expected-seats.yml")
public void shouldMakeACleanup() throws Exception {
    // given
    // from annotation

    // when
    ticketService.doCleanUp();

    // then
    // from annotation
}
 
开发者ID:packt-wildfly,项目名称:packt-java-ee-7-code-samples,代码行数:14,代码来源:TicketServiceTest.java


示例17: save_NewSchedule_ShouldBeCreated

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = {"guests.json","sectors.json", "flight.json"})
@ShouldMatchDataSet(value = {"schedule.yml"}, excludeColumns = {"id"})
public void save_NewSchedule_ShouldBeCreated() throws Exception {

    Guest guest = guestService.find(Guest.class, 1);
    Flight flight = flightService.find(Flight.class, 1);

    Schedule saved = scheduleService.create(createSchedule(flight, guest));

    assertNotNull(saved);
    assertNotNull(saved.getId());
}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:14,代码来源:ScheduleServiceTest.java


示例18: shouldUpdateSchedule

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = {"schedule.yml","guests.json","sectors.json", "flight.json"})
@ShouldMatchDataSet(value = {"schedule_updated.yml"}, excludeColumns = {"id"})
public void shouldUpdateSchedule(){

	 Schedule schedule = scheduleService.find(Schedule.class, 1);

	 schedule.setScheduleDate(LocalDate.of(2016,9,14));

	 scheduleService.edit(schedule);
}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:12,代码来源:ScheduleServiceTest.java


示例19: get_ExistingSchedule_Found

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = {"schedule.yml","guests.json","sectors.json", "flight.json"})
@ShouldMatchDataSet(value = {"schedule.yml"}, excludeColumns = {"id"})
public void get_ExistingSchedule_Found() throws Exception {

    Schedule schedule = scheduleService.find(Schedule.class, 1);
    assertNotNull(schedule);
}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:9,代码来源:ScheduleServiceTest.java


示例20: save_NewItinerary_ShouldBeCreated

import org.jboss.arquillian.persistence.UsingDataSet; //导入依赖的package包/类
@Test
@UsingDataSet(value = {"schedule.yml","guests.json","sectors.json", "flight.json"})
@ShouldMatchDataSet(value = {"itinerary.yml"}, excludeColumns = {"id"})
public void save_NewItinerary_ShouldBeCreated() throws Exception {

    Guest guest = guestService.find(Guest.class, 1);
    Flight flight = flightService.find(Flight.class, 1);
    Schedule schedule = scheduleService.find(Schedule.class, 1);

    Itinerary  saved =  itineraryService.createItinerary(createItinerary(flight, guest, schedule));

    assertNotNull(saved);
    assertNotNull(saved.getId());
}
 
开发者ID:ecabrerar,项目名称:AirAlliance,代码行数:15,代码来源:ItineraryServiceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultLogger类代码示例发布时间:2022-05-23
下一篇:
Java DublinCore类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap