Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public EventVO answer(InvocationOnMock invocation) throws Throwable {
account.setId(ACCOUNT_ID);
user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone",
UUID.randomUUID().toString(), User.Source.UNKNOWN);
CallContext.register(user, account);
Comment thread
weizhouapache marked this conversation as resolved.

Mockito.when(accountDao.findById(ACCOUNT_ID)).thenReturn(account);
}
Expand All @@ -197,6 +198,8 @@ public void teardown() {

utils.init();

CallContext.unregister();

componentContextMocked.close();
}

Expand Down Expand Up @@ -265,7 +268,6 @@ public void testInterceptException() throws NoSuchMethodException {

@Test
public void testInterceptExceptionResource() throws NoSuchMethodException {
CallContext.register(user, account);
Long resourceId = 1L;
ApiCommandResourceType resourceType = ApiCommandResourceType.VirtualMachine;
CallContext.current().setEventResourceId(resourceId);
Expand All @@ -282,7 +284,6 @@ public void testInterceptExceptionResource() throws NoSuchMethodException {
Assert.assertEquals(eventVO.getState(), com.cloud.event.Event.State.Completed);
Assert.assertEquals(eventVO.getResourceId(), resourceId);
Assert.assertEquals(eventVO.getResourceType(), resourceType.toString());
CallContext.unregister();
}

@Test
Expand Down