target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testToValidationMessageFromDataModelerError() { ArrayList<DataModelerError> dataModelerErrors = new ArrayList<>(); DataModelerError dataModelerError; Level level; for(int i = 0; i < 10; i++) { level = Level.values()[i % 3]; dataModelerError = new DataModelerError(i, "message"+i,level, mock(Path.class), i, i); dataModelerErrors.add(dataModelerError); } List<ValidationMessage> result = serviceHelper.toValidationMessage(dataModelerErrors); assertEquals(dataModelerErrors.size(), result.size()); for (int i = 0; i < dataModelerErrors.size(); i++) { assertErrorEquals(dataModelerErrors.get(i), result.get(i)); } } | public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } | DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } } | DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors) { final List<ValidationMessage> validationMessages = new ArrayList<>(); ValidationMessage validationMessage; if (errors == null) { return validationMessages; } for (DataModelerError error : errors) { validationMessage = new ValidationMessage(); validationMessage.setPath(error.getFile()); validationMessage.setText(error.getMessage()); validationMessage.setColumn(error.getColumn()); validationMessage.setLine(error.getLine()); validationMessage.setId(error.getId()); if (error.getLevel() != null) { validationMessage.setLevel(error.getLevel()); } validationMessages.add(validationMessage); } return validationMessages; } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testCalculateClassName() { Module module = mock(Module.class); Package defaultPackage = mock(Package.class); Path javaFile1Main = Paths.convert(testRootPath.resolve(JAVA_FILE_1_MAIN_PATH)); Path javaFile1Test = Paths.convert(testRootPath.resolve(JAVA_FILE_1_TEST_PATH)); Path javaFile2Main = Paths.convert(testRootPath.resolve(JAVA_FILE_2_MAIN_PATH)); Path javaFile2Test = Paths.convert(testRootPath.resolve(JAVA_FILE_2_TEST_PATH)); Path javaFile3Main = Paths.convert(testRootPath.resolve(JAVA_FILE_3_MAIN_PATH)); Path javaFile3Test = Paths.convert(testRootPath.resolve(JAVA_FILE_3_TEST_PATH)); Path javaFileInOtherModule = Paths.convert(testRootPath.resolve(JAVA_FILE_IN_OTHER_MODULE)); assertNull(serviceHelper.calculateClassName(module, null)); assertNull(serviceHelper.calculateClassName(module, javaFile1Main)); assertNull(serviceHelper.calculateClassName(module, javaFile1Test)); assertNull(serviceHelper.calculateClassName(module, javaFile2Main)); assertNull(serviceHelper.calculateClassName(module, javaFile2Test)); assertNull(serviceHelper.calculateClassName(module, javaFile3Main)); assertNull(serviceHelper.calculateClassName(module, javaFile3Test)); assertNull(serviceHelper.calculateClassName(module, javaFileInOtherModule)); when(moduleService.resolveDefaultPackage(module)).thenReturn(defaultPackage); Path mainSrcPath = Paths.convert(testRootPath.resolve("myProject/src/main/java")); Path testSrcPath = Paths.convert(testRootPath.resolve("myProject/src/test/java")); when(defaultPackage.getPackageMainSrcPath()).thenReturn(mainSrcPath); when(defaultPackage.getPackageTestSrcPath()).thenReturn(testSrcPath); assertNull(serviceHelper.calculateClassName(module, null)); assertEquals(JAVA_FILE_1_CLASS, serviceHelper.calculateClassName(module, javaFile1Main)); assertEquals(JAVA_FILE_1_CLASS, serviceHelper.calculateClassName(module, javaFile1Test)); assertEquals(JAVA_FILE_2_CLASS, serviceHelper.calculateClassName(module, javaFile2Main)); assertEquals(JAVA_FILE_2_CLASS, serviceHelper.calculateClassName(module, javaFile2Test)); assertEquals(JAVA_FILE_3_CLASS, serviceHelper.calculateClassName(module, javaFile3Main)); assertEquals(JAVA_FILE_3_CLASS, serviceHelper.calculateClassName(module, javaFile3Test)); assertNull(serviceHelper.calculateClassName(module, javaFileInOtherModule)); } | public String calculateClassName(final Module module, final org.uberfire.backend.vfs.Path path) { PortablePreconditions.checkNotNull("module", module); if (path == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); if (defaultPackage == null) { return null; } final Path mainSrcNioPath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final Path testSrcNioPath = Paths.convert(defaultPackage.getPackageTestSrcPath()); final Path nioPath = Paths.convert(path); Path relativePath = null; if (mainSrcNioPath != null && nioPath.startsWith(mainSrcNioPath)) { relativePath = mainSrcNioPath.relativize(nioPath); } else if (testSrcNioPath != null && nioPath.startsWith(testSrcNioPath)) { relativePath = testSrcNioPath.relativize(nioPath); } if (relativePath != null) { String className = relativePath.toString().replace("/", "."); return className.substring(0, className.lastIndexOf(".java")); } return null; } | DataModelerServiceHelper { public String calculateClassName(final Module module, final org.uberfire.backend.vfs.Path path) { PortablePreconditions.checkNotNull("module", module); if (path == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); if (defaultPackage == null) { return null; } final Path mainSrcNioPath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final Path testSrcNioPath = Paths.convert(defaultPackage.getPackageTestSrcPath()); final Path nioPath = Paths.convert(path); Path relativePath = null; if (mainSrcNioPath != null && nioPath.startsWith(mainSrcNioPath)) { relativePath = mainSrcNioPath.relativize(nioPath); } else if (testSrcNioPath != null && nioPath.startsWith(testSrcNioPath)) { relativePath = testSrcNioPath.relativize(nioPath); } if (relativePath != null) { String className = relativePath.toString().replace("/", "."); return className.substring(0, className.lastIndexOf(".java")); } return null; } } | DataModelerServiceHelper { public String calculateClassName(final Module module, final org.uberfire.backend.vfs.Path path) { PortablePreconditions.checkNotNull("module", module); if (path == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); if (defaultPackage == null) { return null; } final Path mainSrcNioPath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final Path testSrcNioPath = Paths.convert(defaultPackage.getPackageTestSrcPath()); final Path nioPath = Paths.convert(path); Path relativePath = null; if (mainSrcNioPath != null && nioPath.startsWith(mainSrcNioPath)) { relativePath = mainSrcNioPath.relativize(nioPath); } else if (testSrcNioPath != null && nioPath.startsWith(testSrcNioPath)) { relativePath = testSrcNioPath.relativize(nioPath); } if (relativePath != null) { String className = relativePath.toString().replace("/", "."); return className.substring(0, className.lastIndexOf(".java")); } return null; } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public String calculateClassName(final Module module, final org.uberfire.backend.vfs.Path path) { PortablePreconditions.checkNotNull("module", module); if (path == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); if (defaultPackage == null) { return null; } final Path mainSrcNioPath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final Path testSrcNioPath = Paths.convert(defaultPackage.getPackageTestSrcPath()); final Path nioPath = Paths.convert(path); Path relativePath = null; if (mainSrcNioPath != null && nioPath.startsWith(mainSrcNioPath)) { relativePath = mainSrcNioPath.relativize(nioPath); } else if (testSrcNioPath != null && nioPath.startsWith(testSrcNioPath)) { relativePath = testSrcNioPath.relativize(nioPath); } if (relativePath != null) { String className = relativePath.toString().replace("/", "."); return className.substring(0, className.lastIndexOf(".java")); } return null; } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public String calculateClassName(final Module module, final org.uberfire.backend.vfs.Path path) { PortablePreconditions.checkNotNull("module", module); if (path == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); if (defaultPackage == null) { return null; } final Path mainSrcNioPath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final Path testSrcNioPath = Paths.convert(defaultPackage.getPackageTestSrcPath()); final Path nioPath = Paths.convert(path); Path relativePath = null; if (mainSrcNioPath != null && nioPath.startsWith(mainSrcNioPath)) { relativePath = mainSrcNioPath.relativize(nioPath); } else if (testSrcNioPath != null && nioPath.startsWith(testSrcNioPath)) { relativePath = testSrcNioPath.relativize(nioPath); } if (relativePath != null) { String className = relativePath.toString().replace("/", "."); return className.substring(0, className.lastIndexOf(".java")); } return null; } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testMakeCommentedOption() { String message = "message"; CommentedOption commentedOption = mock(CommentedOption.class); when(commentedOptionFactory.makeCommentedOption(message)).thenReturn(commentedOption); assertEquals(commentedOption, serviceHelper.makeCommentedOption(message)); } | public CommentedOption makeCommentedOption(final String commitMessage) { return commentedOptionFactory.makeCommentedOption(commitMessage); } | DataModelerServiceHelper { public CommentedOption makeCommentedOption(final String commitMessage) { return commentedOptionFactory.makeCommentedOption(commitMessage); } } | DataModelerServiceHelper { public CommentedOption makeCommentedOption(final String commitMessage) { return commentedOptionFactory.makeCommentedOption(commitMessage); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public CommentedOption makeCommentedOption(final String commitMessage) { return commentedOptionFactory.makeCommentedOption(commitMessage); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public CommentedOption makeCommentedOption(final String commitMessage) { return commentedOptionFactory.makeCommentedOption(commitMessage); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testEnsurePackageStructureWhenNoValuesProvided() { prepareEnsurePackageTest(); assertNull(serviceHelper.ensurePackageStructure(module, null)); assertNull(serviceHelper.ensurePackageStructure(module, "")); } | public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testEnsurePackageStructureWhenProvidedPackageAlreadyExists() { prepareEnsurePackageTest(); Package existingPackage = mock(Package.class); when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true); when(moduleService.resolvePackage(any(Path.class))).thenReturn(existingPackage); Package result = serviceHelper.ensurePackageStructure(module, NEW_PACKAGE_NAME); assertEquals(existingPackage, result); verify(moduleService, never()).newPackage(any(Package.class), anyString()); } | public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testEnsurePackageStructureWhenProvidedPackageDoNotExists() { prepareEnsurePackageTest(); Package createdPackage = mock(Package.class); when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false); when(moduleService.newPackage(defaultPackage, NEW_PACKAGE_NAME)).thenReturn(createdPackage); Package result = serviceHelper.ensurePackageStructure(module, NEW_PACKAGE_NAME); assertEquals(createdPackage, result); verify(moduleService).newPackage(defaultPackage, NEW_PACKAGE_NAME); } | public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public Package ensurePackageStructure(final Module module, final String packageName) { if (packageName == null || "".equals(packageName) || module == null) { return null; } final Package defaultPackage = moduleService.resolveDefaultPackage(module); final Path defaultPackagePath = Paths.convert(defaultPackage.getPackageMainSrcPath()); final String newPackageName = packageName.replace(".", "/"); final Path newPackagePath = defaultPackagePath.resolve(newPackageName); if (!ioService.exists(newPackagePath)) { return moduleService.newPackage(defaultPackage, packageName); } else { return moduleService.resolvePackage(Paths.convert(newPackagePath)); } } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@SuppressWarnings("unchecked") @Test public void testResolvePackages() { Module module = mock(Module.class); Set<Package> packages = new HashSet(); Package pkg; for (int i = 0; i < 10; i++) { pkg = mock(Package.class); when(pkg.getPackageName()).thenReturn("package"+i); packages.add(pkg); } when(moduleService.resolvePackages(module)).thenReturn(packages); Set<String> result = serviceHelper.resolvePackages(module); assertEquals(packages.size(), result.size()); packages.forEach(existingPkg -> assertTrue(result.contains(existingPkg.getPackageName()))); } | public Set<String> resolvePackages(final Module project) { final Set<Package> packages = moduleService.resolvePackages(project); return packages.stream() .map(Package::getPackageName) .collect(Collectors.toSet()); } | DataModelerServiceHelper { public Set<String> resolvePackages(final Module project) { final Set<Package> packages = moduleService.resolvePackages(project); return packages.stream() .map(Package::getPackageName) .collect(Collectors.toSet()); } } | DataModelerServiceHelper { public Set<String> resolvePackages(final Module project) { final Set<Package> packages = moduleService.resolvePackages(project); return packages.stream() .map(Package::getPackageName) .collect(Collectors.toSet()); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public Set<String> resolvePackages(final Module project) { final Set<Package> packages = moduleService.resolvePackages(project); return packages.stream() .map(Package::getPackageName) .collect(Collectors.toSet()); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public Set<String> resolvePackages(final Module project) { final Set<Package> packages = moduleService.resolvePackages(project); return packages.stream() .map(Package::getPackageName) .collect(Collectors.toSet()); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testGraphCommandExecuteWithExistingColumn_InsertBefore() { final InformationItem existingInformationItem = new InformationItem(); relation.getColumn().add(existingInformationItem); final List row = new List(); relation.getRow().add(row); final LiteralExpression existingLiteralExpression = new LiteralExpression(); row.getExpression().add(0, HasExpression.wrap(row, existingLiteralExpression)); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(2, relation.getColumn().size()); assertEquals(informationItem, relation.getColumn().get(0)); assertEquals(RelationDefaultValueUtilities.PREFIX + "1", informationItem.getName().getValue()); assertEquals(existingInformationItem, relation.getColumn().get(1)); assertEquals(1, relation.getRow().size()); assertEquals(2, relation.getRow().get(0).getExpression().size()); assertTrue(relation.getRow().get(0).getExpression().get(0).getExpression() instanceof LiteralExpression); assertEquals(existingLiteralExpression, relation.getRow().get(0).getExpression().get(1).getExpression()); assertEquals(relation, informationItem.getParent()); assertEquals(relation.getRow().get(0), relation.getRow().get(0).getExpression().get(0).getExpression().getParent()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } |
@Test public void testCalculateFilePath() { org.uberfire.java.nio.file.Path javaPath = testRootPath; String className = "PojoWithNoPackage背景色"; String expectedFile = testRootPath.toString() + "/PojoWithNoPackage背景色.java"; org.uberfire.java.nio.file.Path result = serviceHelper.calculateFilePath(className, javaPath); assertEquals(expectedFile, result.toString()); className = "com.myspace.PojoWithPackage背景色"; expectedFile = testRootPath.toString() + "/com/myspace/PojoWithPackage背景色.java"; result = serviceHelper.calculateFilePath(className, javaPath); assertEquals(expectedFile, result.toString()); } | public Path calculateFilePath(final String className, final Path javaPath) { PortablePreconditions.checkNotNull("className", className); PortablePreconditions.checkNotNull("javaPath", javaPath); String pathUri = className; if (className.contains(".")) { pathUri = className.replace(".", "/"); } return javaPath.resolve(pathUri + ".java"); } | DataModelerServiceHelper { public Path calculateFilePath(final String className, final Path javaPath) { PortablePreconditions.checkNotNull("className", className); PortablePreconditions.checkNotNull("javaPath", javaPath); String pathUri = className; if (className.contains(".")) { pathUri = className.replace(".", "/"); } return javaPath.resolve(pathUri + ".java"); } } | DataModelerServiceHelper { public Path calculateFilePath(final String className, final Path javaPath) { PortablePreconditions.checkNotNull("className", className); PortablePreconditions.checkNotNull("javaPath", javaPath); String pathUri = className; if (className.contains(".")) { pathUri = className.replace(".", "/"); } return javaPath.resolve(pathUri + ".java"); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); } | DataModelerServiceHelper { public Path calculateFilePath(final String className, final Path javaPath) { PortablePreconditions.checkNotNull("className", className); PortablePreconditions.checkNotNull("javaPath", javaPath); String pathUri = className; if (className.contains(".")) { pathUri = className.replace(".", "/"); } return javaPath.resolve(pathUri + ".java"); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } | DataModelerServiceHelper { public Path calculateFilePath(final String className, final Path javaPath) { PortablePreconditions.checkNotNull("className", className); PortablePreconditions.checkNotNull("javaPath", javaPath); String pathUri = className; if (className.contains(".")) { pathUri = className.replace(".", "/"); } return javaPath.resolve(pathUri + ".java"); } DataModelerServiceHelper(); @Inject DataModelerServiceHelper(final KieModuleService moduleService,
final @Named("ioStrategy") IOService ioService,
final CommentedOptionFactory commentedOptionFactory); List<DataModelerError> toDataModelerError(List<DriverError> errors); List<DataModelerError> toDataModelerError(final List<SyntaxError> syntaxErrors,
final Path file); List<ValidationMessage> toValidationMessage(final List<DataModelerError> errors); CommentedOption makeCommentedOption(final String commitMessage); Package ensurePackageStructure(final Module module,
final String packageName); Set<String> resolvePackages(final Module project); String calculateClassName(final Module module,
final org.uberfire.backend.vfs.Path path); Path calculateFilePath(final String className,
final Path javaPath); } |
@Test public void testFillIndexBuilderWithUnavailablePath() throws Exception { final Path mockPath = mock(Path.class); when(ioService.exists(mockPath)).thenReturn(false); assertNull(indexer.fillIndexBuilder(mockPath)); } | @Override public IndexBuilder fillIndexBuilder(final Path path) throws Exception { if (!ioService.exists(path)) { logger.error("Unable to index {} : file does not exist.", path.toUri()); return null; } final KieModule module = getModule(path); if (module == null) { logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved."); return null; } final Package pkg = getPackage(path); if (pkg == null) { logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved."); return null; } final DefaultIndexBuilder builder = new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg); final String javaSource = ioService.readAllString(path); org.jboss.forge.roaster.model.JavaType<?> javaType = Roaster.parse(javaSource); if (javaType.getSyntaxErrors() == null || javaType.getSyntaxErrors().isEmpty()) { if (javaFileIndexerExtensions != null) { for (JavaFileIndexerExtension javaFileIndexerExtension : javaFileIndexerExtensions) { javaFileIndexerExtension.process(builder, javaType); } } String pkgName = pkg.getPackageName(); pkgName = javaType.getPackage(); if (pkgName == null) { pkgName = ""; } builder.setPackageName(pkgName); String javaTypeName = javaType.getQualifiedName(); Resource resParts = new Resource(javaTypeName, ResourceType.JAVA); if (javaType instanceof JavaSource) { ClassLoader moduleClassLoader = getModuleClassLoader(module); JavaSourceVisitor visitor = new JavaSourceVisitor((JavaSource) javaType, moduleClassLoader, resParts); visitor.visit((JavaSource) javaType); addReferencedResourcesToIndexBuilder(builder, visitor); } builder.addGenerator(resParts); } return builder; } | JavaFileIndexer extends AbstractFileIndexer { @Override public IndexBuilder fillIndexBuilder(final Path path) throws Exception { if (!ioService.exists(path)) { logger.error("Unable to index {} : file does not exist.", path.toUri()); return null; } final KieModule module = getModule(path); if (module == null) { logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved."); return null; } final Package pkg = getPackage(path); if (pkg == null) { logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved."); return null; } final DefaultIndexBuilder builder = new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg); final String javaSource = ioService.readAllString(path); org.jboss.forge.roaster.model.JavaType<?> javaType = Roaster.parse(javaSource); if (javaType.getSyntaxErrors() == null || javaType.getSyntaxErrors().isEmpty()) { if (javaFileIndexerExtensions != null) { for (JavaFileIndexerExtension javaFileIndexerExtension : javaFileIndexerExtensions) { javaFileIndexerExtension.process(builder, javaType); } } String pkgName = pkg.getPackageName(); pkgName = javaType.getPackage(); if (pkgName == null) { pkgName = ""; } builder.setPackageName(pkgName); String javaTypeName = javaType.getQualifiedName(); Resource resParts = new Resource(javaTypeName, ResourceType.JAVA); if (javaType instanceof JavaSource) { ClassLoader moduleClassLoader = getModuleClassLoader(module); JavaSourceVisitor visitor = new JavaSourceVisitor((JavaSource) javaType, moduleClassLoader, resParts); visitor.visit((JavaSource) javaType); addReferencedResourcesToIndexBuilder(builder, visitor); } builder.addGenerator(resParts); } return builder; } } | JavaFileIndexer extends AbstractFileIndexer { @Override public IndexBuilder fillIndexBuilder(final Path path) throws Exception { if (!ioService.exists(path)) { logger.error("Unable to index {} : file does not exist.", path.toUri()); return null; } final KieModule module = getModule(path); if (module == null) { logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved."); return null; } final Package pkg = getPackage(path); if (pkg == null) { logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved."); return null; } final DefaultIndexBuilder builder = new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg); final String javaSource = ioService.readAllString(path); org.jboss.forge.roaster.model.JavaType<?> javaType = Roaster.parse(javaSource); if (javaType.getSyntaxErrors() == null || javaType.getSyntaxErrors().isEmpty()) { if (javaFileIndexerExtensions != null) { for (JavaFileIndexerExtension javaFileIndexerExtension : javaFileIndexerExtensions) { javaFileIndexerExtension.process(builder, javaType); } } String pkgName = pkg.getPackageName(); pkgName = javaType.getPackage(); if (pkgName == null) { pkgName = ""; } builder.setPackageName(pkgName); String javaTypeName = javaType.getQualifiedName(); Resource resParts = new Resource(javaTypeName, ResourceType.JAVA); if (javaType instanceof JavaSource) { ClassLoader moduleClassLoader = getModuleClassLoader(module); JavaSourceVisitor visitor = new JavaSourceVisitor((JavaSource) javaType, moduleClassLoader, resParts); visitor.visit((JavaSource) javaType); addReferencedResourcesToIndexBuilder(builder, visitor); } builder.addGenerator(resParts); } return builder; } } | JavaFileIndexer extends AbstractFileIndexer { @Override public IndexBuilder fillIndexBuilder(final Path path) throws Exception { if (!ioService.exists(path)) { logger.error("Unable to index {} : file does not exist.", path.toUri()); return null; } final KieModule module = getModule(path); if (module == null) { logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved."); return null; } final Package pkg = getPackage(path); if (pkg == null) { logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved."); return null; } final DefaultIndexBuilder builder = new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg); final String javaSource = ioService.readAllString(path); org.jboss.forge.roaster.model.JavaType<?> javaType = Roaster.parse(javaSource); if (javaType.getSyntaxErrors() == null || javaType.getSyntaxErrors().isEmpty()) { if (javaFileIndexerExtensions != null) { for (JavaFileIndexerExtension javaFileIndexerExtension : javaFileIndexerExtensions) { javaFileIndexerExtension.process(builder, javaType); } } String pkgName = pkg.getPackageName(); pkgName = javaType.getPackage(); if (pkgName == null) { pkgName = ""; } builder.setPackageName(pkgName); String javaTypeName = javaType.getQualifiedName(); Resource resParts = new Resource(javaTypeName, ResourceType.JAVA); if (javaType instanceof JavaSource) { ClassLoader moduleClassLoader = getModuleClassLoader(module); JavaSourceVisitor visitor = new JavaSourceVisitor((JavaSource) javaType, moduleClassLoader, resParts); visitor.visit((JavaSource) javaType); addReferencedResourcesToIndexBuilder(builder, visitor); } builder.addGenerator(resParts); } return builder; } @Override boolean supportsPath(final Path path); @Override IndexBuilder fillIndexBuilder(final Path path); } | JavaFileIndexer extends AbstractFileIndexer { @Override public IndexBuilder fillIndexBuilder(final Path path) throws Exception { if (!ioService.exists(path)) { logger.error("Unable to index {} : file does not exist.", path.toUri()); return null; } final KieModule module = getModule(path); if (module == null) { logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved."); return null; } final Package pkg = getPackage(path); if (pkg == null) { logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved."); return null; } final DefaultIndexBuilder builder = new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg); final String javaSource = ioService.readAllString(path); org.jboss.forge.roaster.model.JavaType<?> javaType = Roaster.parse(javaSource); if (javaType.getSyntaxErrors() == null || javaType.getSyntaxErrors().isEmpty()) { if (javaFileIndexerExtensions != null) { for (JavaFileIndexerExtension javaFileIndexerExtension : javaFileIndexerExtensions) { javaFileIndexerExtension.process(builder, javaType); } } String pkgName = pkg.getPackageName(); pkgName = javaType.getPackage(); if (pkgName == null) { pkgName = ""; } builder.setPackageName(pkgName); String javaTypeName = javaType.getQualifiedName(); Resource resParts = new Resource(javaTypeName, ResourceType.JAVA); if (javaType instanceof JavaSource) { ClassLoader moduleClassLoader = getModuleClassLoader(module); JavaSourceVisitor visitor = new JavaSourceVisitor((JavaSource) javaType, moduleClassLoader, resParts); visitor.visit((JavaSource) javaType); addReferencedResourcesToIndexBuilder(builder, visitor); } builder.addGenerator(resParts); } return builder; } @Override boolean supportsPath(final Path path); @Override IndexBuilder fillIndexBuilder(final Path path); } |
@Test public void visitAnnotationSources() { for ( AnnotationSource annotationSource : javaClassSource.getAnnotations() ) { visitor.visit( annotationSource ); } checkVisitor( Arrays.asList( "ref:java => org.kie.workbench.common.screens.datamodeller.backend.server.indexing.Annotation1" ) ); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void visitImports() { for ( Import importSource : javaClassSource.getImports() ) { visitor.visit( importSource ); } checkVisitor( Arrays.asList( "ref:java => java.math.BigDecimal", "ref:java => java.io.Serializable" ) ); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void visitFields() { for ( FieldSource fieldSource : javaClassSource.getFields() ) { visitor.visit( fieldSource ); } checkVisitor( Arrays.asList( "ref:java => int", "ref:java => java.math.BigDecimal" ) ); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void visitMethods() { for ( MethodSource methodSource : javaClassSource.getMethods() ) { visitor.visit( methodSource ); } checkVisitor( Arrays.asList( "ref:java => int", "ref:java => java.math.BigDecimal", "ref:java => org.kie.workbench.common.screens.datamodeller.backend.server.indexing.Pojo1" ) ); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void visitInterface() { visitor.visit( javaInterfaceSource ); checkVisitor( Arrays.asList( "ref:java => int", "ref:java => java.lang.String", "ref:java => org.kie.workbench.common.screens.datamodeller.backend.server.indexing.Annotation1" ) ); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void visitEnum() { visitor.visit( javaEnumSource ); checkVisitor( Arrays.asList( "ref:java => int" ) ); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void visitJavaClassImplmentingInterfaceWithGenerics() { visitor.visit(javaClassSource2); checkVisitor(Arrays.asList("ref:java => org.kie.workbench.common.screens.datamodeller.backend.server.indexing.Pojo3", "ref:java => java.lang.Object", "ref:java => java.lang.Comparable", "ref:java => int")); } | public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } | JavaSourceVisitor extends ResourceReferenceCollector { public void visit(JavaSource javaSource) { List<Import> imports = javaSource.getImports(); for (Import javaImport : imports) { visit(javaImport); } if (javaSource instanceof Body) { visit((Body) javaSource); } else if (javaSource instanceof JavaAnnotationSource) { visit((JavaAnnotationSource) javaSource); } else if (javaSource instanceof JavaClassSource) { visit((JavaClassSource) javaSource); } else if (javaSource instanceof JavaEnumSource) { visit((JavaEnumSource) javaSource); } else if (javaSource instanceof JavaInterfaceSource) { visit((JavaInterfaceSource) javaSource); } } JavaSourceVisitor(JavaSource javaSource, ClassLoader classLoader, Resource resParts); void visit(JavaSource javaSource); void visit(AnnotationSource<? extends JavaClassSource> annoSource); void visit(Body body); void visit(FieldSource<? extends JavaSource> fieldSource); void visit(JavaAnnotationSource javaAnnoSource); void visit(JavaClassSource javaClassSource); void visit(JavaEnumSource javaEnumSource); void visit(Import javaImport); void visit(JavaInterfaceSource interfaceSource); void visit(MethodSource<? extends JavaClassSource> methodSource); void addJavaResourceReference(String fullyQualifiedName); } |
@Test public void testSaveAndRename() throws Exception { final Path path = mock(Path.class); final Path expectedPath = mock(Path.class); final Metadata metadata = mock(Metadata.class); final PersistenceDescriptorEditorContent content = mock(PersistenceDescriptorEditorContent.class); final String newName = "newName"; final String comment = "comment"; doReturn(expectedPath).when(saveAndRenameService).saveAndRename(path, newName, metadata, content, comment); final Path actualPath = service.saveAndRename(path, newName, metadata, content, comment); verify(saveAndRenameService).saveAndRename(path, newName, metadata, content, comment); assertEquals(expectedPath, actualPath); } | @Override public Path saveAndRename(final Path path, final String newFileName, final Metadata metadata, final PersistenceDescriptorEditorContent content, final String comment) { return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment); } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path saveAndRename(final Path path, final String newFileName, final Metadata metadata, final PersistenceDescriptorEditorContent content, final String comment) { return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment); } } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path saveAndRename(final Path path, final String newFileName, final Metadata metadata, final PersistenceDescriptorEditorContent content, final String comment) { return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment); } @Inject PersistenceDescriptorEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
final PersistenceDescriptorService descriptorService,
final RenameService renameService,
final SaveAndRenameServiceImpl<PersistenceDescriptorEditorContent, Metadata> saveAndRenameService); } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path saveAndRename(final Path path, final String newFileName, final Metadata metadata, final PersistenceDescriptorEditorContent content, final String comment) { return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment); } @Inject PersistenceDescriptorEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
final PersistenceDescriptorService descriptorService,
final RenameService renameService,
final SaveAndRenameServiceImpl<PersistenceDescriptorEditorContent, Metadata> saveAndRenameService); @PostConstruct void init(); @Override PersistenceDescriptorEditorContent loadContent(Path path, boolean createIfNotExists); @Override Path save(Path path, PersistenceDescriptorEditorContent content, Metadata metadata, String comment); Pair<Path, Boolean> createIfNotExists(Path path); @Override Path saveAndRename(final Path path,
final String newFileName,
final Metadata metadata,
final PersistenceDescriptorEditorContent content,
final String comment); @Override Path rename(final Path path,
final String newName,
final String comment); } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path saveAndRename(final Path path, final String newFileName, final Metadata metadata, final PersistenceDescriptorEditorContent content, final String comment) { return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment); } @Inject PersistenceDescriptorEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
final PersistenceDescriptorService descriptorService,
final RenameService renameService,
final SaveAndRenameServiceImpl<PersistenceDescriptorEditorContent, Metadata> saveAndRenameService); @PostConstruct void init(); @Override PersistenceDescriptorEditorContent loadContent(Path path, boolean createIfNotExists); @Override Path save(Path path, PersistenceDescriptorEditorContent content, Metadata metadata, String comment); Pair<Path, Boolean> createIfNotExists(Path path); @Override Path saveAndRename(final Path path,
final String newFileName,
final Metadata metadata,
final PersistenceDescriptorEditorContent content,
final String comment); @Override Path rename(final Path path,
final String newName,
final String comment); } |
@Test public void testGraphCommandExecuteWithExistingColumn_InsertMiddle() { makeCommand(2); final InformationItem existingInformationItemFirst = new InformationItem(); relation.getColumn().add(existingInformationItemFirst); final InformationItem existingInformationItemLast = new InformationItem(); relation.getColumn().add(existingInformationItemLast); final List row = new List(); relation.getRow().add(row); final LiteralExpression existingLiteralExpressionFirst = new LiteralExpression(); final LiteralExpression existingLiteralExpressionLast = new LiteralExpression(); row.getExpression().add(HasExpression.wrap(row, existingLiteralExpressionFirst)); row.getExpression().add(HasExpression.wrap(row, existingLiteralExpressionLast)); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(3, relation.getColumn().size()); assertEquals(existingInformationItemFirst, relation.getColumn().get(0)); assertEquals(informationItem, relation.getColumn().get(1)); assertEquals(RelationDefaultValueUtilities.PREFIX + "1", informationItem.getName().getValue()); assertEquals(existingInformationItemLast, relation.getColumn().get(2)); assertEquals(1, relation.getRow().size()); assertEquals(3, relation.getRow().get(0).getExpression().size()); assertEquals(existingLiteralExpressionFirst, relation.getRow().get(0).getExpression().get(0).getExpression()); assertTrue(relation.getRow().get(0).getExpression().get(1).getExpression() instanceof LiteralExpression); assertEquals(existingLiteralExpressionLast, relation.getRow().get(0).getExpression().get(2).getExpression()); assertEquals(relation, informationItem.getParent()); assertEquals(relation.getRow().get(0), relation.getRow().get(0).getExpression().get(1).getExpression().getParent()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } |
@Test public void testRename() throws Exception { final Path path = mock(Path.class); final Path expectedPath = mock(Path.class); final String newName = "newName"; final String comment = "comment"; doReturn(expectedPath).when(renameService).rename(path, newName, comment); final Path actualPath = service.rename(path, newName, comment); verify(renameService).rename(path, newName, comment); assertEquals(expectedPath, actualPath); } | @Override public Path rename(final Path path, final String newName, final String comment) { return renameService.rename(path, newName, comment); } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path rename(final Path path, final String newName, final String comment) { return renameService.rename(path, newName, comment); } } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path rename(final Path path, final String newName, final String comment) { return renameService.rename(path, newName, comment); } @Inject PersistenceDescriptorEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
final PersistenceDescriptorService descriptorService,
final RenameService renameService,
final SaveAndRenameServiceImpl<PersistenceDescriptorEditorContent, Metadata> saveAndRenameService); } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path rename(final Path path, final String newName, final String comment) { return renameService.rename(path, newName, comment); } @Inject PersistenceDescriptorEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
final PersistenceDescriptorService descriptorService,
final RenameService renameService,
final SaveAndRenameServiceImpl<PersistenceDescriptorEditorContent, Metadata> saveAndRenameService); @PostConstruct void init(); @Override PersistenceDescriptorEditorContent loadContent(Path path, boolean createIfNotExists); @Override Path save(Path path, PersistenceDescriptorEditorContent content, Metadata metadata, String comment); Pair<Path, Boolean> createIfNotExists(Path path); @Override Path saveAndRename(final Path path,
final String newFileName,
final Metadata metadata,
final PersistenceDescriptorEditorContent content,
final String comment); @Override Path rename(final Path path,
final String newName,
final String comment); } | PersistenceDescriptorEditorServiceImpl extends KieService<PersistenceDescriptorEditorContent> implements PersistenceDescriptorEditorService { @Override public Path rename(final Path path, final String newName, final String comment) { return renameService.rename(path, newName, comment); } @Inject PersistenceDescriptorEditorServiceImpl(final @Named("ioStrategy") IOService ioService,
final PersistenceDescriptorService descriptorService,
final RenameService renameService,
final SaveAndRenameServiceImpl<PersistenceDescriptorEditorContent, Metadata> saveAndRenameService); @PostConstruct void init(); @Override PersistenceDescriptorEditorContent loadContent(Path path, boolean createIfNotExists); @Override Path save(Path path, PersistenceDescriptorEditorContent content, Metadata metadata, String comment); Pair<Path, Boolean> createIfNotExists(Path path); @Override Path saveAndRename(final Path path,
final String newFileName,
final Metadata metadata,
final PersistenceDescriptorEditorContent content,
final String comment); @Override Path rename(final Path path,
final String newName,
final String comment); } |
@Test public void testMakeMenuBar() { doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject(); doReturn(promises.resolve(true)).when(projectController).canUpdateProject(any()); presenter.makeMenuBar(); verify(menuBuilder).addSave(any(MenuItem.class)); verify(menuBuilder).addCopy(any(Path.class), any(AssetUpdateValidator.class)); verify(menuBuilder).addRename(any(Command.class)); verify(menuBuilder).addDelete(any(Path.class), any(AssetUpdateValidator.class)); verify(menuBuilder).addNewTopLevelMenu(alertsButtonMenuItem); verify(presenter).addDownloadMenuItem(menuBuilder); } | @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); static final String EDITOR_ID; } |
@Test public void testMakeMenuBarWithoutUpdateProjectPermission() { doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject(); doReturn(promises.resolve(false)).when(projectController).canUpdateProject(any()); presenter.makeMenuBar(); verify(menuBuilder, never()).addSave(any(MenuItem.class)); verify(menuBuilder, never()).addCopy(any(Path.class), any(AssetUpdateValidator.class)); verify(menuBuilder, never()).addRename(any(Command.class)); verify(menuBuilder, never()).addDelete(any(Path.class), any(AssetUpdateValidator.class)); verify(menuBuilder).addNewTopLevelMenu(alertsButtonMenuItem); } | @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); static final String EDITOR_ID; } |
@Test public void testGetContentSupplier() { final ProjectImports content = mock(ProjectImports.class); presenter.setModel(content); final Supplier<ProjectImports> contentSupplier = presenter.getContentSupplier(); assertEquals(content, contentSupplier.get()); } | @Override protected Supplier<ProjectImports> getContentSupplier() { return () -> model; } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Supplier<ProjectImports> getContentSupplier() { return () -> model; } } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Supplier<ProjectImports> getContentSupplier() { return () -> model; } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Supplier<ProjectImports> getContentSupplier() { return () -> model; } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Supplier<ProjectImports> getContentSupplier() { return () -> model; } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); static final String EDITOR_ID; } |
@Test public void testGetSaveAndRenameServiceCaller() { final Caller<? extends SupportsSaveAndRename<ProjectImports, Metadata>> serviceCaller = presenter.getSaveAndRenameServiceCaller(); assertEquals(this.serviceCaller, serviceCaller); } | @Override protected Caller<? extends SupportsSaveAndRename<ProjectImports, Metadata>> getSaveAndRenameServiceCaller() { return importsService; } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Caller<? extends SupportsSaveAndRename<ProjectImports, Metadata>> getSaveAndRenameServiceCaller() { return importsService; } } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Caller<? extends SupportsSaveAndRename<ProjectImports, Metadata>> getSaveAndRenameServiceCaller() { return importsService; } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Caller<? extends SupportsSaveAndRename<ProjectImports, Metadata>> getSaveAndRenameServiceCaller() { return importsService; } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); } | ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Caller<? extends SupportsSaveAndRename<ProjectImports, Metadata>> getSaveAndRenameServiceCaller() { return importsService; } ProjectImportsScreenPresenter(); @Inject ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
final Caller<ProjectImportsService> importsService,
final Others category); @OnStartup void init(final ObservablePath path,
final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); static final String EDITOR_ID; } |
@Test public void setupTest() { presenter.setup(); verify(view).setWelcome("welcome"); verify(view).setDescription("description"); verify(view).setBackgroundImageUrl("backgroundImageUrl"); verify(view, times(3)).addShortcut(any()); } | public void setup() { profilePreferences.load(loadedProfilePreferences -> { modelProvider.initialize(()->{ final HomeModel model = modelProvider.get(loadedProfilePreferences); view.setWelcome(model.getWelcome()); view.setDescription(model.getDescription()); view.setBackgroundImageUrl(model.getBackgroundImageUrl()); model.getShortcuts().forEach(shortcut -> { final ShortcutPresenter shortcutPresenter = shortcutPresenters.get(); shortcutPresenter.setup(shortcut); view.addShortcut(shortcutPresenter); }); }); }, RuntimeException::new); } | HomePresenter { public void setup() { profilePreferences.load(loadedProfilePreferences -> { modelProvider.initialize(()->{ final HomeModel model = modelProvider.get(loadedProfilePreferences); view.setWelcome(model.getWelcome()); view.setDescription(model.getDescription()); view.setBackgroundImageUrl(model.getBackgroundImageUrl()); model.getShortcuts().forEach(shortcut -> { final ShortcutPresenter shortcutPresenter = shortcutPresenters.get(); shortcutPresenter.setup(shortcut); view.addShortcut(shortcutPresenter); }); }); }, RuntimeException::new); } } | HomePresenter { public void setup() { profilePreferences.load(loadedProfilePreferences -> { modelProvider.initialize(()->{ final HomeModel model = modelProvider.get(loadedProfilePreferences); view.setWelcome(model.getWelcome()); view.setDescription(model.getDescription()); view.setBackgroundImageUrl(model.getBackgroundImageUrl()); model.getShortcuts().forEach(shortcut -> { final ShortcutPresenter shortcutPresenter = shortcutPresenters.get(); shortcutPresenter.setup(shortcut); view.addShortcut(shortcutPresenter); }); }); }, RuntimeException::new); } @Inject HomePresenter(final View view,
final TranslationService translationService,
final HomeModelProvider modelProvider,
final ManagedInstance<ShortcutPresenter> shortcutPresenters,
final ProfilePreferences profilePreferences); } | HomePresenter { public void setup() { profilePreferences.load(loadedProfilePreferences -> { modelProvider.initialize(()->{ final HomeModel model = modelProvider.get(loadedProfilePreferences); view.setWelcome(model.getWelcome()); view.setDescription(model.getDescription()); view.setBackgroundImageUrl(model.getBackgroundImageUrl()); model.getShortcuts().forEach(shortcut -> { final ShortcutPresenter shortcutPresenter = shortcutPresenters.get(); shortcutPresenter.setup(shortcut); view.addShortcut(shortcutPresenter); }); }); }, RuntimeException::new); } @Inject HomePresenter(final View view,
final TranslationService translationService,
final HomeModelProvider modelProvider,
final ManagedInstance<ShortcutPresenter> shortcutPresenters,
final ProfilePreferences profilePreferences); void setup(); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView UberElement<HomePresenter> getView(); } | HomePresenter { public void setup() { profilePreferences.load(loadedProfilePreferences -> { modelProvider.initialize(()->{ final HomeModel model = modelProvider.get(loadedProfilePreferences); view.setWelcome(model.getWelcome()); view.setDescription(model.getDescription()); view.setBackgroundImageUrl(model.getBackgroundImageUrl()); model.getShortcuts().forEach(shortcut -> { final ShortcutPresenter shortcutPresenter = shortcutPresenters.get(); shortcutPresenter.setup(shortcut); view.addShortcut(shortcutPresenter); }); }); }, RuntimeException::new); } @Inject HomePresenter(final View view,
final TranslationService translationService,
final HomeModelProvider modelProvider,
final ManagedInstance<ShortcutPresenter> shortcutPresenters,
final ProfilePreferences profilePreferences); void setup(); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView UberElement<HomePresenter> getView(); } |
@Test public void setupTest() { final HomeShortcut shortcut = ModelUtils.makeShortcut("iconCss iconCss2", "heading", "subHeadingPrefix{0}subHeadingSuffix", mock(Command.class)); final HomeShortcutLink link = new HomeShortcutLink("label", "perspectiveIdentifier"); shortcut.addLink(link); presenter.setup(shortcut); verify(view).addIconClass("iconCss"); verify(view).addIconClass("iconCss2"); verify(view).setHeading(shortcut.getHeading()); verify(view).setAction(shortcut.getOnClickCommand()); verify(textPresenter).setup(shortcut.getSubHeading(), 1); verify(textPresenter).setup(shortcut.getSubHeading(), 2); verify(view, times(2)).addSubHeadingChild(textPresenter.getView()); verify(linkPresenter).setup(link); verify(view).addSubHeadingChild(linkPresenter.getView()); } | public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } @Inject ShortcutPresenter(final View view,
final ShortcutHelper shortcutHelper,
final ManagedInstance<ShortcutSubHeadingLinkPresenter> linkPresenters,
final ManagedInstance<ShortcutSubHeadingTextPresenter> textPresenters); } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } @Inject ShortcutPresenter(final View view,
final ShortcutHelper shortcutHelper,
final ManagedInstance<ShortcutSubHeadingLinkPresenter> linkPresenters,
final ManagedInstance<ShortcutSubHeadingTextPresenter> textPresenters); @PostConstruct void init(); void setup(final HomeShortcut shortcut); View getView(); } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } @Inject ShortcutPresenter(final View view,
final ShortcutHelper shortcutHelper,
final ManagedInstance<ShortcutSubHeadingLinkPresenter> linkPresenters,
final ManagedInstance<ShortcutSubHeadingTextPresenter> textPresenters); @PostConstruct void init(); void setup(final HomeShortcut shortcut); View getView(); } |
@Test public void setupWithNoActionPermissionTest() { doReturn(false).when(shortcutHelper).authorize(any(HomeShortcut.class)); final HomeShortcut shortcut = ModelUtils.makeShortcut("iconCss", "heading", "subHeadingPrefix", mock(Command.class)); presenter.setup(shortcut); verify(view, never()).setAction(shortcut.getOnClickCommand()); } | public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } @Inject ShortcutPresenter(final View view,
final ShortcutHelper shortcutHelper,
final ManagedInstance<ShortcutSubHeadingLinkPresenter> linkPresenters,
final ManagedInstance<ShortcutSubHeadingTextPresenter> textPresenters); } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } @Inject ShortcutPresenter(final View view,
final ShortcutHelper shortcutHelper,
final ManagedInstance<ShortcutSubHeadingLinkPresenter> linkPresenters,
final ManagedInstance<ShortcutSubHeadingTextPresenter> textPresenters); @PostConstruct void init(); void setup(final HomeShortcut shortcut); View getView(); } | ShortcutPresenter { public void setup(final HomeShortcut shortcut) { setupIcon(shortcut); view.setHeading(shortcut.getHeading()); setupAction(shortcut); setupSubHeading(shortcut); } @Inject ShortcutPresenter(final View view,
final ShortcutHelper shortcutHelper,
final ManagedInstance<ShortcutSubHeadingLinkPresenter> linkPresenters,
final ManagedInstance<ShortcutSubHeadingTextPresenter> textPresenters); @PostConstruct void init(); void setup(final HomeShortcut shortcut); View getView(); } |
@Test public void setupWithPermissionTest() { doReturn(true).when(shortcutHelper).authorize("perspectiveIdentifier"); presenter.setup(new HomeShortcutLink("label", "perspectiveIdentifier")); verify(view).setLabel("label"); verify(view, never()).disable(); } | public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final HomeShortcutLink link); View getView(); } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final HomeShortcutLink link); View getView(); } |
@Test public void setupWithoutPermissionTest() { doReturn(false).when(shortcutHelper).authorize("perspectiveIdentifier"); presenter.setup(new HomeShortcutLink("label", "perspectiveIdentifier")); verify(view).setLabel("label"); verify(view).disable(); } | public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final HomeShortcutLink link); View getView(); } | ShortcutSubHeadingLinkPresenter { public void setup(final HomeShortcutLink link) { this.link = link; view.setLabel(link.getLabel()); if (!shortcutHelper.authorize(link.getPerspectiveIdentifier())) { view.disable(); } } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final HomeShortcutLink link); View getView(); } |
@Test public void testGraphCommandExecuteWithNoRows() { final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(1, relation.getColumn().size()); assertEquals(informationItem, relation.getColumn().get(0)); assertEquals(RelationDefaultValueUtilities.PREFIX + "1", informationItem.getName().getValue()); assertEquals(0, relation.getRow().size()); assertEquals(relation, informationItem.getParent()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } |
@Test public void goToPerspectiveTest() { presenter.setup(new HomeShortcutLink("label", "perspectiveIdentifier")); presenter.goToPerspective(); verify(shortcutHelper).goTo("perspectiveIdentifier"); } | void goToPerspective() { shortcutHelper.goTo(link.getPerspectiveIdentifier()); } | ShortcutSubHeadingLinkPresenter { void goToPerspective() { shortcutHelper.goTo(link.getPerspectiveIdentifier()); } } | ShortcutSubHeadingLinkPresenter { void goToPerspective() { shortcutHelper.goTo(link.getPerspectiveIdentifier()); } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); } | ShortcutSubHeadingLinkPresenter { void goToPerspective() { shortcutHelper.goTo(link.getPerspectiveIdentifier()); } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final HomeShortcutLink link); View getView(); } | ShortcutSubHeadingLinkPresenter { void goToPerspective() { shortcutHelper.goTo(link.getPerspectiveIdentifier()); } @Inject ShortcutSubHeadingLinkPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final HomeShortcutLink link); View getView(); } |
@Test public void setupTest() { doReturn("parsedText").when(shortcutHelper).getPart(anyString(), anyInt()); presenter.setup("text", 1); verify(view).setText("parsedText"); } | public void setup(final String text, final int part) { view.setText(shortcutHelper.getPart(text, part)); } | ShortcutSubHeadingTextPresenter { public void setup(final String text, final int part) { view.setText(shortcutHelper.getPart(text, part)); } } | ShortcutSubHeadingTextPresenter { public void setup(final String text, final int part) { view.setText(shortcutHelper.getPart(text, part)); } @Inject ShortcutSubHeadingTextPresenter(final View view,
final ShortcutHelper shortcutHelper); } | ShortcutSubHeadingTextPresenter { public void setup(final String text, final int part) { view.setText(shortcutHelper.getPart(text, part)); } @Inject ShortcutSubHeadingTextPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final String text,
final int part); View getView(); } | ShortcutSubHeadingTextPresenter { public void setup(final String text, final int part) { view.setText(shortcutHelper.getPart(text, part)); } @Inject ShortcutSubHeadingTextPresenter(final View view,
final ShortcutHelper shortcutHelper); @PostConstruct void init(); void setup(final String text,
final int part); View getView(); } |
@Test(expected = RuntimeException.class) public void partLessThanOneTest() { shortcutHelper.getPart("text", 0); } | public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test(expected = RuntimeException.class) public void nonexistentSecondPartTest() { shortcutHelper.getPart("text", 2); } | public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test(expected = RuntimeException.class) public void nonexistentThirdPartTest() { shortcutHelper.getPart("text{0}more-text", 3); } | public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test public void onlyOnePartTest() { final String text = "first-part"; final String firstPart = shortcutHelper.getPart(text, 1); assertEquals("first-part", firstPart); } | public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test public void threeValidPartsTest() { final String text = "first-part{0}second-part{1}third-part"; final String firstPart = shortcutHelper.getPart(text, 1); assertEquals("first-part", firstPart); final String secondPart = shortcutHelper.getPart(text, 2); assertEquals("second-part", secondPart); final String thirdPart = shortcutHelper.getPart(text, 3); assertEquals("third-part", thirdPart); } | public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public String getPart(final String text, final int part) { if (part < 1) { throw new RuntimeException("The first part is the number one."); } int beginIndex = 0; if (part > 1) { final int i = part - 2; final String s = "{" + i + "}"; beginIndex = text.indexOf(s); if (beginIndex < 0) { throw new RuntimeException("The translation " + text + " is missing parameters."); } else { beginIndex += String.valueOf(i).length() + 2; } } final int i2 = part - 1; final String s2 = "{" + i2 + "}"; int endIndex = text.indexOf(s2); if (endIndex < 0) { endIndex = text.length(); } return text.substring(beginIndex, endIndex); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test public void testAuthorizePositive() throws Exception { final String perspectiveId = "perspectiveId"; final ArgumentCaptor<ResourceRef> resourceRefArgumentCaptor = ArgumentCaptor.forClass(ResourceRef.class); doReturn(true).when(authorizationManager).authorize(any(ResourceRef.class), eq(user)); assertTrue(shortcutHelper.authorize(perspectiveId)); verify(authorizationManager).authorize(resourceRefArgumentCaptor.capture(), eq(user)); assertEquals(perspectiveId, resourceRefArgumentCaptor.getValue().getIdentifier()); assertEquals(ActivityResourceType.PERSPECTIVE, resourceRefArgumentCaptor.getValue().getResourceType()); } | public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test public void testAuthorizeNegative() throws Exception { final String perspectiveId = "perspectiveId"; doReturn(false).when(authorizationManager).authorize(any(ResourceRef.class), eq(user)); assertFalse(shortcutHelper.authorize(perspectiveId)); } | public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } | ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject ShortcutHelper(final AuthorizationManager authorizationManager,
final User user,
final PlaceManager placeManager); String getPart(final String text,
final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); } |
@Test public void testToKey() { final String serverTemplateId = "serverTemplateId"; final String serverName = "serverName"; final String serverInstanceId = "serverInstanceId"; final String url = "url"; ServerInstance serverInstance = new ServerInstance( serverTemplateId, serverName, serverInstanceId, url, "version", new ArrayList<Message>(), new ArrayList<Container>() ); ServerInstanceKey key = Convert.toKey( serverInstance ); assertEquals( serverTemplateId, key.getServerTemplateId() ); assertEquals( serverName, key.getServerName() ); assertEquals( serverInstanceId, key.getServerInstanceId() ); assertEquals( url, key.getUrl() ); } | public static ServerInstanceKey toKey( final ServerInstance serverInstance ) { return new ServerInstanceKey( serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl() ); } | Convert { public static ServerInstanceKey toKey( final ServerInstance serverInstance ) { return new ServerInstanceKey( serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl() ); } } | Convert { public static ServerInstanceKey toKey( final ServerInstance serverInstance ) { return new ServerInstanceKey( serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl() ); } private Convert(); } | Convert { public static ServerInstanceKey toKey( final ServerInstance serverInstance ) { return new ServerInstanceKey( serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl() ); } private Convert(); static ServerInstanceKey toKey( final ServerInstance serverInstance ); } | Convert { public static ServerInstanceKey toKey( final ServerInstance serverInstance ) { return new ServerInstanceKey( serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl() ); } private Convert(); static ServerInstanceKey toKey( final ServerInstance serverInstance ); } |
@Test public void testGraphCommandUndoWithRows() { relation.getRow().add(new List()); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(0, relation.getColumn().size()); assertEquals(1, relation.getRow().size()); assertEquals(0, relation.getRow().get(0).getExpression().size()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } |
@Test public void testOnNewContainer() { final ServerTemplate template = mock( ServerTemplate.class ); perspective.onNewContainer( new AddNewContainer( template ) ); verify( newContainerWizard ).clear(); verify( newContainerWizard ).setServerTemplate( eq( template ) ); verify( newContainerWizard ).start(); } | public void onNewContainer( @Observes final AddNewContainer addNewContainer ) { if ( addNewContainer != null && addNewContainer.getServerTemplate() != null ) { newContainerWizard.clear(); newContainerWizard.setServerTemplate( addNewContainer.getServerTemplate() ); newContainerWizard.start(); } else { logger.warn( "Illegal event argument." ); } } | ServerManagementPerspective { public void onNewContainer( @Observes final AddNewContainer addNewContainer ) { if ( addNewContainer != null && addNewContainer.getServerTemplate() != null ) { newContainerWizard.clear(); newContainerWizard.setServerTemplate( addNewContainer.getServerTemplate() ); newContainerWizard.start(); } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementPerspective { public void onNewContainer( @Observes final AddNewContainer addNewContainer ) { if ( addNewContainer != null && addNewContainer.getServerTemplate() != null ) { newContainerWizard.clear(); newContainerWizard.setServerTemplate( addNewContainer.getServerTemplate() ); newContainerWizard.start(); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementPerspective( final Logger logger,
final NewServerTemplateWizard newServerTemplateWizard,
final NewContainerWizard newContainerWizard ); } | ServerManagementPerspective { public void onNewContainer( @Observes final AddNewContainer addNewContainer ) { if ( addNewContainer != null && addNewContainer.getServerTemplate() != null ) { newContainerWizard.clear(); newContainerWizard.setServerTemplate( addNewContainer.getServerTemplate() ); newContainerWizard.start(); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementPerspective( final Logger logger,
final NewServerTemplateWizard newServerTemplateWizard,
final NewContainerWizard newContainerWizard ); @Perspective PerspectiveDefinition buildPerspective(); void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ); void onNewContainer( @Observes final AddNewContainer addNewContainer ); } | ServerManagementPerspective { public void onNewContainer( @Observes final AddNewContainer addNewContainer ) { if ( addNewContainer != null && addNewContainer.getServerTemplate() != null ) { newContainerWizard.clear(); newContainerWizard.setServerTemplate( addNewContainer.getServerTemplate() ); newContainerWizard.start(); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementPerspective( final Logger logger,
final NewServerTemplateWizard newServerTemplateWizard,
final NewContainerWizard newContainerWizard ); @Perspective PerspectiveDefinition buildPerspective(); void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ); void onNewContainer( @Observes final AddNewContainer addNewContainer ); } |
@Test public void testOnNewTemplate() { perspective.onNewTemplate( new AddNewServerTemplate() ); verify( newServerTemplateWizard ).clear(); verify( newServerTemplateWizard ).start(); } | public void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ) { if ( addNewServerTemplate != null ) { newServerTemplateWizard.clear(); newServerTemplateWizard.start(); } else { logger.warn( "Illegal event argument." ); } } | ServerManagementPerspective { public void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ) { if ( addNewServerTemplate != null ) { newServerTemplateWizard.clear(); newServerTemplateWizard.start(); } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementPerspective { public void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ) { if ( addNewServerTemplate != null ) { newServerTemplateWizard.clear(); newServerTemplateWizard.start(); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementPerspective( final Logger logger,
final NewServerTemplateWizard newServerTemplateWizard,
final NewContainerWizard newContainerWizard ); } | ServerManagementPerspective { public void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ) { if ( addNewServerTemplate != null ) { newServerTemplateWizard.clear(); newServerTemplateWizard.start(); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementPerspective( final Logger logger,
final NewServerTemplateWizard newServerTemplateWizard,
final NewContainerWizard newContainerWizard ); @Perspective PerspectiveDefinition buildPerspective(); void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ); void onNewContainer( @Observes final AddNewContainer addNewContainer ); } | ServerManagementPerspective { public void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ) { if ( addNewServerTemplate != null ) { newServerTemplateWizard.clear(); newServerTemplateWizard.start(); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementPerspective( final Logger logger,
final NewServerTemplateWizard newServerTemplateWizard,
final NewContainerWizard newContainerWizard ); @Perspective PerspectiveDefinition buildPerspective(); void onNewTemplate( @Observes final AddNewServerTemplate addNewServerTemplate ); void onNewContainer( @Observes final AddNewContainer addNewContainer ); } |
@Test public void testInit() { presenter.init(); verify( view ).init( presenter ); assertEquals( view, presenter.getView() ); } | @PostConstruct public void init() { view.init( this ); } | ServerEmptyPresenter { @PostConstruct public void init() { view.init( this ); } } | ServerEmptyPresenter { @PostConstruct public void init() { view.init( this ); } @Inject ServerEmptyPresenter( final View view,
final Event<AddNewServerTemplate> addNewServerTemplateEvent ); } | ServerEmptyPresenter { @PostConstruct public void init() { view.init( this ); } @Inject ServerEmptyPresenter( final View view,
final Event<AddNewServerTemplate> addNewServerTemplateEvent ); @PostConstruct void init(); View getView(); void addTemplate(); } | ServerEmptyPresenter { @PostConstruct public void init() { view.init( this ); } @Inject ServerEmptyPresenter( final View view,
final Event<AddNewServerTemplate> addNewServerTemplateEvent ); @PostConstruct void init(); View getView(); void addTemplate(); } |
@Test public void testAddTemplate() { presenter.addTemplate(); verify( addNewServerTemplateEvent ).fire( any( AddNewServerTemplate.class ) ); } | public void addTemplate() { addNewServerTemplateEvent.fire( new AddNewServerTemplate() ); } | ServerEmptyPresenter { public void addTemplate() { addNewServerTemplateEvent.fire( new AddNewServerTemplate() ); } } | ServerEmptyPresenter { public void addTemplate() { addNewServerTemplateEvent.fire( new AddNewServerTemplate() ); } @Inject ServerEmptyPresenter( final View view,
final Event<AddNewServerTemplate> addNewServerTemplateEvent ); } | ServerEmptyPresenter { public void addTemplate() { addNewServerTemplateEvent.fire( new AddNewServerTemplate() ); } @Inject ServerEmptyPresenter( final View view,
final Event<AddNewServerTemplate> addNewServerTemplateEvent ); @PostConstruct void init(); View getView(); void addTemplate(); } | ServerEmptyPresenter { public void addTemplate() { addNewServerTemplateEvent.fire( new AddNewServerTemplate() ); } @Inject ServerEmptyPresenter( final View view,
final Event<AddNewServerTemplate> addNewServerTemplateEvent ); @PostConstruct void init(); View getView(); void addTemplate(); } |
@Test public void testClear() { presenter.clear(); verify( processConfigPresenter ).clear(); } | public void clear() { processConfigPresenter.clear(); } | ProcessConfigPagePresenter implements WizardPage { public void clear() { processConfigPresenter.clear(); } } | ProcessConfigPagePresenter implements WizardPage { public void clear() { processConfigPresenter.clear(); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); } | ProcessConfigPagePresenter implements WizardPage { public void clear() { processConfigPresenter.clear(); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); @Override String getTitle(); @Override void isComplete( final Callback<Boolean> callback ); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); ProcessConfig buildProcessConfig(); void clear(); } | ProcessConfigPagePresenter implements WizardPage { public void clear() { processConfigPresenter.clear(); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); @Override String getTitle(); @Override void isComplete( final Callback<Boolean> callback ); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); ProcessConfig buildProcessConfig(); void clear(); } |
@Test public void testBuildProcessConfig() { presenter.buildProcessConfig(); verify( processConfigPresenter ).buildProcessConfig(); } | public ProcessConfig buildProcessConfig(){ return processConfigPresenter.buildProcessConfig(); } | ProcessConfigPagePresenter implements WizardPage { public ProcessConfig buildProcessConfig(){ return processConfigPresenter.buildProcessConfig(); } } | ProcessConfigPagePresenter implements WizardPage { public ProcessConfig buildProcessConfig(){ return processConfigPresenter.buildProcessConfig(); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); } | ProcessConfigPagePresenter implements WizardPage { public ProcessConfig buildProcessConfig(){ return processConfigPresenter.buildProcessConfig(); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); @Override String getTitle(); @Override void isComplete( final Callback<Boolean> callback ); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); ProcessConfig buildProcessConfig(); void clear(); } | ProcessConfigPagePresenter implements WizardPage { public ProcessConfig buildProcessConfig(){ return processConfigPresenter.buildProcessConfig(); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); @Override String getTitle(); @Override void isComplete( final Callback<Boolean> callback ); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); ProcessConfig buildProcessConfig(); void clear(); } |
@Test public void testIsComplete() { final Callback<Boolean> callback = mock( Callback.class ); presenter.isComplete( callback ); verify( callback ).callback( true ); } | @Override public void isComplete( final Callback<Boolean> callback ) { callback.callback( true ); } | ProcessConfigPagePresenter implements WizardPage { @Override public void isComplete( final Callback<Boolean> callback ) { callback.callback( true ); } } | ProcessConfigPagePresenter implements WizardPage { @Override public void isComplete( final Callback<Boolean> callback ) { callback.callback( true ); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); } | ProcessConfigPagePresenter implements WizardPage { @Override public void isComplete( final Callback<Boolean> callback ) { callback.callback( true ); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); @Override String getTitle(); @Override void isComplete( final Callback<Boolean> callback ); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); ProcessConfig buildProcessConfig(); void clear(); } | ProcessConfigPagePresenter implements WizardPage { @Override public void isComplete( final Callback<Boolean> callback ) { callback.callback( true ); } @Inject ProcessConfigPagePresenter( final ProcessConfigPresenter processConfigPresenter ); @Override String getTitle(); @Override void isComplete( final Callback<Boolean> callback ); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); ProcessConfig buildProcessConfig(); void clear(); } |
@Test public void testTitle() { final String title = "title"; when( newTemplatePresenterView.getNewServerTemplateWizardTitle() ).thenReturn( title ); assertEquals( title, newServerTemplateWizard.getTitle() ); verify( newTemplatePresenterView ).getNewServerTemplateWizardTitle(); } | @Override public String getTitle() { return newTemplatePresenter.getView().getNewServerTemplateWizardTitle(); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newTemplatePresenter.getView().getNewServerTemplateWizardTitle(); } } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newTemplatePresenter.getView().getNewServerTemplateWizardTitle(); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newTemplatePresenter.getView().getNewServerTemplateWizardTitle(); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newTemplatePresenter.getView().getNewServerTemplateWizardTitle(); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } |
@Test public void testComplete() { ServerTemplate serverTemplate = new ServerTemplate("template-name", "template-name"); serverTemplate.setMode(KieServerMode.DEVELOPMENT); serverTemplate.setCapabilities(singletonList(Capability.PROCESS.toString())); when( newTemplatePresenter.isProcessCapabilityChecked() ).thenReturn( true ); when( newContainerFormPresenter.isEmpty() ).thenReturn( true ); when( newContainerFormPresenter.isEmpty() ).thenReturn( true ); when( newTemplatePresenter.getTemplateName() ).thenReturn( "template-name" ); final String successMessage = "SUCCESS"; when( newTemplatePresenterView.getNewServerTemplateWizardSaveSuccess() ).thenReturn( successMessage ); newServerTemplateWizard.complete(); ArgumentCaptor<ServerTemplate> serverTemplateCapture = ArgumentCaptor.forClass(ServerTemplate.class); verify(specManagementService).saveServerTemplate(serverTemplateCapture.capture()); assertEquals(KieServerMode.DEVELOPMENT, serverTemplateCapture.getValue().getMode()); verify( notification ).fire( new NotificationEvent( successMessage, NotificationEvent.NotificationType.SUCCESS ) ); verifyClear(); verify( serverTemplateListRefreshEvent ).fire( new ServerTemplateListRefresh( "template-name" ) ); doThrow( new RuntimeException() ).when( specManagementService ).saveServerTemplate( any( ServerTemplate.class ) ); final String errorMessage = "ERROR"; when( newTemplatePresenterView.getNewServerTemplateWizardSaveError() ).thenReturn( errorMessage ); newServerTemplateWizard.complete(); verify( notification ).fire( new NotificationEvent( errorMessage, NotificationEvent.NotificationType.ERROR ) ); verify( newServerTemplateWizard ).pageSelected( 0 ); verify( newServerTemplateWizard ).start(); verify( newContainerFormPresenter ).initialise(); } | @Override public void complete() { final ServerTemplate newServerTemplate = buildServerTemplate(); specManagementService.call( new RemoteCallback<Void>() { @Override public void callback( final Void o ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS ) ); clear(); NewServerTemplateWizard.super.complete(); serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh( newServerTemplate.getId() ) ); } }, new ErrorCallback<Object>() { @Override public boolean error( final Object o, final Throwable throwable ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveError(), NotificationEvent.NotificationType.ERROR ) ); NewServerTemplateWizard.this.pageSelected( 0 ); NewServerTemplateWizard.this.start(); return false; } } ).saveServerTemplate( newServerTemplate ); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void complete() { final ServerTemplate newServerTemplate = buildServerTemplate(); specManagementService.call( new RemoteCallback<Void>() { @Override public void callback( final Void o ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS ) ); clear(); NewServerTemplateWizard.super.complete(); serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh( newServerTemplate.getId() ) ); } }, new ErrorCallback<Object>() { @Override public boolean error( final Object o, final Throwable throwable ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveError(), NotificationEvent.NotificationType.ERROR ) ); NewServerTemplateWizard.this.pageSelected( 0 ); NewServerTemplateWizard.this.start(); return false; } } ).saveServerTemplate( newServerTemplate ); } } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void complete() { final ServerTemplate newServerTemplate = buildServerTemplate(); specManagementService.call( new RemoteCallback<Void>() { @Override public void callback( final Void o ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS ) ); clear(); NewServerTemplateWizard.super.complete(); serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh( newServerTemplate.getId() ) ); } }, new ErrorCallback<Object>() { @Override public boolean error( final Object o, final Throwable throwable ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveError(), NotificationEvent.NotificationType.ERROR ) ); NewServerTemplateWizard.this.pageSelected( 0 ); NewServerTemplateWizard.this.start(); return false; } } ).saveServerTemplate( newServerTemplate ); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void complete() { final ServerTemplate newServerTemplate = buildServerTemplate(); specManagementService.call( new RemoteCallback<Void>() { @Override public void callback( final Void o ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS ) ); clear(); NewServerTemplateWizard.super.complete(); serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh( newServerTemplate.getId() ) ); } }, new ErrorCallback<Object>() { @Override public boolean error( final Object o, final Throwable throwable ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveError(), NotificationEvent.NotificationType.ERROR ) ); NewServerTemplateWizard.this.pageSelected( 0 ); NewServerTemplateWizard.this.start(); return false; } } ).saveServerTemplate( newServerTemplate ); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void complete() { final ServerTemplate newServerTemplate = buildServerTemplate(); specManagementService.call( new RemoteCallback<Void>() { @Override public void callback( final Void o ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS ) ); clear(); NewServerTemplateWizard.super.complete(); serverTemplateListRefreshEvent.fire( new ServerTemplateListRefresh( newServerTemplate.getId() ) ); } }, new ErrorCallback<Object>() { @Override public boolean error( final Object o, final Throwable throwable ) { notification.fire( new NotificationEvent( newTemplatePresenter.getView().getNewServerTemplateWizardSaveError(), NotificationEvent.NotificationType.ERROR ) ); NewServerTemplateWizard.this.pageSelected( 0 ); NewServerTemplateWizard.this.start(); return false; } } ).saveServerTemplate( newServerTemplate ); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } |
@Test public void testClear() { newServerTemplateWizard.clear(); verifyClear(); } | public void clear() { newTemplatePresenter.clear(); newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newTemplatePresenter ); pages.add( newContainerFormPresenter ); } | NewServerTemplateWizard extends AbstractMultiPageWizard { public void clear() { newTemplatePresenter.clear(); newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newTemplatePresenter ); pages.add( newContainerFormPresenter ); } } | NewServerTemplateWizard extends AbstractMultiPageWizard { public void clear() { newTemplatePresenter.clear(); newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newTemplatePresenter ); pages.add( newContainerFormPresenter ); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); } | NewServerTemplateWizard extends AbstractMultiPageWizard { public void clear() { newTemplatePresenter.clear(); newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newTemplatePresenter ); pages.add( newContainerFormPresenter ); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } | NewServerTemplateWizard extends AbstractMultiPageWizard { public void clear() { newTemplatePresenter.clear(); newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newTemplatePresenter ); pages.add( newContainerFormPresenter ); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } |
@Test public void testGraphCommandUndoWithNoRows() { final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(0, relation.getColumn().size()); assertEquals(0, relation.getRow().size()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getComponentWidths().add(uiColumnIndex, null); final int iiIndex = uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; relation.getColumn().add(iiIndex, informationItem); informationItem.getName().setValue(name); relation.getRow().forEach(row -> { final LiteralExpression le = new LiteralExpression(); final HasExpression hasExpression = HasExpression.wrap(row, le); row.getExpression().add(iiIndex, hasExpression); le.setParent(row); }); informationItem.setParent(relation); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getComponentWidths().remove(uiColumnIndex); final int columnIndex = relation.getColumn().indexOf(informationItem); relation.getRow().forEach(row -> row.getExpression().remove(columnIndex)); relation.getColumn().remove(informationItem); return GraphCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } |
@Test public void testGetResponseBuilder() { assertEquals(responseBuilder, query.getResponseBuilder()); } | @Override public ResponseBuilder getResponseBuilder() { return responseBuilder; } | FindAllDmnAssetsQuery extends AbstractFindQuery implements NamedQuery { @Override public ResponseBuilder getResponseBuilder() { return responseBuilder; } } | FindAllDmnAssetsQuery extends AbstractFindQuery implements NamedQuery { @Override public ResponseBuilder getResponseBuilder() { return responseBuilder; } @Inject FindAllDmnAssetsQuery(final FileDetailsResponseBuilder responseBuilder); } | FindAllDmnAssetsQuery extends AbstractFindQuery implements NamedQuery { @Override public ResponseBuilder getResponseBuilder() { return responseBuilder; } @Inject FindAllDmnAssetsQuery(final FileDetailsResponseBuilder responseBuilder); @Override String getName(); @Override Query toQuery(final Set<ValueIndexTerm> terms); @Override Sort getSortOrder(); @Override ResponseBuilder getResponseBuilder(); @Override void validateTerms(final Set<ValueIndexTerm> queryTerms); } | FindAllDmnAssetsQuery extends AbstractFindQuery implements NamedQuery { @Override public ResponseBuilder getResponseBuilder() { return responseBuilder; } @Inject FindAllDmnAssetsQuery(final FileDetailsResponseBuilder responseBuilder); @Override String getName(); @Override Query toQuery(final Set<ValueIndexTerm> terms); @Override Sort getSortOrder(); @Override ResponseBuilder getResponseBuilder(); @Override void validateTerms(final Set<ValueIndexTerm> queryTerms); static String NAME; } |
@Test public void testClose() { newServerTemplateWizard.close(); verifyClear(); } | @Override public void close() { super.close(); clear(); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } | NewServerTemplateWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } NewServerTemplateWizard(); @Inject NewServerTemplateWizard( final NewTemplatePresenter newTemplatePresenter,
final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateListRefresh> serverTemplateListRefreshEvent ); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void clear(); @Override void close(); @Override void complete(); } |
@Test public void testTitle() { final String title = "title"; when( newContainerFormPresenterView.getNewContainerWizardTitle() ).thenReturn( title ); assertEquals( title, newContainerWizard.getTitle() ); verify( newContainerFormPresenterView ).getNewContainerWizardTitle(); } | @Override public String getTitle() { return newContainerFormPresenter.getView().getNewContainerWizardTitle(); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newContainerFormPresenter.getView().getNewContainerWizardTitle(); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newContainerFormPresenter.getView().getNewContainerWizardTitle(); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newContainerFormPresenter.getView().getNewContainerWizardTitle(); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public String getTitle() { return newContainerFormPresenter.getView().getNewContainerWizardTitle(); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testClear() { newContainerWizard.clear(); verifyClear(); } | public void clear() { newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newContainerFormPresenter ); isSelected = false; } | NewContainerWizard extends AbstractMultiPageWizard { public void clear() { newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newContainerFormPresenter ); isSelected = false; } } | NewContainerWizard extends AbstractMultiPageWizard { public void clear() { newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newContainerFormPresenter ); isSelected = false; } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { public void clear() { newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newContainerFormPresenter ); isSelected = false; } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { public void clear() { newContainerFormPresenter.clear(); processConfigPagePresenter.clear(); pages.clear(); pages.add( newContainerFormPresenter ); isSelected = false; } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testSetServerTemplate() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); serverTemplate.getCapabilities().add( Capability.PROCESS.toString() ); newContainerWizard.setServerTemplate( serverTemplate ); verify( newContainerFormPresenter ).setServerTemplate( serverTemplate ); assertEquals( 2, newContainerWizard.getPages().size() ); assertTrue( newContainerWizard.getPages().contains( newContainerFormPresenter ) ); assertTrue( newContainerWizard.getPages().contains( processConfigPagePresenter ) ); } | public void setServerTemplate( final ServerTemplate serverTemplate ) { this.serverTemplate = serverTemplate; newContainerFormPresenter.setServerTemplate( serverTemplate ); pages.clear(); pages.add( newContainerFormPresenter ); if ( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) ) { pages.add( processConfigPagePresenter ); } } | NewContainerWizard extends AbstractMultiPageWizard { public void setServerTemplate( final ServerTemplate serverTemplate ) { this.serverTemplate = serverTemplate; newContainerFormPresenter.setServerTemplate( serverTemplate ); pages.clear(); pages.add( newContainerFormPresenter ); if ( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) ) { pages.add( processConfigPagePresenter ); } } } | NewContainerWizard extends AbstractMultiPageWizard { public void setServerTemplate( final ServerTemplate serverTemplate ) { this.serverTemplate = serverTemplate; newContainerFormPresenter.setServerTemplate( serverTemplate ); pages.clear(); pages.add( newContainerFormPresenter ); if ( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) ) { pages.add( processConfigPagePresenter ); } } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { public void setServerTemplate( final ServerTemplate serverTemplate ) { this.serverTemplate = serverTemplate; newContainerFormPresenter.setServerTemplate( serverTemplate ); pages.clear(); pages.add( newContainerFormPresenter ); if ( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) ) { pages.add( processConfigPagePresenter ); } } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { public void setServerTemplate( final ServerTemplate serverTemplate ) { this.serverTemplate = serverTemplate; newContainerFormPresenter.setServerTemplate( serverTemplate ); pages.clear(); pages.add( newContainerFormPresenter ); if ( serverTemplate.getCapabilities().contains( Capability.PROCESS.toString() ) ) { pages.add( processConfigPagePresenter ); } } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testComplete() { final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); serverTemplate.getCapabilities().add( Capability.PROCESS.toString() ); final ContainerSpec containerSpec = new ContainerSpec(); containerSpec.setId( "containerSpecId" ); PageResponse<JarListPageRow> response = new PageResponse<JarListPageRow>(); JarListPageRow jarListPageRow = new JarListPageRow(); GAV gav = new GAV("test", "test", "1.0"); containerSpec.setReleasedId(new ReleaseId(gav.getGroupId(), gav.getArtifactId(), gav.getVersion())); jarListPageRow.setGav(gav); jarListPageRow.setPath("test_path"); response.setPageRowList(Arrays.asList(jarListPageRow)); when(m2RepoService.listArtifacts(any())).thenReturn(response); when( newContainerFormPresenter.buildContainerSpec( eq( serverTemplate.getId() ), anyMap() ) ).thenReturn( containerSpec ); when( newContainerFormPresenter.getServerTemplate() ).thenReturn( serverTemplate ); final String successMessage = "SUCCESS"; when( newContainerFormPresenterView.getNewContainerWizardSaveSuccess() ).thenReturn( successMessage ); newContainerWizard.setServerTemplate( serverTemplate ); newContainerWizard.complete(); verify( processConfigPagePresenter ).buildProcessConfig(); verify( newContainerFormPresenter ).buildContainerSpec( eq( serverTemplate.getId() ), anyMap() ); verify(newContainerFormPresenter).showBusyIndicator(containerSpec.getReleasedId().toString()); verify(newContainerFormPresenter).hideBusyIndicator(); final ArgumentCaptor<NotificationEvent> eventCaptor = ArgumentCaptor.forClass( NotificationEvent.class ); verify( notification ).fire( eventCaptor.capture() ); final NotificationEvent event = eventCaptor.getValue(); assertEquals( successMessage, event.getNotification() ); assertEquals( NotificationEvent.NotificationType.SUCCESS, event.getType() ); final ArgumentCaptor<ServerTemplateSelected> serverTemplateEventCaptor = ArgumentCaptor.forClass( ServerTemplateSelected.class ); verify( serverTemplateSelectedEvent ).fire( serverTemplateEventCaptor.capture() ); final ServerTemplateSelected serverEvent = serverTemplateEventCaptor.getValue(); assertEquals( serverTemplate, serverEvent.getServerTemplateKey() ); assertEquals( containerSpec.getId(), serverEvent.getContainerId() ); verifyClear(); doThrow( new RuntimeException() ).when( specManagementService ).saveContainerSpec( anyString(), any( ContainerSpec.class ) ); final String errorMessage = "ERROR"; when( newContainerFormPresenterView.getNewContainerWizardSaveError() ).thenReturn( errorMessage ); newContainerWizard.complete(); verify( notification ).fire( new NotificationEvent( errorMessage, NotificationEvent.NotificationType.ERROR ) ); verify( newContainerWizard ).pageSelected( 0 ); verify( newContainerWizard ).start(); verify( newContainerFormPresenter ).initialise(); } | @Override public void complete() { final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>(); if (getPages().size() == 2) { mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig()); } mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED)); final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig); GAV gav = new GAV(newContainer.getReleasedId().getGroupId(), newContainer.getReleasedId().getArtifactId(), newContainer.getReleasedId().getVersion()); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)).findFirst(); if (optionalJarListPageRow.isPresent()) { saveContainerSpec(newContainer); } else { confirmPopup.show(newContainerFormPresenter.getView().getNewContainerSaveContainerSpec(), newContainerFormPresenter.getView().getNewContainerSave(), newContainerFormPresenter.getView().getNewContainerGAVNotExistSave(gav.toString()), () -> saveContainerSpec(newContainer)); } }).listArtifacts(request); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void complete() { final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>(); if (getPages().size() == 2) { mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig()); } mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED)); final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig); GAV gav = new GAV(newContainer.getReleasedId().getGroupId(), newContainer.getReleasedId().getArtifactId(), newContainer.getReleasedId().getVersion()); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)).findFirst(); if (optionalJarListPageRow.isPresent()) { saveContainerSpec(newContainer); } else { confirmPopup.show(newContainerFormPresenter.getView().getNewContainerSaveContainerSpec(), newContainerFormPresenter.getView().getNewContainerSave(), newContainerFormPresenter.getView().getNewContainerGAVNotExistSave(gav.toString()), () -> saveContainerSpec(newContainer)); } }).listArtifacts(request); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void complete() { final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>(); if (getPages().size() == 2) { mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig()); } mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED)); final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig); GAV gav = new GAV(newContainer.getReleasedId().getGroupId(), newContainer.getReleasedId().getArtifactId(), newContainer.getReleasedId().getVersion()); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)).findFirst(); if (optionalJarListPageRow.isPresent()) { saveContainerSpec(newContainer); } else { confirmPopup.show(newContainerFormPresenter.getView().getNewContainerSaveContainerSpec(), newContainerFormPresenter.getView().getNewContainerSave(), newContainerFormPresenter.getView().getNewContainerGAVNotExistSave(gav.toString()), () -> saveContainerSpec(newContainer)); } }).listArtifacts(request); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void complete() { final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>(); if (getPages().size() == 2) { mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig()); } mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED)); final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig); GAV gav = new GAV(newContainer.getReleasedId().getGroupId(), newContainer.getReleasedId().getArtifactId(), newContainer.getReleasedId().getVersion()); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)).findFirst(); if (optionalJarListPageRow.isPresent()) { saveContainerSpec(newContainer); } else { confirmPopup.show(newContainerFormPresenter.getView().getNewContainerSaveContainerSpec(), newContainerFormPresenter.getView().getNewContainerSave(), newContainerFormPresenter.getView().getNewContainerGAVNotExistSave(gav.toString()), () -> saveContainerSpec(newContainer)); } }).listArtifacts(request); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void complete() { final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>(); if (getPages().size() == 2) { mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig()); } mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED)); final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig); GAV gav = new GAV(newContainer.getReleasedId().getGroupId(), newContainer.getReleasedId().getArtifactId(), newContainer.getReleasedId().getVersion()); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)).findFirst(); if (optionalJarListPageRow.isPresent()) { saveContainerSpec(newContainer); } else { confirmPopup.show(newContainerFormPresenter.getView().getNewContainerSaveContainerSpec(), newContainerFormPresenter.getView().getNewContainerSave(), newContainerFormPresenter.getView().getNewContainerGAVNotExistSave(gav.toString()), () -> saveContainerSpec(newContainer)); } }).listArtifacts(request); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testClose() { newContainerWizard.close(); verifyClear(); } | @Override public void close() { super.close(); clear(); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void close() { super.close(); clear(); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testPageSelectedPageTwo() { preparePageSelected(); newContainerWizard.pageSelected(1); verify(dependencyPathSelectedEvent).fire(any()); } | @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testPageSelectedPageOne() { preparePageSelected(); newContainerWizard.pageSelected(0); verify(dependencyPathSelectedEvent, never()).fire(any()); verify(notification, never()).fire(any()); } | @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testPageSelectedIsSelected() { preparePageSelected(); newContainerWizard.isSelected = true; newContainerWizard.pageSelected(1); verify(dependencyPathSelectedEvent, never()).fire(any()); verify(notification, never()).fire(any()); } | @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testPageSelectedWithEmptyPath() { PageResponse<JarListPageRow> response = new PageResponse<JarListPageRow>(); JarListPageRow jarListPageRow = new JarListPageRow(); GAV gav = new GAV("test", "test", ""); jarListPageRow.setGav(gav); jarListPageRow.setPath(""); response.setPageRowList(Arrays.asList(jarListPageRow)); when(m2RepoService.listArtifacts(any())).thenReturn(response); when(newContainerFormPresenter.getCurrentGAV()).thenReturn(gav); newContainerWizard.pages.add(mock(WizardPage.class)); newContainerWizard.pages.add(mock(WizardPage.class)); newContainerWizard.pageSelected(1); verify(dependencyPathSelectedEvent, never()).fire(any()); verify(notification, never()).fire(any()); } | @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testCanvasCommandAllow() { final Command<AbstractCanvasHandler, CanvasViolation> c = command.newCanvasCommand(handler); assertEquals(CanvasCommandResultBuilder.SUCCESS, c.allow(handler)); } | @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } | AddRelationColumnCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
final InformationItem informationItem,
final GridData uiModel,
final Supplier<RelationColumn> uiModelColumnSupplier,
final int uiColumnIndex,
final RelationUIModelMapper uiModelMapper,
final org.uberfire.mvp.Command executeCanvasOperation,
final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); } |
@Test public void testPageSelectedWithNullPath() { PageResponse<JarListPageRow> response = new PageResponse<JarListPageRow>(); JarListPageRow jarListPageRow = new JarListPageRow(); GAV gav = new GAV("test", "test", ""); jarListPageRow.setGav(gav); jarListPageRow.setPath(null); response.setPageRowList(Arrays.asList(jarListPageRow)); when(m2RepoService.listArtifacts(any())).thenReturn(response); when(newContainerFormPresenter.getCurrentGAV()).thenReturn(gav); newContainerWizard.pages.add(mock(WizardPage.class)); newContainerWizard.pages.add(mock(WizardPage.class)); newContainerWizard.pageSelected(1); verify(dependencyPathSelectedEvent, never()).fire(any()); verify(notification, never()).fire(any()); } | @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testPageSelectedCanNotFind() { PageResponse<JarListPageRow> response = new PageResponse<JarListPageRow>(); JarListPageRow jarListPageRow = new JarListPageRow(); GAV gav = new GAV("test", "test", ""); jarListPageRow.setGav(new GAV("test1", "test1", "1.0")); jarListPageRow.setPath("test_path"); response.setPageRowList(Arrays.asList(jarListPageRow)); when(m2RepoService.listArtifacts(any())).thenReturn(response); when(newContainerFormPresenter.getCurrentGAV()).thenReturn(gav); final String gavNotFind = "NOTFIND"; when(newContainerFormPresenterView.getNewContainerGAVNotExist(any())).thenReturn(gavNotFind); newContainerWizard.pages.add(mock(WizardPage.class)); newContainerWizard.pages.add(mock(WizardPage.class)); newContainerWizard.pageSelected(1); final ArgumentCaptor<NotificationEvent> eventCaptor = ArgumentCaptor.forClass(NotificationEvent.class); verify(notification).fire(eventCaptor.capture()); final NotificationEvent event = eventCaptor.getValue(); assertEquals(gavNotFind, event.getNotification()); } | @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { @Override public void pageSelected(final int pageNumber) { if (this.getSelectedPage() == pageNumber) { return; } if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testOnDependencyPathSelectedEvent() { assertFalse(newContainerWizard.isSelected); newContainerWizard.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent("null", "test")); assertTrue(newContainerWizard.isSelected); } | public void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event){ this.isSelected = true; } | NewContainerWizard extends AbstractMultiPageWizard { public void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event){ this.isSelected = true; } } | NewContainerWizard extends AbstractMultiPageWizard { public void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event){ this.isSelected = true; } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); } | NewContainerWizard extends AbstractMultiPageWizard { public void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event){ this.isSelected = true; } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } | NewContainerWizard extends AbstractMultiPageWizard { public void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event){ this.isSelected = true; } @Inject NewContainerWizard(final NewContainerFormPresenter newContainerFormPresenter,
final ProcessConfigPagePresenter processConfigPagePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<NotificationEvent> notification,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<DependencyPathSelectedEvent> dependencyPathSelectedEvent,
final Caller<M2RepoService> m2RepoService,
final ConfirmPopup confirmPopup); @Override void start(); @Override String getTitle(); @Override int getPreferredHeight(); @Override int getPreferredWidth(); void setServerTemplate( final ServerTemplate serverTemplate ); void clear(); @Override void close(); @Override void complete(); void onDependencyPathSelectedEvent(@Observes DependencyPathSelectedEvent event); @Override void pageSelected(final int pageNumber); } |
@Test public void testInit() { presenter.init(); final ContentChangeHandler contentChangeHandler = mock(ContentChangeHandler.class); presenter.addContentChangeHandler(contentChangeHandler); view.setVersion("1.0"); view.setArtifactId("artifact"); view.setGroupId("group"); verify(view).init(presenter); verify(wizardPageStatusChangeEvent, times(3)).fire(any(WizardPageStatusChangeEvent.class)); verify(contentChangeHandler, times(3)).onContentChange(); } | @PostConstruct public void init() { view.init(this); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }); } | NewContainerFormPresenter implements WizardPage { @PostConstruct public void init() { view.init(this); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }); } } | NewContainerFormPresenter implements WizardPage { @PostConstruct public void init() { view.init(this); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewContainerFormPresenter implements WizardPage { @PostConstruct public void init() { view.init(this); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); } | NewContainerFormPresenter implements WizardPage { @PostConstruct public void init() { view.init(this); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; } |
@Test public void testClear() { presenter.clear(); verify(view).clear(); assertEquals(NewContainerFormPresenter.Mode.OPTIONAL, presenter.getMode()); assertNull(presenter.getServerTemplate()); } | public void clear() { serverTemplate = null; mode = Mode.OPTIONAL; view.clear(); } | NewContainerFormPresenter implements WizardPage { public void clear() { serverTemplate = null; mode = Mode.OPTIONAL; view.clear(); } } | NewContainerFormPresenter implements WizardPage { public void clear() { serverTemplate = null; mode = Mode.OPTIONAL; view.clear(); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewContainerFormPresenter implements WizardPage { public void clear() { serverTemplate = null; mode = Mode.OPTIONAL; view.clear(); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); } | NewContainerFormPresenter implements WizardPage { public void clear() { serverTemplate = null; mode = Mode.OPTIONAL; view.clear(); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; } |
@Test public void testIsEmpty() { when(view.getContainerName()).thenReturn(" "); when(view.getGroupId()).thenReturn(" "); when(view.getArtifactId()).thenReturn(" "); when(view.getVersion()).thenReturn(" "); assertTrue(presenter.isEmpty()); } | public boolean isEmpty() { return view.getContainerName().trim().isEmpty() && view.getGroupId().trim().isEmpty() && view.getArtifactId().trim().isEmpty() && view.getVersion().trim().isEmpty(); } | NewContainerFormPresenter implements WizardPage { public boolean isEmpty() { return view.getContainerName().trim().isEmpty() && view.getGroupId().trim().isEmpty() && view.getArtifactId().trim().isEmpty() && view.getVersion().trim().isEmpty(); } } | NewContainerFormPresenter implements WizardPage { public boolean isEmpty() { return view.getContainerName().trim().isEmpty() && view.getGroupId().trim().isEmpty() && view.getArtifactId().trim().isEmpty() && view.getVersion().trim().isEmpty(); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewContainerFormPresenter implements WizardPage { public boolean isEmpty() { return view.getContainerName().trim().isEmpty() && view.getGroupId().trim().isEmpty() && view.getArtifactId().trim().isEmpty() && view.getVersion().trim().isEmpty(); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); } | NewContainerFormPresenter implements WizardPage { public boolean isEmpty() { return view.getContainerName().trim().isEmpty() && view.getGroupId().trim().isEmpty() && view.getArtifactId().trim().isEmpty() && view.getVersion().trim().isEmpty(); } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; } |
@Test public void testIsValid() { when(view.getContainerName()).thenReturn(" ").thenReturn("containerName").thenReturn(""); when(view.getGroupId()).thenReturn(" ").thenReturn("groupId").thenReturn(""); when(view.getArtifactId()).thenReturn(" ").thenReturn("artifactId").thenReturn(""); when(view.getVersion()).thenReturn(" ").thenReturn("1.0").thenReturn(""); assertTrue(presenter.isValid()); verify(view).noErrors(); presenter.setServerTemplate(new ServerTemplate()); assertTrue(presenter.isValid()); verify(view).noErrorOnContainerName(); verify(view).noErrorOnGroupId(); verify(view).noErrorOnArtifactId(); verify(view).noErrorOnVersion(); assertFalse(presenter.isValid()); verify(view).errorOnContainerName(); verify(view).errorOnGroupId(); verify(view).errorOnArtifactId(); verify(view).errorOnVersion(); } | public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } | NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } } | NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); } | NewContainerFormPresenter implements WizardPage { public boolean isValid() { if (mode.equals(Mode.OPTIONAL) && isEmpty()) { view.noErrors(); return true; } boolean hasError = false; if (isContainerNameValid()) { view.noErrorOnContainerName(); } else { view.errorOnContainerName(); hasError = true; } if (isGroupIdValid()) { view.noErrorOnGroupId(); } else { view.errorOnGroupId(); hasError = true; } if (isArtifactIdValid()) { view.noErrorOnArtifactId(); } else { view.errorOnArtifactId(); hasError = true; } if (isVersionValid()) { if (isArtifactSupportedByServer()) { view.noErrorOnVersion(); } else { view.errorOnVersion(); view.errorProductionModeSupportsDoesntSnapshots(); hasError = true; } } else { view.errorOnVersion(); hasError = true; } return !hasError; } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; } |
@Test public void testOnDependencyPathSelectedEvent() { final String path = "org:kie:1.0"; final GAV gav = new GAV(path); when(m2RepoService.loadGAVFromJar(path)).thenReturn(gav); when(view.getContainerName()).thenReturn("containerName"); when(view.getContainerAlias()).thenReturn("containerAlias"); when(view.getGroupId()).thenReturn(gav.getGroupId()); when(view.getArtifactId()).thenReturn(gav.getArtifactId()); when(view.getVersion()).thenReturn(gav.getVersion()); presenter.asWidget(); presenter.onDependencyPathSelectedEvent(new DependencyPathSelectedEvent(artifactListWidgetPresenter, path)); verify(m2RepoService).loadGAVFromJar(path); verify(view).setGroupId(gav.getGroupId()); verify(view).setArtifactId(gav.getArtifactId()); verify(view).setVersion(gav.getVersion()); verify(wizardPageStatusChangeEvent).fire(any(WizardPageStatusChangeEvent.class)); final ContainerSpec containerSpec = presenter.buildContainerSpec("templateId", Collections.<Capability, ContainerConfig>emptyMap()); assertEquals(new ReleaseId(gav.getGroupId(), gav.getArtifactId(), gav.getVersion()), containerSpec.getReleasedId()); assertEquals(KieContainerStatus.STOPPED, containerSpec.getStatus()); assertEquals("containerAlias", containerSpec.getContainerName()); assertEquals("containerName", containerSpec.getId()); } | void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } | NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } } | NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); } | NewContainerFormPresenter implements WizardPage { void onDependencyPathSelectedEvent(@Observes final DependencyPathSelectedEvent event) { if (event != null && event.getContext() != null && event.getPath() != null) { if (event.getContext().equals(artifactListWidgetPresenter)) { m2RepoService.call(new RemoteCallback<GAV>() { @Override public void callback(GAV gav) { setAValidContainerName(gav.toString()); view.setGroupId(gav.getGroupId()); view.setArtifactId(gav.getArtifactId()); view.setVersion(gav.getVersion()); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewContainerFormPresenter.this)); } }).loadGAVFromJar(event.getPath()); } } else { logger.warn("Illegal event argument."); } } @Inject NewContainerFormPresenter(final Logger logger,
final View view,
final ManagedInstance<ArtifactListWidgetPresenter> artifactListWidgetPresenterProvider,
final Caller<M2RepoService> m2RepoService,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); @PostConstruct void init(); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); Mode getMode(); @Override Widget asWidget(); void clear(); boolean isContainerNameValid(); boolean isGroupIdValid(); boolean isArtifactIdValid(); boolean isVersionValid(); boolean isArtifactSupportedByServer(); boolean isValid(); boolean isEmpty(); ServerTemplate getServerTemplate(); void setServerTemplate(final ServerTemplate serverTemplate); ContainerSpec buildContainerSpec(final String serverTemplateId,
final Map<Capability, ContainerConfig> configs); View getView(); void showBusyIndicator(String deploymentId); void hideBusyIndicator(); GAV getCurrentGAV(); static final String SNAPSHOT; } |
@Test public void testInit() { presenter.init(); verify( view ).init( presenter ); assertEquals( view.asWidget(), presenter.asWidget() ); assertEquals( view, presenter.getView() ); } | @PostConstruct public void init() { this.view.init(this); } | NewTemplatePresenter implements WizardPage { @PostConstruct public void init() { this.view.init(this); } } | NewTemplatePresenter implements WizardPage { @PostConstruct public void init() { this.view.init(this); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { @PostConstruct public void init() { this.view.init(this); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { @PostConstruct public void init() { this.view.init(this); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testIsTemplateNameValid() { when( view.getTemplateName() ) .thenReturn( null ) .thenReturn( "" ) .thenReturn( "test" ); assertFalse( presenter.isTemplateNameValid() ); assertFalse( presenter.isTemplateNameValid() ); assertTrue( presenter.isTemplateNameValid() ); } | public boolean isTemplateNameValid() { final String templateName = view.getTemplateName(); return templateName == null ? false : !templateName.trim().isEmpty(); } | NewTemplatePresenter implements WizardPage { public boolean isTemplateNameValid() { final String templateName = view.getTemplateName(); return templateName == null ? false : !templateName.trim().isEmpty(); } } | NewTemplatePresenter implements WizardPage { public boolean isTemplateNameValid() { final String templateName = view.getTemplateName(); return templateName == null ? false : !templateName.trim().isEmpty(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean isTemplateNameValid() { final String templateName = view.getTemplateName(); return templateName == null ? false : !templateName.trim().isEmpty(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean isTemplateNameValid() { final String templateName = view.getTemplateName(); return templateName == null ? false : !templateName.trim().isEmpty(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testGraphCommandAllow() { final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.allow(gce)); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); } |
@Test public void testIsCapabilityValid() { when( view.isPlanningCapabilityChecked() ).thenReturn( true, false, true, false ); when( view.isRuleCapabilityChecked() ).thenReturn( true, false, false ); when( view.isProcessCapabilityChecked() ).thenReturn( true, true, false ); assertTrue( presenter.isCapabilityValid() ); assertTrue( presenter.isCapabilityValid() ); assertTrue( presenter.isCapabilityValid() ); assertFalse( presenter.isCapabilityValid() ); } | public boolean isCapabilityValid() { if (view.isPlanningCapabilityChecked() && view.isRuleCapabilityChecked()) { return true; } if (view.isProcessCapabilityChecked() || view.isRuleCapabilityChecked()) { return true; } return false; } | NewTemplatePresenter implements WizardPage { public boolean isCapabilityValid() { if (view.isPlanningCapabilityChecked() && view.isRuleCapabilityChecked()) { return true; } if (view.isProcessCapabilityChecked() || view.isRuleCapabilityChecked()) { return true; } return false; } } | NewTemplatePresenter implements WizardPage { public boolean isCapabilityValid() { if (view.isPlanningCapabilityChecked() && view.isRuleCapabilityChecked()) { return true; } if (view.isProcessCapabilityChecked() || view.isRuleCapabilityChecked()) { return true; } return false; } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean isCapabilityValid() { if (view.isPlanningCapabilityChecked() && view.isRuleCapabilityChecked()) { return true; } if (view.isProcessCapabilityChecked() || view.isRuleCapabilityChecked()) { return true; } return false; } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean isCapabilityValid() { if (view.isPlanningCapabilityChecked() && view.isRuleCapabilityChecked()) { return true; } if (view.isProcessCapabilityChecked() || view.isRuleCapabilityChecked()) { return true; } return false; } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testIsValid() { when( view.getTemplateName() ).thenReturn( "templateName", "", "templateName" ); when( view.isRuleCapabilityChecked() ).thenReturn( true, false ); when( view.isProcessCapabilityChecked() ).thenReturn( true, false ); when( view.isPlanningCapabilityChecked() ).thenReturn( false ); assertTrue( presenter.isValid() ); verify( view ).noErrorOnTemplateName(); verify( view ).noErrorOnCapability(); assertFalse( presenter.isValid() ); verify( view ).errorOnTemplateName(); verify( view, times( 2 ) ).noErrorOnCapability(); assertFalse( presenter.isValid() ); verify( view, times( 2 ) ).noErrorOnTemplateName(); verify( view ).errorCapability(); } | public boolean isValid() { boolean hasError = false; if (isTemplateNameValid()) { view.noErrorOnTemplateName(); } else { view.errorOnTemplateName(); hasError = true; } if (isCapabilityValid()) { view.noErrorOnCapability(); } else { view.errorCapability(); hasError = true; } return !hasError; } | NewTemplatePresenter implements WizardPage { public boolean isValid() { boolean hasError = false; if (isTemplateNameValid()) { view.noErrorOnTemplateName(); } else { view.errorOnTemplateName(); hasError = true; } if (isCapabilityValid()) { view.noErrorOnCapability(); } else { view.errorCapability(); hasError = true; } return !hasError; } } | NewTemplatePresenter implements WizardPage { public boolean isValid() { boolean hasError = false; if (isTemplateNameValid()) { view.noErrorOnTemplateName(); } else { view.errorOnTemplateName(); hasError = true; } if (isCapabilityValid()) { view.noErrorOnCapability(); } else { view.errorCapability(); hasError = true; } return !hasError; } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean isValid() { boolean hasError = false; if (isTemplateNameValid()) { view.noErrorOnTemplateName(); } else { view.errorOnTemplateName(); hasError = true; } if (isCapabilityValid()) { view.noErrorOnCapability(); } else { view.errorCapability(); hasError = true; } return !hasError; } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean isValid() { boolean hasError = false; if (isTemplateNameValid()) { view.noErrorOnTemplateName(); } else { view.errorOnTemplateName(); hasError = true; } if (isCapabilityValid()) { view.noErrorOnCapability(); } else { view.errorCapability(); hasError = true; } return !hasError; } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testIsComplete() { final Callback callback = mock( Callback.class ); final String templateName = "templateName"; when( view.getTemplateName() ).thenReturn( templateName ).thenReturn( templateName, templateName, templateName, "" ); when( view.isRuleCapabilityChecked() ).thenReturn( true ); when( view.isProcessCapabilityChecked() ).thenReturn( true ); when( specManagementService.isNewServerTemplateIdValid( templateName ) ).thenReturn( true, false ); presenter.isComplete( callback ); verify( specManagementService ).isNewServerTemplateIdValid( templateName ); verify( callback ).callback( true ); presenter.isComplete( callback ); verify( specManagementService, times( 2 ) ).isNewServerTemplateIdValid( templateName ); verify( callback ).callback( false ); presenter.isComplete( callback ); verify( callback, times( 2 ) ).callback( false ); verify( view ).errorOnTemplateName(); } | @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } | NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } } | NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { @Override public void isComplete(final Callback<Boolean> callback) { if (isValid()) { specManagementService.call(new RemoteCallback<Boolean>() { @Override public void callback(final Boolean result) { if (result.equals(Boolean.FALSE)) { view.errorOnTemplateName(view.getInvalidErrorMessage()); callback.callback(false); } else { callback.callback(true); } } }).isNewServerTemplateIdValid(view.getTemplateName()); } else { callback.callback(false); } } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testClear() { presenter.clear(); verify( view ).clear(); } | public void clear() { view.clear(); } | NewTemplatePresenter implements WizardPage { public void clear() { view.clear(); } } | NewTemplatePresenter implements WizardPage { public void clear() { view.clear(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public void clear() { view.clear(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public void clear() { view.clear(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testTitle() { final String title = "title"; when( view.getTitle() ).thenReturn( title ); assertEquals( title, presenter.getTitle() ); verify( view ).getTitle(); } | @Override public String getTitle() { return view.getTitle(); } | NewTemplatePresenter implements WizardPage { @Override public String getTitle() { return view.getTitle(); } } | NewTemplatePresenter implements WizardPage { @Override public String getTitle() { return view.getTitle(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { @Override public String getTitle() { return view.getTitle(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { @Override public String getTitle() { return view.getTitle(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testAddContentChangeHandler() { doAnswer( new Answer() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { final ContentChangeHandler handler = (ContentChangeHandler) invocation.getArguments()[ 0 ]; if ( handler != null ) { handler.onContentChange(); } return null; } } ).when( view ).addContentChangeHandler( any( ContentChangeHandler.class ) ); presenter.addContentChangeHandler( mock( ContentChangeHandler.class ) ); final ArgumentCaptor<WizardPageStatusChangeEvent> eventCaptor = ArgumentCaptor.forClass( WizardPageStatusChangeEvent.class ); verify( wizardPageStatusChangeEvent ).fire( eventCaptor.capture() ); assertEquals( presenter, eventCaptor.getValue().getPage() ); } | public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) { checkNotNull("contentChangeHandler", contentChangeHandler); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { contentChangeHandler.onContentChange(); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this)); } }); } | NewTemplatePresenter implements WizardPage { public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) { checkNotNull("contentChangeHandler", contentChangeHandler); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { contentChangeHandler.onContentChange(); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this)); } }); } } | NewTemplatePresenter implements WizardPage { public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) { checkNotNull("contentChangeHandler", contentChangeHandler); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { contentChangeHandler.onContentChange(); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this)); } }); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) { checkNotNull("contentChangeHandler", contentChangeHandler); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { contentChangeHandler.onContentChange(); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this)); } }); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public void addContentChangeHandler(final ContentChangeHandler contentChangeHandler) { checkNotNull("contentChangeHandler", contentChangeHandler); view.addContentChangeHandler(new ContentChangeHandler() { @Override public void onContentChange() { contentChangeHandler.onContentChange(); wizardPageStatusChangeEvent.fire(new WizardPageStatusChangeEvent(NewTemplatePresenter.this)); } }); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testIsRuleCapabilityChecked() { when( view.isRuleCapabilityChecked() ).thenReturn( true ).thenReturn( false ); assertTrue( presenter.isRuleCapabilityChecked() ); assertFalse( presenter.isRuleCapabilityChecked() ); } | public boolean isRuleCapabilityChecked() { return view.isRuleCapabilityChecked(); } | NewTemplatePresenter implements WizardPage { public boolean isRuleCapabilityChecked() { return view.isRuleCapabilityChecked(); } } | NewTemplatePresenter implements WizardPage { public boolean isRuleCapabilityChecked() { return view.isRuleCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean isRuleCapabilityChecked() { return view.isRuleCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean isRuleCapabilityChecked() { return view.isRuleCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testIsProcessCapabilityChecked() { when( view.isProcessCapabilityChecked() ).thenReturn( true ).thenReturn( false ); assertTrue( presenter.isProcessCapabilityChecked() ); assertFalse( presenter.isProcessCapabilityChecked() ); } | public boolean isProcessCapabilityChecked() { return view.isProcessCapabilityChecked(); } | NewTemplatePresenter implements WizardPage { public boolean isProcessCapabilityChecked() { return view.isProcessCapabilityChecked(); } } | NewTemplatePresenter implements WizardPage { public boolean isProcessCapabilityChecked() { return view.isProcessCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean isProcessCapabilityChecked() { return view.isProcessCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean isProcessCapabilityChecked() { return view.isProcessCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testIsPlanningCapabilityChecked() { when( view.isPlanningCapabilityChecked() ).thenReturn( true ).thenReturn( false ); assertTrue( presenter.isPlanningCapabilityChecked() ); assertFalse( presenter.isPlanningCapabilityChecked() ); } | public boolean isPlanningCapabilityChecked() { return view.isPlanningCapabilityChecked(); } | NewTemplatePresenter implements WizardPage { public boolean isPlanningCapabilityChecked() { return view.isPlanningCapabilityChecked(); } } | NewTemplatePresenter implements WizardPage { public boolean isPlanningCapabilityChecked() { return view.isPlanningCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean isPlanningCapabilityChecked() { return view.isPlanningCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean isPlanningCapabilityChecked() { return view.isPlanningCapabilityChecked(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testHasProcessCapability() { when( view.getProcessCapabilityCheck() ).thenReturn( true, false ); assertTrue( presenter.hasProcessCapability() ); assertFalse( presenter.hasProcessCapability() ); verify( view, times( 2 ) ).getProcessCapabilityCheck(); } | public boolean hasProcessCapability() { return view.getProcessCapabilityCheck(); } | NewTemplatePresenter implements WizardPage { public boolean hasProcessCapability() { return view.getProcessCapabilityCheck(); } } | NewTemplatePresenter implements WizardPage { public boolean hasProcessCapability() { return view.getProcessCapabilityCheck(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public boolean hasProcessCapability() { return view.getProcessCapabilityCheck(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public boolean hasProcessCapability() { return view.getProcessCapabilityCheck(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testGraphCommandExecuteWithColumns() { relation.getColumn().add(new InformationItem()); relation.getRow().get(0).getExpression().add(HasExpression.wrap(rowList, new LiteralExpression())); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(0, relation.getRow().size()); assertEquals(1, relation.getColumn().size()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); } |
@Test public void testTemplateName() { final String templateName = "templateName"; when( view.getTemplateName() ).thenReturn( templateName ); assertEquals( templateName, presenter.getTemplateName() ); verify( view ).getTemplateName(); } | public String getTemplateName() { return view.getTemplateName(); } | NewTemplatePresenter implements WizardPage { public String getTemplateName() { return view.getTemplateName(); } } | NewTemplatePresenter implements WizardPage { public String getTemplateName() { return view.getTemplateName(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); } | NewTemplatePresenter implements WizardPage { public String getTemplateName() { return view.getTemplateName(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } | NewTemplatePresenter implements WizardPage { public String getTemplateName() { return view.getTemplateName(); } @Inject NewTemplatePresenter(final View view,
final Caller<SpecManagementService> specManagementService,
final Event<WizardPageStatusChangeEvent> wizardPageStatusChangeEvent); boolean hasProcessCapability(); String getTemplateName(); @PostConstruct void init(); @Override String getTitle(); @Override void isComplete(final Callback<Boolean> callback); void addContentChangeHandler(final ContentChangeHandler contentChangeHandler); @Override void initialise(); @Override void prepareView(); @Override Widget asWidget(); boolean isValid(); boolean isTemplateNameValid(); boolean isCapabilityValid(); void clear(); boolean isRuleCapabilityChecked(); boolean isProcessCapabilityChecked(); boolean isPlanningCapabilityChecked(); View getView(); } |
@Test public void testInit() { presenter.init(); verify( view ).setNavigation( navigationPresenter.getView() ); assertEquals( view, presenter.getView() ); } | @PostConstruct public void init() { this.view.setNavigation( navigationPresenter.getView() ); } | ServerManagementBrowserPresenter { @PostConstruct public void init() { this.view.setNavigation( navigationPresenter.getView() ); } } | ServerManagementBrowserPresenter { @PostConstruct public void init() { this.view.setNavigation( navigationPresenter.getView() ); } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { @PostConstruct public void init() { this.view.setNavigation( navigationPresenter.getView() ); } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { @PostConstruct public void init() { this.view.setNavigation( navigationPresenter.getView() ); } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnOpen() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList( serverTemplateKey ); when( specManagementService.listServerTemplateKeys() ).thenReturn( new ServerTemplateKeyList(serverTemplateKeys) ); presenter.onOpen(); verify( navigationPresenter ).setup( serverTemplateKey, serverTemplateKeys ); final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass( ServerTemplateSelected.class ); verify( serverTemplateSelectedEvent ).fire( templateSelectedCaptor.capture() ); assertEquals( serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey() ); } | @OnOpen public void onOpen() { refreshList( new ServerTemplateListRefresh() ); } | ServerManagementBrowserPresenter { @OnOpen public void onOpen() { refreshList( new ServerTemplateListRefresh() ); } } | ServerManagementBrowserPresenter { @OnOpen public void onOpen() { refreshList( new ServerTemplateListRefresh() ); } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { @OnOpen public void onOpen() { refreshList( new ServerTemplateListRefresh() ); } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { @OnOpen public void onOpen() { refreshList( new ServerTemplateListRefresh() ); } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnServerDeleted() { final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList( serverTemplateKey ); when( specManagementService.listServerTemplateKeys() ).thenReturn( new ServerTemplateKeyList(serverTemplateKeys) ); presenter.onServerDeleted( new ServerTemplateDeleted() ); verify( navigationPresenter ).setup( serverTemplateKey, serverTemplateKeys ); final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass( ServerTemplateSelected.class ); verify( serverTemplateSelectedEvent ).fire( templateSelectedCaptor.capture() ); assertEquals( serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey() ); } | public void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ) { if ( serverTemplateDeleted != null ) { refreshList( new ServerTemplateListRefresh() ); } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ) { if ( serverTemplateDeleted != null ) { refreshList( new ServerTemplateListRefresh() ); } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ) { if ( serverTemplateDeleted != null ) { refreshList( new ServerTemplateListRefresh() ); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ) { if ( serverTemplateDeleted != null ) { refreshList( new ServerTemplateListRefresh() ); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ) { if ( serverTemplateDeleted != null ) { refreshList( new ServerTemplateListRefresh() ); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnServerTemplateUpdated() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverInstanceKeyId", "serverName", "serverInstanceId", "url" ); final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); serverTemplate.addServerInstance( serverInstanceKey ); when( serverTemplatePresenter.getCurrentServerTemplate() ).thenReturn( serverTemplate ); final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList( serverTemplateKey ); when( specManagementService.listServerTemplateKeys() ).thenReturn( new ServerTemplateKeyList(serverTemplateKeys) ); presenter.onServerTemplateUpdated( new ServerTemplateUpdated( serverTemplate ) ); final ArgumentCaptor<Collection> serverTemplateKeysCaptor = ArgumentCaptor.forClass( Collection.class ); verify( navigationPresenter ).setup( eq( serverTemplateKey ), serverTemplateKeysCaptor.capture() ); final Collection<ServerTemplateKey> serverTemplateKeysValue = serverTemplateKeysCaptor.getValue(); assertEquals( 1, serverTemplateKeysValue.size() ); assertTrue( serverTemplateKeysValue.contains( serverTemplateKey ) ); final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass( ServerTemplateSelected.class ); verify( serverTemplateSelectedEvent ).fire( templateSelectedCaptor.capture() ); assertEquals( serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey() ); } | public void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ) { if ( serverTemplateUpdated != null && serverTemplateUpdated.getServerTemplate() != null ) { final ServerTemplate serverTemplate = serverTemplateUpdated.getServerTemplate(); refreshList(new ServerTemplateListRefresh(serverTemplate.getId())); } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ) { if ( serverTemplateUpdated != null && serverTemplateUpdated.getServerTemplate() != null ) { final ServerTemplate serverTemplate = serverTemplateUpdated.getServerTemplate(); refreshList(new ServerTemplateListRefresh(serverTemplate.getId())); } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ) { if ( serverTemplateUpdated != null && serverTemplateUpdated.getServerTemplate() != null ) { final ServerTemplate serverTemplate = serverTemplateUpdated.getServerTemplate(); refreshList(new ServerTemplateListRefresh(serverTemplate.getId())); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ) { if ( serverTemplateUpdated != null && serverTemplateUpdated.getServerTemplate() != null ) { final ServerTemplate serverTemplate = serverTemplateUpdated.getServerTemplate(); refreshList(new ServerTemplateListRefresh(serverTemplate.getId())); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ) { if ( serverTemplateUpdated != null && serverTemplateUpdated.getServerTemplate() != null ) { final ServerTemplate serverTemplate = serverTemplateUpdated.getServerTemplate(); refreshList(new ServerTemplateListRefresh(serverTemplate.getId())); } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnDelete() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverInstanceKeyId", "serverName", "serverInstanceId", "url" ); final ServerTemplate serverTemplate = new ServerTemplate( "ServerTemplateId", "ServerTemplateName" ); serverTemplate.addServerInstance( serverInstanceKey ); when( serverTemplatePresenter.getCurrentServerTemplate() ).thenReturn( serverTemplate ); final ServerTemplateKey serverTemplateKey = new ServerTemplateKey( "ServerTemplateKeyId", "ServerTemplateKeyName" ); final List<ServerTemplateKey> serverTemplateKeys = Collections.singletonList( serverTemplateKey ); when( specManagementService.listServerTemplateKeys() ).thenReturn( new ServerTemplateKeyList(serverTemplateKeys) ); presenter.onDelete( new ServerInstanceDeleted( serverInstanceKey.getServerInstanceId() ) ); verify( navigationPresenter ).setup( serverTemplateKey, serverTemplateKeys ); final ArgumentCaptor<ServerTemplateSelected> templateSelectedCaptor = ArgumentCaptor.forClass( ServerTemplateSelected.class ); verify( serverTemplateSelectedEvent ).fire( templateSelectedCaptor.capture() ); assertEquals( serverTemplateKey, templateSelectedCaptor.getValue().getServerTemplateKey() ); } | public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnDeleteWithoutCurrentServer() { final ServerInstanceKey serverInstanceKey = new ServerInstanceKey( "serverInstanceKeyId", "serverName", "serverInstanceId", "url" ); presenter.onDelete( new ServerInstanceDeleted( serverInstanceKey.getServerInstanceId() ) ); verify( specManagementService, never() ).listServerTemplateKeys(); } | public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null && serverTemplatePresenter.getCurrentServerTemplate() != null ) { final String deletedServerInstanceId = serverInstanceDeleted.getServerInstanceId(); for ( final ServerInstanceKey serverInstanceKey : serverTemplatePresenter.getCurrentServerTemplate().getServerInstanceKeys() ) { if ( deletedServerInstanceId.equals( serverInstanceKey.getServerInstanceId() ) ) { refreshList( new ServerTemplateListRefresh( serverTemplatePresenter.getCurrentServerTemplate().getId() ) ); break; } } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnContainerUpdateSuccess() { when( view.getSuccessMessage( ClientContainerRuntimeOperation.START_CONTAINER, 2 ) ).thenReturn( "Success" ); presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), new ArrayList<ServerInstanceKey>() {{ add( mock( ServerInstanceKey.class ) ); add( mock( ServerInstanceKey.class ) ); }}, ContainerRuntimeState.ONLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification ).fire( new NotificationEvent( "Success", NotificationEvent.NotificationType.SUCCESS ) ); } | public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnContainerUpdateFailed() { when( view.getErrorMessage( ClientContainerRuntimeOperation.START_CONTAINER, 2 ) ).thenReturn( "Error" ); presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), new ArrayList<ServerInstanceKey>() {{ add( mock( ServerInstanceKey.class ) ); add( mock( ServerInstanceKey.class ) ); }}, ContainerRuntimeState.OFFLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification ).fire( new NotificationEvent( "Error", NotificationEvent.NotificationType.ERROR ) ); } | public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnContainerUpdateWarn() { when( view.getWarnMessage( ClientContainerRuntimeOperation.START_CONTAINER, 2 ) ).thenReturn( "Warn" ); presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), new ArrayList<ServerInstanceKey>() {{ add( mock( ServerInstanceKey.class ) ); add( mock( ServerInstanceKey.class ) ); }}, ContainerRuntimeState.PARTIAL_ONLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification ).fire( new NotificationEvent( "Warn", NotificationEvent.NotificationType.WARNING ) ); } | public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testGraphCommandExecuteRemoveMiddleWithColumns() { uiModel.appendRow(new BaseGridRow()); uiModel.appendRow(new BaseGridRow()); final List firstRow = new List(); final List lastRow = new List(); relation.getRow().add(0, firstRow); relation.getRow().add(lastRow); relation.getColumn().add(new InformationItem()); relation.getRow().get(0).getExpression().add(HasExpression.wrap(rowList, new LiteralExpression())); makeCommand(1); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(2, relation.getRow().size()); assertEquals(firstRow, relation.getRow().get(0)); assertEquals(lastRow, relation.getRow().get(1)); assertEquals(1, relation.getColumn().size()); } | @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); } | DeleteRelationRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { relation.getRow().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { relation.getRow().add(uiRowIndex, oldRow); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteRelationRowCommand(final Relation relation,
final GridData uiModel,
final int uiRowIndex,
final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); } |
@Test public void testOnContainerEmptyList() { presenter.onContainerUpdate( new ContainerUpdateEvent( mock( ServerTemplateKey.class ), mock( ContainerSpec.class ), Collections.emptyList(), ContainerRuntimeState.PARTIAL_ONLINE, ContainerRuntimeOperation.START_CONTAINER ) ); verify( notification, never() ).fire( any() ); } | public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testOnContainerNull() { presenter.onContainerUpdate( new ContainerUpdateEvent() ); verify( notification, never() ).fire( any() ); } | public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } | ServerManagementBrowserPresenter { public void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ) { if ( containerUpdateEvent != null && containerUpdateEvent.getContainerRuntimeOperation() != null && containerUpdateEvent.getContainerRuntimeState() != null && containerUpdateEvent.getFailedServerInstances().size() > 0 ) { final ClientContainerRuntimeOperation containerRuntimeOperation = ClientContainerRuntimeOperation.convert( containerUpdateEvent.getContainerRuntimeOperation() ); final String message; final NotificationEvent.NotificationType notificationType; switch ( containerUpdateEvent.getContainerRuntimeState() ) { case OFFLINE: message = view.getErrorMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.ERROR; break; case PARTIAL_ONLINE: message = view.getWarnMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.WARNING; break; case ONLINE: message = view.getSuccessMessage( containerRuntimeOperation, containerUpdateEvent.getFailedServerInstances().size() ); notificationType = NotificationEvent.NotificationType.SUCCESS; break; default: message = null; notificationType = null; break; } if ( message != null ) { notification.fire( new NotificationEvent( message, notificationType ) ); } } else { logger.warn( "Illegal event argument." ); } } @Inject ServerManagementBrowserPresenter( final Logger logger,
final View view,
final ServerNavigationPresenter navigationPresenter,
final ServerTemplatePresenter serverTemplatePresenter,
final ServerEmptyPresenter serverEmptyPresenter,
final ServerContainerEmptyPresenter serverContainerEmptyPresenter,
final ContainerPresenter containerPresenter,
final RemotePresenter remotePresenter,
final Caller<SpecManagementService> specManagementService,
final Event<ServerTemplateSelected> serverTemplateSelectedEvent,
final Event<NotificationEvent> notification ); @PostConstruct void init(); @OnOpen void onOpen(); void onServerDeleted( @Observes final ServerTemplateDeleted serverTemplateDeleted ); void onSelected( @Observes final ServerTemplateSelected serverTemplateSelected ); void onSelected( @Observes final ContainerSpecSelected containerSpecSelected ); void onSelected( @Observes final ServerInstanceSelected serverInstanceSelected ); void onContainerUpdate( @Observes final ContainerUpdateEvent containerUpdateEvent ); void setup( final Collection<ServerTemplateKey> serverTemplateKeys,
final String selectServerTemplateId ); void onServerTemplateUpdated( @Observes final ServerTemplateUpdated serverTemplateUpdated ); void onDelete( @Observes final ServerInstanceDeleted serverInstanceDeleted ); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsWidget getView(); } |
@Test public void testInit() { assertEquals( view, presenter.getView() ); } | public View getView() { return view; } | ContainerCardPresenter { public View getView() { return view; } } | ContainerCardPresenter { public View getView() { return view; } @Inject ContainerCardPresenter( final View view,
final ManagedInstance<Object> presenterProvider,
final Event<ServerInstanceSelected> remoteServerSelectedEvent ); } | ContainerCardPresenter { public View getView() { return view; } @Inject ContainerCardPresenter( final View view,
final ManagedInstance<Object> presenterProvider,
final Event<ServerInstanceSelected> remoteServerSelectedEvent ); View getView(); void setup( final ServerInstanceKey serverInstanceKey,
final Container container ); void delete(); void updateContent( final ServerInstanceKey serverInstanceKey,
final Container container ); } | ContainerCardPresenter { public View getView() { return view; } @Inject ContainerCardPresenter( final View view,
final ManagedInstance<Object> presenterProvider,
final Event<ServerInstanceSelected> remoteServerSelectedEvent ); View getView(); void setup( final ServerInstanceKey serverInstanceKey,
final Container container ); void delete(); void updateContent( final ServerInstanceKey serverInstanceKey,
final Container container ); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.