本文整理匯總了Java中org.onosproject.net.intent.FakeIntentManager類的典型用法代碼示例。如果您正苦於以下問題:Java FakeIntentManager類的具體用法?Java FakeIntentManager怎麽用?Java FakeIntentManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FakeIntentManager類屬於org.onosproject.net.intent包,在下文中一共展示了FakeIntentManager類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testRemove
import org.onosproject.net.intent.FakeIntentManager; //導入依賴的package包/類
/**
* Tests removing an intent with DELETE.
*/
@Test
public void testRemove() {
final HashSet<NetworkResource> resources = new HashSet<>();
resources.add(new MockResource(1));
resources.add(new MockResource(2));
resources.add(new MockResource(3));
final Intent intent = new MockIntent(3L, resources);
final ApplicationId appId = new DefaultApplicationId(2, "app");
IntentService fakeManager = new FakeIntentManager();
expect(mockCoreService.getAppId("app"))
.andReturn(appId).once();
replay(mockCoreService);
mockIntentService.withdraw(anyObject());
expectLastCall().andDelegateTo(fakeManager).once();
expect(mockIntentService.getIntent(Key.of(2, appId)))
.andReturn(intent)
.once();
expect(mockIntentService.getIntent(Key.of("0x2", appId)))
.andReturn(null)
.once();
mockIntentService.addListener(anyObject());
expectLastCall().andDelegateTo(fakeManager).once();
mockIntentService.removeListener(anyObject());
expectLastCall().andDelegateTo(fakeManager).once();
replay(mockIntentService);
WebTarget wt = target();
Response response = wt.path("intents/app/0x2")
.request(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN)
.delete();
assertThat(response.getStatus(), is(HttpURLConnection.HTTP_NO_CONTENT));
}