| /******************************************************************************* |
| * Copyright (c) 2010 BSI Business Systems Integration AG. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * BSI Business Systems Integration AG - initial API and implementation |
| ******************************************************************************/ |
| package org.eclipse.scout.sdk.internal.test.operation.jdt.method; |
| |
| import org.eclipse.jdt.core.IField; |
| import org.eclipse.jdt.core.IMethod; |
| import org.eclipse.jdt.core.ISourceRange; |
| import org.eclipse.jdt.core.IType; |
| import org.eclipse.scout.sdk.internal.test.AbstractScoutSdkTest; |
| import org.eclipse.scout.sdk.operation.jdt.method.MethodOverrideOperation; |
| import org.eclipse.scout.sdk.sourcebuilder.method.MethodBodySourceBuilderFactory; |
| import org.eclipse.scout.sdk.testing.SdkAssert; |
| import org.eclipse.scout.sdk.util.type.TypeUtility; |
| import org.eclipse.scout.sdk.workspace.type.IStructuredType; |
| import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility; |
| import org.eclipse.scout.sdk.workspace.type.config.ConfigurationMethod; |
| import org.junit.AfterClass; |
| import org.junit.Assert; |
| import org.junit.BeforeClass; |
| import org.junit.Test; |
| |
| /** |
| * <h1>Bug 77'596</h1> |
| * <p> |
| */ |
| public class MethodTest extends AbstractScoutSdkTest { |
| |
| @BeforeClass |
| public static void setUpWorkspace() throws Exception { |
| setupWorkspace("resources/operation/method", "test.client", "test.shared"); |
| } |
| |
| @Test |
| public void overrideFormExecInitForm() throws Exception { |
| |
| IType testForm = SdkAssert.assertTypeExists("test.client.ui.forms.Test1Form"); |
| |
| // execDataChanged |
| String methodName = "execDataChanged"; |
| ConfigurationMethod method = ScoutTypeUtility.getConfigurationMethod(testForm, methodName); |
| Assert.assertFalse(method.isImplemented()); |
| MethodOverrideOperation op = new MethodOverrideOperation(methodName, method.getType()); |
| op.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createAutoGeneratedMethodBody()); |
| op.setFormatSource(true); |
| op.setSibling(ScoutTypeUtility.createStructuredForm(testForm).getSiblingMethodConfigExec(methodName)); |
| executeBuildAssertNoCompileErrors(op); |
| SdkAssert.assertMethodExist(testForm, methodName); |
| |
| // execInitForm |
| methodName = "execValidate"; |
| method = ScoutTypeUtility.getConfigurationMethod(testForm, methodName); |
| Assert.assertFalse(method.isImplemented()); |
| op = new MethodOverrideOperation(methodName, method.getType()); |
| op.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createAutoGeneratedMethodBody()); |
| op.setFormatSource(true); |
| op.setSibling(ScoutTypeUtility.createStructuredForm(testForm).getSiblingMethodConfigExec(methodName)); |
| executeBuildAssertNoCompileErrors(op); |
| SdkAssert.assertMethodExist(testForm, methodName); |
| |
| // getconfiguredMinimized |
| methodName = "getConfiguredMinimized"; |
| method = ScoutTypeUtility.getConfigurationMethod(testForm, methodName); |
| Assert.assertFalse(method.isImplemented()); |
| op = new MethodOverrideOperation(methodName, method.getType()); |
| op.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createAutoGeneratedMethodBody()); |
| op.setFormatSource(true); |
| op.setSibling(ScoutTypeUtility.createStructuredForm(testForm).getSiblingMethodConfigGetConfigured(methodName)); |
| op.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createSimpleMethodBody("return true;")); |
| executeBuildAssertNoCompileErrors(op); |
| |
| SdkAssert.assertMethodExist(testForm, methodName); |
| // execInitForm |
| methodName = "execInitForm"; |
| method = ScoutTypeUtility.getConfigurationMethod(testForm, methodName); |
| Assert.assertFalse(method.isImplemented()); |
| op = new MethodOverrideOperation(methodName, method.getType()); |
| op.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createAutoGeneratedMethodBody()); |
| op.setFormatSource(true); |
| op.setSibling(ScoutTypeUtility.createStructuredForm(testForm).getSiblingMethodConfigExec(methodName)); |
| executeBuildAssertNoCompileErrors(op); |
| SdkAssert.assertMethodExist(testForm, methodName); |
| |
| testApiOfTest1Form(); |
| |
| } |
| |
| @Test |
| public void testOverrideFormExecMethods() throws Exception { |
| SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form"); |
| |
| // stringfield |
| IType stringField = SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form.MainBox.StringField"); |
| overrideExecMethod(stringField, "execValidateValue"); |
| overrideExecMethod(stringField, "execParseValue"); |
| |
| // stringfield |
| IType smartField = SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form.MainBox.SmartField"); |
| overrideExecMethod(smartField, "execParseValue"); |
| overrideExecMethod(smartField, "execDataChanged"); |
| overrideExecMethod(smartField, "execChangedValue"); |
| overrideExecMethod(smartField, "execFormatValue"); |
| |
| // listbox |
| IType listBoxField = SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form.MainBox.ListboxField"); |
| overrideExecMethod(listBoxField, "execFormatValue"); |
| overrideExecMethod(listBoxField, "execValidateValue"); |
| |
| // tablefield |
| IType tableField = SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form.MainBox.TableField"); |
| overrideExecMethod(tableField, "execDataChanged"); |
| overrideExecMethod(tableField, "execSaveUpdatedRow"); |
| // tablefield.table |
| IType tableFieldTable = SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form.MainBox.TableField.Table"); |
| overrideExecMethod(tableFieldTable, "execRowClick"); |
| overrideExecMethod(tableFieldTable, "execDecorateCell"); |
| |
| testApiOfTest2Form(); |
| |
| } |
| |
| private void overrideExecMethod(IType declaringType, String name) throws Exception { |
| ConfigurationMethod configMethod = ScoutTypeUtility.getConfigurationMethod(declaringType, name); |
| Assert.assertFalse(configMethod.isImplemented()); |
| |
| MethodOverrideOperation op = new MethodOverrideOperation(configMethod.getMethodName(), configMethod.getType()); |
| op.setFormatSource(true); |
| op.setMethodBodySourceBuilder(MethodBodySourceBuilderFactory.createAutoGeneratedMethodBody()); |
| IStructuredType structuredFormField = ScoutTypeUtility.createStructuredFormField(declaringType); |
| op.setSibling(structuredFormField.getSiblingMethodConfigExec(configMethod.getMethodName())); |
| executeBuildAssertNoCompileErrors(op); |
| |
| SdkAssert.assertMethodExist(declaringType, name); |
| } |
| |
| @Test |
| public void testMethodBodyRange() throws Exception { |
| IType t = SdkAssert.assertTypeExists("test.client.MethodBodyTest"); |
| IMethod m = TypeUtility.getMethod(t, "MethodBodyTest"); |
| ISourceRange bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(287, bodySourceRange.getOffset()); |
| Assert.assertEquals(4, bodySourceRange.getLength()); |
| |
| m = TypeUtility.getMethod(t, "doStaticStuff"); |
| bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(337, bodySourceRange.getOffset()); |
| Assert.assertEquals(4, bodySourceRange.getLength()); |
| |
| m = TypeUtility.getMethod(t, "doFinalStuff"); |
| bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(380, bodySourceRange.getOffset()); |
| Assert.assertEquals(4, bodySourceRange.getLength()); |
| |
| m = TypeUtility.getMethod(t, "methodWithLongContent"); |
| bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(426, bodySourceRange.getOffset()); |
| Assert.assertEquals(475, bodySourceRange.getLength()); |
| |
| m = TypeUtility.getMethod(t, "methodWithException"); |
| bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(970, bodySourceRange.getOffset()); |
| Assert.assertEquals(15, bodySourceRange.getLength()); |
| |
| m = TypeUtility.getMethod(t, "methodWithComment"); |
| bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(1038, bodySourceRange.getOffset()); |
| Assert.assertEquals(4, bodySourceRange.getLength()); |
| |
| m = TypeUtility.getMethod(t, "returnAnInteger"); |
| bodySourceRange = TypeUtility.getContentSourceRange(m); |
| Assert.assertEquals(1076, bodySourceRange.getOffset()); |
| Assert.assertEquals(17, bodySourceRange.getLength()); |
| } |
| |
| /** |
| * @Generated with org.eclipse.scout.sdk.testing.codegen.ApiTestGenerator |
| */ |
| private void testApiOfTest1Form() throws Exception { |
| // type Test1Form |
| IType test1Form = SdkAssert.assertTypeExists("test.client.ui.forms.Test1Form"); |
| SdkAssert.assertHasFlags(test1Form, 1); |
| SdkAssert.assertHasSuperTypeSignature(test1Form, "QAbstractForm;"); |
| SdkAssert.assertAnnotation(test1Form, "org.eclipse.scout.commons.annotations.FormData"); |
| |
| // fields of Test1Form |
| SdkAssert.assertEquals("field count of 'Test1Form'", 1, test1Form.getFields().length); |
| IField m_test1Nr = SdkAssert.assertFieldExist(test1Form, "m_test1Nr"); |
| SdkAssert.assertHasFlags(m_test1Nr, 2); |
| SdkAssert.assertFieldSignature(m_test1Nr, "QLong;"); |
| |
| SdkAssert.assertEquals("method count of 'Test1Form'", 10, test1Form.getMethods().length); |
| IMethod test1Form1 = SdkAssert.assertMethodExist(test1Form, "Test1Form", new String[]{}); |
| SdkAssert.assertTrue(test1Form1.isConstructor()); |
| SdkAssert.assertMethodReturnTypeSignature(test1Form1, "V"); |
| IMethod getConfiguredMinimized = SdkAssert.assertMethodExist(test1Form, "getConfiguredMinimized", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getConfiguredMinimized, "Z"); |
| SdkAssert.assertAnnotation(getConfiguredMinimized, "java.lang.Override"); |
| IMethod getConfiguredTitle = SdkAssert.assertMethodExist(test1Form, "getConfiguredTitle", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getConfiguredTitle, "QString;"); |
| SdkAssert.assertAnnotation(getConfiguredTitle, "java.lang.Override"); |
| IMethod execDataChanged = SdkAssert.assertMethodExist(test1Form, "execDataChanged", new String[]{"[QObject;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execDataChanged, "V"); |
| SdkAssert.assertAnnotation(execDataChanged, "java.lang.Override"); |
| IMethod execInitForm = SdkAssert.assertMethodExist(test1Form, "execInitForm", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(execInitForm, "V"); |
| SdkAssert.assertAnnotation(execInitForm, "java.lang.Override"); |
| IMethod execValidate = SdkAssert.assertMethodExist(test1Form, "execValidate", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(execValidate, "Z"); |
| SdkAssert.assertAnnotation(execValidate, "java.lang.Override"); |
| IMethod getTest1Nr = SdkAssert.assertMethodExist(test1Form, "getTest1Nr", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getTest1Nr, "QLong;"); |
| SdkAssert.assertAnnotation(getTest1Nr, "org.eclipse.scout.commons.annotations.FormData"); |
| IMethod setTest1Nr = SdkAssert.assertMethodExist(test1Form, "setTest1Nr", new String[]{"QLong;"}); |
| SdkAssert.assertMethodReturnTypeSignature(setTest1Nr, "V"); |
| SdkAssert.assertAnnotation(setTest1Nr, "org.eclipse.scout.commons.annotations.FormData"); |
| IMethod startModify = SdkAssert.assertMethodExist(test1Form, "startModify", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(startModify, "V"); |
| IMethod getMainBox = SdkAssert.assertMethodExist(test1Form, "getMainBox", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getMainBox, "QMainBox;"); |
| |
| SdkAssert.assertEquals("inner types count of 'Test1Form'", 2, test1Form.getTypes().length); |
| // type MainBox |
| IType mainBox = SdkAssert.assertTypeExists(test1Form, "MainBox"); |
| SdkAssert.assertHasFlags(mainBox, 1); |
| SdkAssert.assertHasSuperTypeSignature(mainBox, "QAbstractGroupBox;"); |
| SdkAssert.assertAnnotation(mainBox, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of MainBox |
| SdkAssert.assertEquals("field count of 'MainBox'", 0, mainBox.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'MainBox'", 0, mainBox.getMethods().length); |
| |
| SdkAssert.assertEquals("inner types count of 'MainBox'", 0, mainBox.getTypes().length); |
| // type ModifyHandler |
| IType modifyHandler = SdkAssert.assertTypeExists(test1Form, "ModifyHandler"); |
| SdkAssert.assertHasFlags(modifyHandler, 1); |
| SdkAssert.assertHasSuperTypeSignature(modifyHandler, "QAbstractFormHandler;"); |
| SdkAssert.assertAnnotation(modifyHandler, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of ModifyHandler |
| SdkAssert.assertEquals("field count of 'ModifyHandler'", 0, modifyHandler.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'ModifyHandler'", 0, modifyHandler.getMethods().length); |
| |
| SdkAssert.assertEquals("inner types count of 'ModifyHandler'", 0, modifyHandler.getTypes().length); |
| } |
| |
| /** |
| * @Generated with org.eclipse.scout.sdk.testing.codegen.ApiTestGenerator |
| */ |
| private void testApiOfTest2Form() throws Exception { |
| // type Test2Form |
| IType test2Form = SdkAssert.assertTypeExists("test.client.ui.forms.Test2Form"); |
| SdkAssert.assertHasFlags(test2Form, 1); |
| SdkAssert.assertHasSuperTypeSignature(test2Form, "QAbstractForm;"); |
| SdkAssert.assertAnnotation(test2Form, "org.eclipse.scout.commons.annotations.FormData"); |
| |
| // fields of Test2Form |
| SdkAssert.assertEquals("field count of 'Test2Form'", 1, test2Form.getFields().length); |
| IField m_test2Nr = SdkAssert.assertFieldExist(test2Form, "m_test2Nr"); |
| SdkAssert.assertHasFlags(m_test2Nr, 2); |
| SdkAssert.assertFieldSignature(m_test2Nr, "QLong;"); |
| |
| SdkAssert.assertEquals("method count of 'Test2Form'", 10, test2Form.getMethods().length); |
| IMethod test2Form1 = SdkAssert.assertMethodExist(test2Form, "Test2Form", new String[]{}); |
| SdkAssert.assertTrue(test2Form1.isConstructor()); |
| SdkAssert.assertMethodReturnTypeSignature(test2Form1, "V"); |
| IMethod getConfiguredTitle = SdkAssert.assertMethodExist(test2Form, "getConfiguredTitle", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getConfiguredTitle, "QString;"); |
| SdkAssert.assertAnnotation(getConfiguredTitle, "java.lang.Override"); |
| IMethod getTest2Nr = SdkAssert.assertMethodExist(test2Form, "getTest2Nr", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getTest2Nr, "QLong;"); |
| SdkAssert.assertAnnotation(getTest2Nr, "org.eclipse.scout.commons.annotations.FormData"); |
| IMethod setTest2Nr = SdkAssert.assertMethodExist(test2Form, "setTest2Nr", new String[]{"QLong;"}); |
| SdkAssert.assertMethodReturnTypeSignature(setTest2Nr, "V"); |
| SdkAssert.assertAnnotation(setTest2Nr, "org.eclipse.scout.commons.annotations.FormData"); |
| IMethod startNew = SdkAssert.assertMethodExist(test2Form, "startNew", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(startNew, "V"); |
| IMethod getListboxField = SdkAssert.assertMethodExist(test2Form, "getListboxField", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getListboxField, "QListboxField;"); |
| IMethod getMainBox = SdkAssert.assertMethodExist(test2Form, "getMainBox", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getMainBox, "QMainBox;"); |
| IMethod getSmartField = SdkAssert.assertMethodExist(test2Form, "getSmartField", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getSmartField, "QSmartField;"); |
| IMethod getStringField = SdkAssert.assertMethodExist(test2Form, "getStringField", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getStringField, "QStringField;"); |
| IMethod getTableField = SdkAssert.assertMethodExist(test2Form, "getTableField", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(getTableField, "QTableField;"); |
| |
| SdkAssert.assertEquals("inner types count of 'Test2Form'", 2, test2Form.getTypes().length); |
| // type MainBox |
| IType mainBox = SdkAssert.assertTypeExists(test2Form, "MainBox"); |
| SdkAssert.assertHasFlags(mainBox, 1); |
| SdkAssert.assertHasSuperTypeSignature(mainBox, "QAbstractGroupBox;"); |
| SdkAssert.assertAnnotation(mainBox, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of MainBox |
| SdkAssert.assertEquals("field count of 'MainBox'", 0, mainBox.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'MainBox'", 0, mainBox.getMethods().length); |
| |
| SdkAssert.assertEquals("inner types count of 'MainBox'", 4, mainBox.getTypes().length); |
| // type StringField |
| IType stringField = SdkAssert.assertTypeExists(mainBox, "StringField"); |
| SdkAssert.assertHasFlags(stringField, 1); |
| SdkAssert.assertHasSuperTypeSignature(stringField, "QAbstractStringField;"); |
| SdkAssert.assertAnnotation(stringField, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of StringField |
| SdkAssert.assertEquals("field count of 'StringField'", 0, stringField.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'StringField'", 2, stringField.getMethods().length); |
| IMethod execParseValue = SdkAssert.assertMethodExist(stringField, "execParseValue", new String[]{"QString;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execParseValue, "QString;"); |
| SdkAssert.assertAnnotation(execParseValue, "java.lang.Override"); |
| IMethod execValidateValue = SdkAssert.assertMethodExist(stringField, "execValidateValue", new String[]{"QString;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execValidateValue, "QString;"); |
| SdkAssert.assertAnnotation(execValidateValue, "java.lang.Override"); |
| |
| SdkAssert.assertEquals("inner types count of 'StringField'", 0, stringField.getTypes().length); |
| // type SmartField |
| IType smartField = SdkAssert.assertTypeExists(mainBox, "SmartField"); |
| SdkAssert.assertHasFlags(smartField, 1); |
| SdkAssert.assertHasSuperTypeSignature(smartField, "QAbstractSmartField<QLong;>;"); |
| SdkAssert.assertAnnotation(smartField, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of SmartField |
| SdkAssert.assertEquals("field count of 'SmartField'", 0, smartField.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'SmartField'", 4, smartField.getMethods().length); |
| IMethod execChangedValue = SdkAssert.assertMethodExist(smartField, "execChangedValue", new String[]{}); |
| SdkAssert.assertMethodReturnTypeSignature(execChangedValue, "V"); |
| SdkAssert.assertAnnotation(execChangedValue, "java.lang.Override"); |
| IMethod execDataChanged = SdkAssert.assertMethodExist(smartField, "execDataChanged", new String[]{"[QObject;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execDataChanged, "V"); |
| SdkAssert.assertAnnotation(execDataChanged, "java.lang.Override"); |
| IMethod execFormatValue = SdkAssert.assertMethodExist(smartField, "execFormatValue", new String[]{"QLong;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execFormatValue, "QString;"); |
| SdkAssert.assertAnnotation(execFormatValue, "java.lang.Override"); |
| IMethod execParseValue1 = SdkAssert.assertMethodExist(smartField, "execParseValue", new String[]{"QString;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execParseValue1, "QLong;"); |
| SdkAssert.assertAnnotation(execParseValue1, "java.lang.Override"); |
| |
| SdkAssert.assertEquals("inner types count of 'SmartField'", 0, smartField.getTypes().length); |
| // type ListboxField |
| IType listboxField = SdkAssert.assertTypeExists(mainBox, "ListboxField"); |
| SdkAssert.assertHasFlags(listboxField, 1); |
| SdkAssert.assertHasSuperTypeSignature(listboxField, "QAbstractListBox<QLong;>;"); |
| SdkAssert.assertAnnotation(listboxField, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of ListboxField |
| SdkAssert.assertEquals("field count of 'ListboxField'", 0, listboxField.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'ListboxField'", 2, listboxField.getMethods().length); |
| IMethod execValidateValue1 = SdkAssert.assertMethodExist(listboxField, "execValidateValue", new String[]{"QSet<QLong;>;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execValidateValue1, "QSet<QLong;>;"); |
| SdkAssert.assertAnnotation(execValidateValue1, "java.lang.Override"); |
| IMethod execFormatValue1 = SdkAssert.assertMethodExist(listboxField, "execFormatValue", new String[]{"QSet<QLong;>;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execFormatValue1, "QString;"); |
| SdkAssert.assertAnnotation(execFormatValue1, "java.lang.Override"); |
| |
| SdkAssert.assertEquals("inner types count of 'ListboxField'", 0, listboxField.getTypes().length); |
| // type TableField |
| IType tableField = SdkAssert.assertTypeExists(mainBox, "TableField"); |
| SdkAssert.assertHasFlags(tableField, 1); |
| SdkAssert.assertHasSuperTypeSignature(tableField, "QAbstractTableField<QTableField.Table;>;"); |
| SdkAssert.assertAnnotation(tableField, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of TableField |
| SdkAssert.assertEquals("field count of 'TableField'", 0, tableField.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'TableField'", 2, tableField.getMethods().length); |
| IMethod execDataChanged1 = SdkAssert.assertMethodExist(tableField, "execDataChanged", new String[]{"[QObject;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execDataChanged1, "V"); |
| SdkAssert.assertAnnotation(execDataChanged1, "java.lang.Override"); |
| IMethod execSaveUpdatedRow = SdkAssert.assertMethodExist(tableField, "execSaveUpdatedRow", new String[]{"QITableRow;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execSaveUpdatedRow, "V"); |
| SdkAssert.assertAnnotation(execSaveUpdatedRow, "java.lang.Override"); |
| |
| SdkAssert.assertEquals("inner types count of 'TableField'", 1, tableField.getTypes().length); |
| // type Table |
| IType table = SdkAssert.assertTypeExists(tableField, "Table"); |
| SdkAssert.assertHasFlags(table, 1); |
| SdkAssert.assertHasSuperTypeSignature(table, "QAbstractTable;"); |
| SdkAssert.assertAnnotation(table, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of Table |
| SdkAssert.assertEquals("field count of 'Table'", 0, table.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'Table'", 2, table.getMethods().length); |
| IMethod execDecorateCell = SdkAssert.assertMethodExist(table, "execDecorateCell", new String[]{"QCell;", "QITableRow;", "QIColumn<*>;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execDecorateCell, "V"); |
| SdkAssert.assertAnnotation(execDecorateCell, "java.lang.Override"); |
| IMethod execRowClick = SdkAssert.assertMethodExist(table, "execRowClick", new String[]{"QITableRow;", "QMouseButton;"}); |
| SdkAssert.assertMethodReturnTypeSignature(execRowClick, "V"); |
| SdkAssert.assertAnnotation(execRowClick, "java.lang.Override"); |
| |
| SdkAssert.assertEquals("inner types count of 'Table'", 0, table.getTypes().length); |
| // type NewHandler |
| IType newHandler = SdkAssert.assertTypeExists(test2Form, "NewHandler"); |
| SdkAssert.assertHasFlags(newHandler, 1); |
| SdkAssert.assertHasSuperTypeSignature(newHandler, "QAbstractFormHandler;"); |
| SdkAssert.assertAnnotation(newHandler, "org.eclipse.scout.commons.annotations.Order"); |
| |
| // fields of NewHandler |
| SdkAssert.assertEquals("field count of 'NewHandler'", 0, newHandler.getFields().length); |
| |
| SdkAssert.assertEquals("method count of 'NewHandler'", 0, newHandler.getMethods().length); |
| |
| SdkAssert.assertEquals("inner types count of 'NewHandler'", 0, newHandler.getTypes().length); |
| } |
| |
| @AfterClass |
| public static void cleanUp() throws Exception { |
| clearWorkspace(); |
| } |
| } |