private void select(final ProviderType providerType) { providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(providerType.getKey())); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AddNewProviderEvent that = (AddNewProviderEvent) o; return providerType != null ? providerType.equals(that.providerType) : that.providerType == null; }
/** * Helper method for showing whe provider type name in a consistent way around the different widgets. * @param providerType a provider type. * @return Returns a String with the provider name to show in the UI. */ public static String getDisplayableProviderTypeName(ProviderType providerType) { return providerType.getName() + " " + providerType.getKey().getVersion(); }
@Before public void setUp() { providerType = new ProviderType(new ProviderTypeKey(PROVIDER_ID, PROVIDER_VERSION), PROVIDER_NAME); when(handlerRegistry.getProviderHandler(providerType.getKey())).thenReturn(providerHandler); when(providerHandler.getProviderTypeImageURL()).thenReturn(IMAGE_URL); presenter = new ProviderTypeItemPresenter(view, handlerRegistry); presenter.init(); verify(view, times(1)).init(presenter); }
@Test public void testOnSelect() { presenter.setup(providerType, providerTypes); //test the selection of whatever of the elements. providerTypes.forEach(currentProviderType -> { presenter.onSelect(new ProviderTypeSelectedEvent(currentProviderType.getKey())); if (!currentProviderType.equals(providerType)) { verify(view, times(1)).select(currentProviderType.getKey()); } }); verify(view, times(2)).select(providerType.getKey()); }
public static final ProviderType mockProviderType(String suffix) { return new ProviderType(mockProviderTypeKey(suffix), "ProviderType.name." + suffix); }
@Override public int hashCode() { int result = providerType != null ? providerType.hashCode() : 0; result = ~~result; return result; } }
@Before public void setUp() { providerType = new ProviderType(new ProviderTypeKey(PROVIDER_ID, PROVIDER_VERSION), PROVIDER_NAME); when(handlerRegistry.getProviderHandler(providerType.getKey())).thenReturn(providerHandler); when(providerHandler.getProviderTypeImageURL()).thenReturn(IMAGE_URL); presenter = new ProviderTypeItemPresenter(view, handlerRegistry); presenter.init(); verify(view, times(1)).init(presenter); }
@Test public void testOnSelect() { presenter.setup(providerType, providerTypes); //test the selection of whatever of the elements. providerTypes.forEach(currentProviderType -> { presenter.onSelect(new ProviderTypeSelectedEvent(currentProviderType.getKey())); if (!currentProviderType.equals(providerType)) { verify(view, times(1)).select(currentProviderType.getKey()); } }); verify(view, times(2)).select(providerType.getKey()); }
@Override public Collection<ProviderType> getAvailableProviderTypes() { List<ProviderType> result = new ArrayList<>(); List<org.guvnor.ala.runtime.providers.ProviderType> providers = runtimeProvisioningService.getProviderTypes(0, 100, PROVIDER_TYPE_NAME_SORT, true); if (providers != null) { providers.forEach(providerType -> result.add(new ProviderType(new ProviderTypeKey(providerType.getProviderTypeName(), providerType.getVersion()), providerType.getProviderTypeName())) ); } return result; }
@Override public int hashCode() { int result = providerType != null ? providerType.hashCode() : 0; result = ~~result; return result; } }
private void select(final ProviderType providerType) { providerTypeSelectedEvent.fire(new ProviderTypeSelectedEvent(providerType.getKey())); }
/** * Helper method for showing whe provider type name in a consistent way around the different widgets. * @param providerType a provider type. * @return Returns a String with the provider name to show in the UI. */ public static String getDisplayableProviderTypeName(ProviderType providerType) { return providerType.getName() + " " + providerType.getKey().getVersion(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AddNewProviderEvent that = (AddNewProviderEvent) o; return providerType != null ? providerType.equals(that.providerType) : that.providerType == null; }
providerTypeSpi.getVersion()); providerType = new ProviderType(providerTypeKey, null);
@Override public int hashCode() { int result = providerType != null ? providerType.hashCode() : 0; result = ~~result; result = 31 * result + (providersKey != null ? providersKey.hashCode() : 0); result = ~~result; return result; } }
@Override public ProviderType getProviderType(final ProviderTypeKey providerTypeKey) { checkNotNull("providerTypeKey", providerTypeKey); return getAvailableProviderTypes().stream() .filter(providerType -> providerType.getKey().equals(providerTypeKey)) .findFirst().orElse(null); }
private List<Pair<ProviderType, ProviderTypeStatus>> buildProviderStatusList(final Map<ProviderType, ProviderTypeStatus> statusMap) { return statusMap.entrySet() .stream() .filter(entry -> handlerRegistry.isProviderInstalled(entry.getKey().getKey())) .map(entry -> new Pair<>(entry.getKey(), entry.getValue())) .sorted(Comparator.comparing(o -> o.getK1().getName())) .collect(Collectors.toList()); } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ProvidersInfo that = (ProvidersInfo) o; if (providerType != null ? !providerType.equals(that.providerType) : that.providerType != null) { return false; } return providersKey != null ? providersKey.equals(that.providersKey) : that.providersKey == null; }
providerTypeSpi.getVersion()); providerType = new ProviderType(providerTypeKey, null);