@Test public void validate_invalidPackageName() { mockpkg = mock(org.guvnor.common.services.project.model.Package.class); when(validationService.isPackageNameValid(anyString())).thenReturn(false); handler.validate("mockpkg", callback); verify(callback, never()).onFailure(); verify(callback).onFailure(anyString()); verify(callback, never()).onSuccess(); }
@Override public void validate(final String packageName, final ValidatorWithReasonCallback callback) { validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(ProjectEditorResources.CONSTANTS.InvalidPackageName(packageName)); } } }).isPackageNameValid(packageName); }
NewPackageHandler extends DefaultNewResourceHandler { @Override public void validate(final String packageName, final ValidatorWithReasonCallback callback) { validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(ProjectEditorResources.CONSTANTS.InvalidPackageName(packageName)); } } }).isPackageNameValid(packageName); } }
NewPackageHandler extends DefaultNewResourceHandler { @Override public void validate(final String packageName, final ValidatorWithReasonCallback callback) { validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(ProjectEditorResources.CONSTANTS.InvalidPackageName(packageName)); } } }).isPackageNameValid(packageName); } NewPackageHandler(); @Inject  NewPackageHandler(Caller<KieModuleService> moduleService,
                             Caller<ValidationService> validationService,
                             AnyResourceTypeDefinition resourceType); }
NewPackageHandler extends DefaultNewResourceHandler { @Override public void validate(final String packageName, final ValidatorWithReasonCallback callback) { validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(ProjectEditorResources.CONSTANTS.InvalidPackageName(packageName)); } } }).isPackageNameValid(packageName); } NewPackageHandler(); @Inject  NewPackageHandler(Caller<KieModuleService> moduleService,
                             Caller<ValidationService> validationService,
                             AnyResourceTypeDefinition resourceType); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override void validate(final String packageName,
                         final ValidatorWithReasonCallback callback); @Override void create(final Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter); }
NewPackageHandler extends DefaultNewResourceHandler { @Override public void validate(final String packageName, final ValidatorWithReasonCallback callback) { validationService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean response) { if (Boolean.TRUE.equals(response)) { callback.onSuccess(); } else { callback.onFailure(ProjectEditorResources.CONSTANTS.InvalidPackageName(packageName)); } } }).isPackageNameValid(packageName); } NewPackageHandler(); @Inject  NewPackageHandler(Caller<KieModuleService> moduleService,
                             Caller<ValidationService> validationService,
                             AnyResourceTypeDefinition resourceType); @Override String getDescription(); @Override IsWidget getIcon(); @Override ResourceTypeDefinition getResourceType(); @Override void validate(final String packageName,
                         final ValidatorWithReasonCallback callback); @Override void create(final Package pkg,
                       final String baseFileName,
                       final NewResourcePresenter presenter);  }