Search in sources :

Example 1 with TransactionStep

use of com.twinsoft.convertigo.beans.steps.TransactionStep in project convertigo by convertigo.

the class ReferencesView method getRequiredRequestables.

private void getRequiredRequestables(Step step, Project projectSelected, ProjectExplorerView projectExplorerView, AbstractParentNode parentNode, List<String> transactionList, List<String> sequenceList) {
    try {
        if (step instanceof SequenceStep) {
            SequenceStep sequenceStep = (SequenceStep) step;
            String sourceProjectName = sequenceStep.getProjectName();
            if (!sourceProjectName.equals(projectSelected.getName())) {
                Project project;
                project = getProject(sourceProjectName, projectExplorerView);
                ProjectNode projectNode = new ProjectNode(parentNode, sourceProjectName, project);
                Sequence sourceSequence = null;
                String sourceSequenceName = sequenceStep.getSequenceName();
                try {
                    if (project != null)
                        sourceSequence = project.getSequenceByName(sourceSequenceName);
                } catch (EngineException e) {
                    sourceSequence = null;
                }
                projectNode.addChild(new SequenceNode(projectNode, sourceSequenceName, sourceSequence));
                if (!sequenceList.contains(sourceProjectName + sourceSequenceName)) {
                    sequenceList.add(sourceProjectName + sourceSequenceName);
                    parentNode.addChild(projectNode);
                }
            }
        } else if (step instanceof TransactionStep) {
            TransactionStep transactionStep = (TransactionStep) step;
            String sourceProjectName = transactionStep.getProjectName();
            if (!sourceProjectName.equals(projectSelected.getName())) {
                Project project;
                project = getProject(sourceProjectName, projectExplorerView);
                ProjectNode projectNode = new ProjectNode(parentNode, sourceProjectName, project);
                if (project != null) {
                    Connector connector = project.getConnectorByName(transactionStep.getConnectorName());
                    ConnectorNode connectorNode = null;
                    connectorNode = getConnectorNode(projectNode, connector);
                    projectNode.addChild(connectorNode);
                    Transaction sourceTransaction = null;
                    String sourceTransactionName = transactionStep.getTransactionName();
                    try {
                        if (connector != null)
                            sourceTransaction = connector.getTransactionByName(sourceTransactionName);
                    } catch (Exception e) {
                        sourceTransaction = null;
                    }
                    connectorNode.addChild(new TransactionNode(connectorNode, sourceTransactionName, sourceTransaction));
                    if (!transactionList.contains(project.getName() + connector.getName() + sourceTransactionName)) {
                        transactionList.add(project.getName() + connector.getName() + sourceTransactionName);
                        parentNode.addChild(projectNode);
                    }
                }
            }
        } else if (isStepContainer(step)) {
            List<Step> steps = getStepList(step);
            if (steps != null) {
                for (Step s : steps) {
                    getRequiredRequestables(s, projectSelected, projectExplorerView, parentNode, transactionList, sequenceList);
                }
            }
        }
    } catch (EngineException e) {
        ConvertigoPlugin.logException(e, "Unable to load the project", true);
    }
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) EngineException(com.twinsoft.convertigo.engine.EngineException) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode) EngineException(com.twinsoft.convertigo.engine.EngineException) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 2 with TransactionStep

use of com.twinsoft.convertigo.beans.steps.TransactionStep in project convertigo by convertigo.

the class ReferencesView method getConnectorReferencingIsUsedBy.

private void getConnectorReferencingIsUsedBy(Step step, ProjectExplorerView projectExplorerView, SequenceNode sequenceNode, List<Transaction> transactions, String connectorProjectName, String connectorSelectedName) {
    if (step instanceof TransactionStep) {
        TransactionStep transactionStep = (TransactionStep) step;
        String sourcetransaction = transactionStep.getSourceTransaction();
        for (Transaction transaction : transactions) {
            if (sourcetransaction.equals(connectorProjectName + RequestableStep.SOURCE_SEPARATOR + connectorSelectedName + RequestableStep.SOURCE_SEPARATOR + transaction.getName())) {
                sequenceNode.addChild(new TransactionStepNode(sequenceNode, step.getName(), step));
            }
        }
    } else if (isStepContainer(step)) {
        List<Step> steps = getStepList(step);
        for (Step s : steps) {
            getConnectorReferencingIsUsedBy(s, projectExplorerView, sequenceNode, transactions, connectorProjectName, connectorSelectedName);
        }
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionStepNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionStepNode) List(java.util.List) ArrayList(java.util.ArrayList) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep)

Example 3 with TransactionStep

use of com.twinsoft.convertigo.beans.steps.TransactionStep in project convertigo by convertigo.

the class ReferencesView method getSequenceReferencingRequires.

private void getSequenceReferencingRequires(Step step, Sequence sequenceSelected, ProjectExplorerView projectExplorerView, RequiresNode requiresNode, List<String> transactionList, List<String> sequenceList) {
    try {
        if (step instanceof SequenceStep) {
            SequenceStep sequenceStep = (SequenceStep) step;
            String projectName = sequenceStep.getProjectName();
            String sequenceName = sequenceStep.getSequenceName();
            Project project = getProject(projectName, projectExplorerView);
            ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
            Sequence sequence = null;
            try {
                if (project != null)
                    sequence = project.getSequenceByName(sequenceStep.getSequenceName());
            } catch (EngineException e) {
                sequence = null;
            }
            SequenceNode sequenceNode = new SequenceNode(projectNode, sequenceName, sequence);
            projectNode.addChild(sequenceNode);
            if (!sequenceList.contains(projectName + sequenceName)) {
                sequenceList.add(projectName + sequenceName);
                requiresNode.addChild(projectNode);
            }
        } else if (step instanceof TransactionStep) {
            TransactionStep transactionStep = (TransactionStep) step;
            String projectName = transactionStep.getProjectName();
            String connectorName = transactionStep.getConnectorName();
            String transactionName = transactionStep.getTransactionName();
            Project project = getProject(projectName, projectExplorerView);
            ProjectNode projectNode = new ProjectNode(requiresNode, projectName, project);
            Connector connector = null;
            Transaction transaction = null;
            try {
                if (project != null) {
                    connector = project.getConnectorByName(connectorName);
                    if (connector != null) {
                        transaction = connector.getTransactionByName(transactionName);
                    }
                }
            } catch (EngineException e) {
                connector = null;
                transaction = null;
            }
            ConnectorNode connectorNode = getConnectorNode(projectNode, connector);
            if (connectorNode == null)
                connectorNode = new ConnectorNode(projectNode, connectorName, connector);
            projectNode.addChild(connectorNode);
            TransactionNode transactionNode = new TransactionNode(projectNode, transactionName, transaction);
            connectorNode.addChild(transactionNode);
            if (!transactionList.contains(projectName + connectorName + transactionName)) {
                transactionList.add(projectName + connectorName + transactionName);
                requiresNode.addChild(projectNode);
            }
        } else if (isStepContainer(step)) {
            List<Step> steps = getStepList(step);
            for (Step s : steps) {
                getSequenceReferencingRequires(s, sequenceSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
            }
        }
    } catch (Exception e) {
        ConvertigoPlugin.logException(e, "Unable to load the project", true);
    }
}
Also used : HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) EngineException(com.twinsoft.convertigo.engine.EngineException) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode) EngineException(com.twinsoft.convertigo.engine.EngineException) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Project(com.twinsoft.convertigo.beans.core.Project) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 4 with TransactionStep

use of com.twinsoft.convertigo.beans.steps.TransactionStep in project convertigo by convertigo.

the class ProjectTreeObject method checkForImports.

private void checkForImports(List<String> missingList, List<Step> steps) {
    String targetProjectName;
    for (Step step : steps) {
        if (step instanceof StepWithExpressions) {
            checkForImports(missingList, ((StepWithExpressions) step).getSteps());
        } else {
            if (step instanceof TransactionStep) {
                TransactionStep transactionStep = ((TransactionStep) step);
                targetProjectName = transactionStep.getProjectName();
                if (!targetProjectName.equals(getName())) {
                    try {
                        transactionStep.getSequence().getLoadedProject(targetProjectName);
                    } catch (EngineException e) {
                        if (!missingList.contains(targetProjectName))
                            missingList.add(targetProjectName);
                    }
                }
            } else if (step instanceof SequenceStep) {
                SequenceStep sequenceStep = ((SequenceStep) step);
                targetProjectName = sequenceStep.getProjectName();
                if (!targetProjectName.equals(getName())) {
                    try {
                        sequenceStep.getSequence().getLoadedProject(targetProjectName);
                    } catch (EngineException e) {
                        if (!missingList.contains(targetProjectName))
                            missingList.add(targetProjectName);
                    }
                }
            }
        }
    }
}
Also used : TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) EngineException(com.twinsoft.convertigo.engine.EngineException) Step(com.twinsoft.convertigo.beans.core.Step) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep)

Example 5 with TransactionStep

use of com.twinsoft.convertigo.beans.steps.TransactionStep in project convertigo by convertigo.

the class VariableTreeObject2 method handlesBeanNameChanged.

protected void handlesBeanNameChanged(TreeObjectEvent treeObjectEvent) {
    DatabaseObjectTreeObject treeObject = (DatabaseObjectTreeObject) treeObjectEvent.getSource();
    DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
    Object oldValue = treeObjectEvent.oldValue;
    Object newValue = treeObjectEvent.newValue;
    int update = treeObjectEvent.update;
    // Updates variables references
    if (update != TreeObjectEvent.UPDATE_NONE) {
        boolean isLocalProject = false;
        boolean isSameValue = false;
        boolean shouldUpdate = false;
        try {
            if (getObject() instanceof Variable) {
                Variable variable = (Variable) getObject();
                if (databaseObject instanceof RequestableVariable) {
                    isLocalProject = variable.getProject().equals(databaseObject.getProject());
                    isSameValue = variable.getName().equals(oldValue);
                    shouldUpdate = (update == TreeObjectEvent.UPDATE_ALL) || ((update == TreeObjectEvent.UPDATE_LOCAL) && (isLocalProject));
                    // Verify if parent of databaseObject is a transaction
                    if (databaseObject.getParent() instanceof Transaction) {
                        Transaction transaction = (Transaction) databaseObject.getParent();
                        // Case of rename for Call Transaction
                        if (variable.getParent() instanceof TransactionStep) {
                            TransactionStep transactionStep = (TransactionStep) variable.getParent();
                            if (transactionStep.getSourceTransaction().equals(transaction.getProject() + "." + transaction.getConnector() + "." + transaction.getName())) {
                                updateNameReference(isSameValue, shouldUpdate, variable, newValue);
                            }
                        }
                        /*
							 * propagation to testCases of variable renaming in a transaction
							 */
                        if (variable.getParent() instanceof TransactionWithVariables) {
                            propagateVariableRename(true, true, treeObjectEvent, ((TransactionWithVariables) transaction).getTestCasesList(), transaction.getName());
                        }
                    }
                    // Verify if parent of databaseObject is a sequence
                    if (databaseObject.getParent() instanceof Sequence) {
                        Sequence sequence = (Sequence) databaseObject.getParent();
                        // Case of rename for Call Sequence
                        if (variable.getParent() instanceof SequenceStep) {
                            SequenceStep sequenceStep = (SequenceStep) variable.getParent();
                            if (sequenceStep.getSourceSequence().equals(sequence.getProject() + "." + sequence.getName())) {
                                updateNameReference(isSameValue, shouldUpdate, variable, newValue);
                            }
                        }
                        /*
							 * propagation to testCases of variable renaming in a sequence
							 */
                        if (variable.getParent() instanceof Sequence) {
                            propagateVariableRename(true, true, treeObjectEvent, sequence.getTestCasesList(), sequence.getName());
                        }
                    }
                }
            }
        } catch (EngineException e) {
            ConvertigoPlugin.logException(e, "Unable to rename the variable references of '" + databaseObject.getName() + "'!");
        }
    }
}
Also used : SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) TestCaseVariable(com.twinsoft.convertigo.beans.variables.TestCaseVariable) Variable(com.twinsoft.convertigo.beans.core.Variable) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) EngineException(com.twinsoft.convertigo.engine.EngineException) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) Sequence(com.twinsoft.convertigo.beans.core.Sequence) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) Transaction(com.twinsoft.convertigo.beans.core.Transaction) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TransactionWithVariables(com.twinsoft.convertigo.beans.core.TransactionWithVariables) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Aggregations

TransactionStep (com.twinsoft.convertigo.beans.steps.TransactionStep)17 SequenceStep (com.twinsoft.convertigo.beans.steps.SequenceStep)15 Step (com.twinsoft.convertigo.beans.core.Step)13 EngineException (com.twinsoft.convertigo.engine.EngineException)12 Sequence (com.twinsoft.convertigo.beans.core.Sequence)11 RequestableStep (com.twinsoft.convertigo.beans.core.RequestableStep)9 Transaction (com.twinsoft.convertigo.beans.core.Transaction)9 Connector (com.twinsoft.convertigo.beans.core.Connector)8 Project (com.twinsoft.convertigo.beans.core.Project)7 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)7 HtmlTransaction (com.twinsoft.convertigo.beans.transactions.HtmlTransaction)7 ElseStep (com.twinsoft.convertigo.beans.steps.ElseStep)6 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)6 HtmlConnector (com.twinsoft.convertigo.beans.connectors.HtmlConnector)5 SqlConnector (com.twinsoft.convertigo.beans.connectors.SqlConnector)5 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)5 BlockStep (com.twinsoft.convertigo.beans.steps.BlockStep)5 BranchStep (com.twinsoft.convertigo.beans.steps.BranchStep)5 XMLComplexStep (com.twinsoft.convertigo.beans.steps.XMLComplexStep)5 JavelinTransaction (com.twinsoft.convertigo.beans.transactions.JavelinTransaction)5