@Test public void testToModelWhenHandlerIsConfigured() { when(handlerRegistry.ensureHandler(providerTypeKey)).thenReturn(providerHandler); when(providerHandler.getProviderConfigConverter()).thenReturn(providerConfigConverter); when(providerConfigConverter.toModel(providerConfig)).thenReturn(providerConfiguration); Provider result = converter.toModel(provider); assertNotNull(result); assertEquals(PROVIDER_ID, result.getKey().getId()); assertEquals(PROVIDER_TYPE_NAME, result.getKey().getProviderTypeKey().getId()); assertEquals(PROVIDER_VERSION, result.getKey().getProviderTypeKey().getVersion()); assertEquals(result.getConfiguration(), providerConfiguration); }
@Override public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) { Provider result = null; if (provider != null) { ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion()); ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId()); final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey); @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig()); result = new Provider(providerKey, providerConfiguration); } return result; }
ProviderConverterImpl implements ProviderConverter { @Override public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) { Provider result = null; if (provider != null) { ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion()); ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId()); final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey); @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig()); result = new Provider(providerKey, providerConfiguration); } return result; } }
ProviderConverterImpl implements ProviderConverter { @Override public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) { Provider result = null; if (provider != null) { ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion()); ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId()); final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey); @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig()); result = new Provider(providerKey, providerConfiguration); } return result; } ProviderConverterImpl(final BackendProviderHandlerRegistry handlerRegistry); }
ProviderConverterImpl implements ProviderConverter { @Override public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) { Provider result = null; if (provider != null) { ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion()); ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId()); final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey); @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig()); result = new Provider(providerKey, providerConfiguration); } return result; } ProviderConverterImpl(final BackendProviderHandlerRegistry handlerRegistry); @Override Class<Provider> getModelType(); @Override Class<org.guvnor.ala.runtime.providers.Provider> getDomainType(); @Override org.guvnor.ala.runtime.providers.Provider toDomain(Provider modelValue); @Override Provider toModel(org.guvnor.ala.runtime.providers.Provider provider); }
ProviderConverterImpl implements ProviderConverter { @Override public Provider toModel(org.guvnor.ala.runtime.providers.Provider provider) { Provider result = null; if (provider != null) { ProviderTypeKey providerTypeKey = new ProviderTypeKey(provider.getProviderType().getProviderTypeName(), provider.getProviderType().getVersion()); ProviderKey providerKey = new ProviderKey(providerTypeKey, provider.getId()); final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey); @SuppressWarnings("unchecked") final ProviderConfiguration providerConfiguration = (ProviderConfiguration) handler.getProviderConfigConverter().toModel(provider.getConfig()); result = new Provider(providerKey, providerConfiguration); } return result; } ProviderConverterImpl(final BackendProviderHandlerRegistry handlerRegistry); @Override Class<Provider> getModelType(); @Override Class<org.guvnor.ala.runtime.providers.Provider> getDomainType(); @Override org.guvnor.ala.runtime.providers.Provider toDomain(Provider modelValue); @Override Provider toModel(org.guvnor.ala.runtime.providers.Provider provider);  }