本文整理匯總了Java中org.kuali.rice.ksb.messaging.remotedservices.BaseballCardCollectionService.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java BaseballCardCollectionService.delete方法的具體用法?Java BaseballCardCollectionService.delete怎麽用?Java BaseballCardCollectionService.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kuali.rice.ksb.messaging.remotedservices.BaseballCardCollectionService
的用法示例。
在下文中一共展示了BaseballCardCollectionService.delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testBaseballCardCollectionService
import org.kuali.rice.ksb.messaging.remotedservices.BaseballCardCollectionService; //導入方法依賴的package包/類
/**
* Exercise our RESTful {@link BaseballCardCollectionService} over the KSB
*/
@Test
public void testBaseballCardCollectionService() {
BaseballCard cardA = new BaseballCard("Mickey Mantle", "Topps", 1952);
BaseballCard cardB = new BaseballCard("Ted Williams", "Bowman", 1954);
BaseballCard cardC = new BaseballCard("Willie Mays", "Bowman", 1951);
BaseballCard cardD = new BaseballCard("Willie Mays Hayes", "Bogus", 1989);
BaseballCardCollectionService service =
(BaseballCardCollectionService) GlobalResourceLoader.getService(
new QName(NAMESPACE, BBCARD_SERVICE)
);
// test @POST
service.add(cardA);
service.add(cardB);
Integer willieMaysId = service.add(cardC);
// test @GET
List<BaseballCard> allCards = service.getAll();
assertNotNull(allCards);
assertTrue(allCards.size() == 3);
assertTrue(allCards.contains(cardA));
assertTrue(allCards.contains(cardB));
assertTrue(allCards.contains(cardC));
// test @PUT
service.update(willieMaysId, cardD); // replace Willie Mays w/ Willie Mays Hayes
allCards = service.getAll();
assertNotNull(allCards);
assertTrue(allCards.size() == 3);
assertFalse(allCards.contains(cardC)); // this one was replaced
assertTrue(allCards.contains(cardD)); // this was the replacement
// test @DELETE
service.delete(willieMaysId); // delete Willie
allCards = service.getAll();
assertNotNull(allCards);
assertTrue(allCards.size() == 2);
assertFalse(allCards.contains(cardD)); // should be gone
// test that adding a card already in the collection in fact adds to the collection.
service.add(cardA);
service.add(cardA);
service.add(cardA);
allCards = service.getAll();
assertTrue(allCards.size() == 5);
try {
service.unannotatedMethod();
fail("Magic? You can't remotely invoke a method that doesn't have JAX-RS annotations in the resource class!");
} catch (Exception e) {
// I expect this to throw an exception
e.printStackTrace();
}
}