/** * 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#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()); }