@Test public void testValidateValidFileName() { final org.guvnor.common.services.project.model.Package pkg = mock(Package.class); final ValidatorWithReasonCallback callback = mock(ValidatorWithReasonCallback.class); when(validationService.isFileNameValid("filename.suffix")).thenReturn(true); handler.validate("filename", callback); verify(callback, times(1)).onSuccess(); verify(callback, never()).onFailure(); verify(callback, never()).onFailure(any(String.class)); }
@Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { final String fileName = buildFileName(baseFileName, getResourceType()); validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(CommonConstants.INSTANCE.InvalidFileName0(baseFileName)); } } }).isFileNameValid(fileName); }
DefaultNewResourceHandler implements NewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { final String fileName = buildFileName(baseFileName, getResourceType()); validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(CommonConstants.INSTANCE.InvalidFileName0(baseFileName)); } } }).isFileNameValid(fileName); } }
DefaultNewResourceHandler implements NewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { final String fileName = buildFileName(baseFileName, getResourceType()); validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(CommonConstants.INSTANCE.InvalidFileName0(baseFileName)); } } }).isFileNameValid(fileName); } DefaultNewResourceHandler(final WorkspaceProjectContext context,
                              final Caller<KieModuleService> moduleService,
                              final Caller<ValidationService> validationService,
                              final PlaceManager placeManager,
                              final Event<NotificationEvent> notificationEvent,
                              final BusyIndicatorView busyIndicatorView);  DefaultNewResourceHandler(); }
DefaultNewResourceHandler implements NewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { final String fileName = buildFileName(baseFileName, getResourceType()); validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(CommonConstants.INSTANCE.InvalidFileName0(baseFileName)); } } }).isFileNameValid(fileName); } DefaultNewResourceHandler(final WorkspaceProjectContext context,
                              final Caller<KieModuleService> moduleService,
                              final Caller<ValidationService> validationService,
                              final PlaceManager placeManager,
                              final Event<NotificationEvent> notificationEvent,
                              final BusyIndicatorView busyIndicatorView);  DefaultNewResourceHandler(); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override void validate(final String baseFileName,
                         final ValidatorWithReasonCallback callback); @Override void acceptContext(final Callback<Boolean, Void> callback); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override boolean canCreate(); }
DefaultNewResourceHandler implements NewResourceHandler { @Override public void validate(final String baseFileName, final ValidatorWithReasonCallback callback) { final String fileName = buildFileName(baseFileName, getResourceType()); validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(CommonConstants.INSTANCE.InvalidFileName0(baseFileName)); } } }).isFileNameValid(fileName); } DefaultNewResourceHandler(final WorkspaceProjectContext context,
                              final Caller<KieModuleService> moduleService,
                              final Caller<ValidationService> validationService,
                              final PlaceManager placeManager,
                              final Event<NotificationEvent> notificationEvent,
                              final BusyIndicatorView busyIndicatorView);  DefaultNewResourceHandler(); @Override List<Pair<String, ? extends IsWidget>> getExtensions(); @Override void validate(final String baseFileName,
                         final ValidatorWithReasonCallback callback); @Override void acceptContext(final Callback<Boolean, Void> callback); @Override Command getCommand(final NewResourcePresenter newResourcePresenter); @Override boolean canCreate();  }