/** * {@inheritDoc} */ @Override protected IStatus run(IProgressMonitor monitor) { if (cmrRepositoryDefinition.getOnlineStatus() == OnlineStatus.OFFLINE) { return Status.CANCEL_STATUS; } try { Profile profile = cmrRepositoryDefinition.getConfigurationInterfaceService().getProfile(profileId); final ProfileEditorInput profileEditorInput = new ProfileEditorInput(profile, cmrRepositoryDefinition); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { page.openEditor(profileEditorInput, ProfileEditor.ID, true); } catch (PartInitException e) { InspectIT.getDefault().createErrorDialog("Exception occurred opening the Profile editor.", e, -1); } } }); return Status.OK_STATUS; } catch (BusinessException e) { return new Status(IStatus.OK, InspectIT.ID, "Exception occurred loading the profile from the CMR.", e); } }
@Test public void executorClient() throws BusinessException { Profile profile = mock(Profile.class); when(profile.isActive()).thenReturn(true); when(environment.getProfileIds()).thenReturn(Sets.newHashSet("profile-id")); when(ciService.getProfile("profile-id")).thenReturn(profile); SensorAssignmentProfileData sapData = mock(SensorAssignmentProfileData.class); when(profile.getProfileData()).thenReturn((AbstractProfileData) sapData); MethodSensorAssignment msAssignment = mock(MethodSensorAssignment.class); when(sapData.getMethodSensorAssignments()).thenReturn(Lists.newArrayList(msAssignment)); when(msAssignment.getSensorConfigClass()).thenReturn((Class) ExecutorClientSensorConfig.class); Collection<SpecialMethodSensorAssignment> assignments = factory.getSpecialAssignments(environment); assertThat(assignments, is(not(empty()))); assertThat(assignments, hasItem(hasProperty("specialMethodSensorConfig", is(ExecutorIntercepterSensorConfig.INSTANCE)))); assertThat(assignments, hasItem(hasProperty("specialMethodSensorConfig", is(CloseableHttpAsyncClientSensorConfig.INSTANCE)))); }