/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#editItemNameTriggered(org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode, * java.lang.String)} . * * @throws CoreException * @throws IOException */ @Test public final void testEditItemNameTriggered() throws IOException, CoreException { IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ //$NON-NLS-2$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(false); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next(); ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc); String oldName = siNode.getDisplayName(); String newName = "NewServiceInterfaceName"; // $NON-NLS-1$ sifpc.editItemNameTriggered(siNode, newName); assertEquals(oldName, siNode.getDisplayName()); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); sifpc.isEditAllowed = Boolean.valueOf(true); statusCalls = StatusUtils.getShowStatusDialog_calls(); sifpc.editItemNameTriggered(siNode, newName); assertEquals(newName, siNode.getDisplayName()); assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls); }
/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#editOperationTypeTriggered(org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode, * org.eclipse.wst.sse.sieditor.model.wsdl.api.OperationType)} . * * @throws CoreException * @throws IOException */ @Test public final void testEditOperationTypeTriggered() throws IOException, CoreException { IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ //$NON-NLS-2$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(false); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next(); ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc); OperationNode operationNodeToEdit = (OperationNode) siNode.getChildren()[0]; OperationType oldType = operationNodeToEdit.getModelObject().getOperationStyle(); OperationType newType = OperationType.ASYNCHRONOUS; assertNotSame(newType, oldType); sifpc.editOperationTypeTriggered(operationNodeToEdit, newType); assertEquals(oldType, operationNodeToEdit.getModelObject().getOperationStyle()); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); sifpc.isEditAllowed = Boolean.valueOf(true); statusCalls = StatusUtils.getShowStatusDialog_calls(); sifpc.editOperationTypeTriggered(operationNodeToEdit, newType); assertEquals(newType, operationNodeToEdit.getModelObject().getOperationStyle()); assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls); }
/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#editDescriptionNamespaceTriggered(java.lang.String)} * . * * @throws CoreException * @throws IOException */ @Test public final void testEditDescriptionNamespaceTriggered() throws IOException, CoreException { IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ //$NON-NLS-2$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(false); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); String namespace = wsdlRoot.getDescription().getNamespace(); String newNamespace = "http://someThing.com"; // $NON-NLS-1$ assertNotSame(newNamespace, namespace); sifpc.editDescriptionNamespaceTriggered(newNamespace); assertEquals(namespace, wsdlRoot.getDescription().getNamespace()); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); sifpc.isEditAllowed = Boolean.valueOf(true); sifpc.editDescriptionNamespaceTriggered(newNamespace); assertEquals(newNamespace, wsdlRoot.getDescription().getNamespace()); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); }
/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#addNewServiceInterface()} * . * * @throws ExecutionException * @throws CoreException * @throws IOException */ @Test public final void testAddNewServiceInterface() throws ExecutionException, IOException, CoreException { // just any wsdl IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ //$NON-NLS-2$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(true); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); int siCount = wsdlRoot.getDescription().getAllInterfaces().size(); sifpc.addNewServiceInterface(); assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls); assertEquals(siCount + 1, wsdlRoot.getDescription().getAllInterfaces().size()); // with a readOnly controller sifpc.isEditAllowed = Boolean.valueOf(false); statusCalls = StatusUtils.getShowStatusDialog_calls(); siCount = wsdlRoot.getDescription().getAllInterfaces().size(); sifpc.addNewServiceInterface(); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); assertEquals(siCount, wsdlRoot.getDescription().getAllInterfaces().size()); }
/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#editParameterTypeTriggered(ITreeNode, * IType)} . * * @throws CoreException * @throws IOException */ @Test public final void testEditParameterTypeTriggered() throws IOException, CoreException { IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ //$NON-NLS-2$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(false); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); IType newType = wsdlRoot .getDescription() .getContainedSchemas() .get(0) .getAllContainedTypes() .iterator() .next(); IServiceInterface service = wsdlRoot.getDescription().getAllInterfaces().iterator().next(); ServiceInterfaceNode serviceInterfaceNode = new ServiceInterfaceNode(null, service, sifpc); ParameterNode parameterNode = (ParameterNode) ((ITreeNode) serviceInterfaceNode.getChildren()[0]).getChildren()[0]; IParameter parameterToChange = (IParameter) parameterNode.getModelObject(); IType oldType = parameterToChange.getType(); sifpc.editParameterTypeTriggered(parameterNode, newType); assertEquals(oldType, parameterToChange.getType()); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); sifpc.isEditAllowed = Boolean.valueOf(true); statusCalls = StatusUtils.getShowStatusDialog_calls(); sifpc.editParameterTypeTriggered(parameterNode, newType); assertEquals(newType, parameterToChange.getType()); assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls); }
/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#addNewParameter(org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode, * org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.OperationCategory)} . * * @throws CoreException * @throws IOException */ @Test public final void testAddNewParameter() throws IOException, CoreException { // just any wsdl IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(true); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next(); ServiceInterfaceNode siNode = new ServiceInterfaceNode(null, serviceInterface, sifpc); sifpc.getTreeNodeMapper().addToNodeMap(serviceInterface, siNode); OperationNode operationNode = (OperationNode) siNode.getChildren()[0]; int paramCount = operationNode.getModelObject().getAllInputParameters().size(); sifpc.addNewParameter(operationNode, OperationCategory.INPUT); assertEquals(0, StatusUtils.getShowStatusDialog_calls() - statusCalls); assertEquals(paramCount + 1, operationNode.getModelObject().getAllInputParameters().size()); // with a readOnly controller sifpc.isEditAllowed = Boolean.valueOf(false); statusCalls = StatusUtils.getShowStatusDialog_calls(); paramCount = operationNode.getModelObject().getAllInputParameters().size(); sifpc.addNewParameter(operationNode, OperationCategory.INPUT); assertEquals(1, StatusUtils.getShowStatusDialog_calls() - statusCalls); assertEquals(paramCount, operationNode.getModelObject().getAllInputParameters().size()); }
/** * Test method for {@link * org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController#deleteItemTriggered(org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode)} * . * * @throws CoreException * @throws IOException */ @Test public final void testDeleteItemTriggered() throws IOException, CoreException { IWsdlModelRoot wsdlRoot = getWSDLModelRoot( org.eclipse.wst.sse.sieditor.test.model.Constants.DATA_PUBLIC_SELF_KESHAV + "Documentation.wsdl", "Documentation.wsdl"); //$NON-NLS-1$ TestSIFormPageController sifpc = new TestSIFormPageController(wsdlRoot, false); sifpc.isEditAllowed = Boolean.valueOf(true); StatusUtils.isUnderJunitExecution = true; long statusCalls = StatusUtils.getShowStatusDialog_calls(); IServiceInterface serviceInterface = wsdlRoot.getDescription().getAllInterfaces().iterator().next(); ServiceInterfaceNode serviceInterfaceNode = new ServiceInterfaceNode(null, serviceInterface, sifpc); sifpc.getTreeNodeMapper().addToNodeMap(serviceInterface, serviceInterfaceNode); OperationNode operationNode = (OperationNode) serviceInterfaceNode.getChildren()[0]; ParameterNode inputParameterNode = (ParameterNode) operationNode.getChildren()[0]; FaultNode faultNode = (FaultNode) operationNode.getChildren()[2]; sifpc.isEditAllowed = Boolean.valueOf(false); ArrayList<ITreeNode> nodes = new ArrayList<ITreeNode>(); nodes.add(faultNode); nodes.add(inputParameterNode); nodes.add(operationNode); nodes.add(serviceInterfaceNode); sifpc.deleteItemsTriggered(nodes); assertEquals(serviceInterface, wsdlRoot.getDescription().getAllInterfaces().iterator().next()); assertEquals(operationNode, serviceInterfaceNode.getChildren()[0]); assertEquals(inputParameterNode, operationNode.getChildren()[0]); assertEquals(faultNode, operationNode.getChildren()[2]); sifpc.isEditAllowed = Boolean.valueOf(true); sifpc.deleteItemsTriggered(nodes); assertEquals(0, wsdlRoot.getDescription().getAllInterfaces().size()); }