@Test public void testResourceDefinitionServiceAnswered() throws InterruptedException { when(requestProvider.getResourceDefinitionRequest(any(), anyString())).thenReturn(resourceDefinitionRequest); when(resourceDefinitionRequest.await()).thenReturn(resourceDefinitionResult); when(resourceDefinitionResult.getDefinition()).thenReturn(SAMPLE_RESULT); Assertions.assertEquals( SAMPLE_RESULT, resourceDefinitionServiceUnderTest.getResourceDefinition(CLOUD_PLATFORM, RESOURCE) ); }
@Cacheable("resourceDefinitionCache") public String getResourceDefinition(String cloudPlatform, String resource) { LOGGER.debug("Sending request for {} {} resource property definition", cloudPlatform, resource); CloudPlatformVariant platformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.EMPTY); ResourceDefinitionRequest request = requestProvider.getResourceDefinitionRequest(platformVariant, resource); eventBus.notify(request.selector(), eventFactory.createEvent(request)); try { ResourceDefinitionResult result = request.await(); LOGGER.debug("Resource property definition: {}", result); return result.getDefinition(); } catch (InterruptedException e) { LOGGER.info("Error while sending resource definition request", e); throw new OperationException(e); } }
ResourceDefinitionService { @Cacheable("resourceDefinitionCache") public String getResourceDefinition(String cloudPlatform, String resource) { LOGGER.debug("Sending request for {} {} resource property definition", cloudPlatform, resource); CloudPlatformVariant platformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.EMPTY); ResourceDefinitionRequest request = requestProvider.getResourceDefinitionRequest(platformVariant, resource); eventBus.notify(request.selector(), eventFactory.createEvent(request)); try { ResourceDefinitionResult result = request.await(); LOGGER.debug("Resource property definition: {}", result); return result.getDefinition(); } catch (InterruptedException e) { LOGGER.info("Error while sending resource definition request", e); throw new OperationException(e); } } }
ResourceDefinitionService { @Cacheable("resourceDefinitionCache") public String getResourceDefinition(String cloudPlatform, String resource) { LOGGER.debug("Sending request for {} {} resource property definition", cloudPlatform, resource); CloudPlatformVariant platformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.EMPTY); ResourceDefinitionRequest request = requestProvider.getResourceDefinitionRequest(platformVariant, resource); eventBus.notify(request.selector(), eventFactory.createEvent(request)); try { ResourceDefinitionResult result = request.await(); LOGGER.debug("Resource property definition: {}", result); return result.getDefinition(); } catch (InterruptedException e) { LOGGER.info("Error while sending resource definition request", e); throw new OperationException(e); } }  }
ResourceDefinitionService { @Cacheable("resourceDefinitionCache") public String getResourceDefinition(String cloudPlatform, String resource) { LOGGER.debug("Sending request for {} {} resource property definition", cloudPlatform, resource); CloudPlatformVariant platformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.EMPTY); ResourceDefinitionRequest request = requestProvider.getResourceDefinitionRequest(platformVariant, resource); eventBus.notify(request.selector(), eventFactory.createEvent(request)); try { ResourceDefinitionResult result = request.await(); LOGGER.debug("Resource property definition: {}", result); return result.getDefinition(); } catch (InterruptedException e) { LOGGER.info("Error while sending resource definition request", e); throw new OperationException(e); } }  @Cacheable("resourceDefinitionCache") String getResourceDefinition(String cloudPlatform, String resource); }
ResourceDefinitionService { @Cacheable("resourceDefinitionCache") public String getResourceDefinition(String cloudPlatform, String resource) { LOGGER.debug("Sending request for {} {} resource property definition", cloudPlatform, resource); CloudPlatformVariant platformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.EMPTY); ResourceDefinitionRequest request = requestProvider.getResourceDefinitionRequest(platformVariant, resource); eventBus.notify(request.selector(), eventFactory.createEvent(request)); try { ResourceDefinitionResult result = request.await(); LOGGER.debug("Resource property definition: {}", result); return result.getDefinition(); } catch (InterruptedException e) { LOGGER.info("Error while sending resource definition request", e); throw new OperationException(e); } }  @Cacheable("resourceDefinitionCache") String getResourceDefinition(String cloudPlatform, String resource);  }