Skip to content

Commit

Permalink
#71 Add JUnit tests on business queries/ I_22 / sirius tables
Browse files Browse the repository at this point in the history
Change-Id: Iddf9dfc499047c05ca9bcdbdb57a1c5c07a0ac90
Signed-off-by: Erwann Traisnel <erwann.traisnel@obeo.fr>
  • Loading branch information
etraisnel2 authored and pdulth committed Sep 7, 2023
1 parent 6ebb220 commit 585e871
Show file tree
Hide file tree
Showing 16 changed files with 5,862 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tableRequirements</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.polarsys.capella.project.nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cleanPreviousValidationResults=true
eclipse.preferences.version=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata:Metadata xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:metadata="http://www.polarsys.org/kitalpha/ad/metadata/1.0.0" id="_AQFFEPOBEeaZnfll6B5lKw">
<viewpointReferences id="_AbGpUPOBEeaZnfll6B5lKw" vpId="org.polarsys.capella.core.viewpoint" version="7.0.0"/>
<viewpointReferences id="_B-acIDwuEe66NYq4UIzSXQ" vpId="org.polarsys.capella.basic.requirement" version="1.0.0"/>
<additionalMetadata href="CrossTable-OAlib.afm#_FHHgMDwzEe66NYq4UIzSXQ"/>
</metadata:Metadata>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata:Metadata xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:metadata="http://www.polarsys.org/kitalpha/ad/metadata/1.0.0" id="_FHHgMDwzEe66NYq4UIzSXQ">
<viewpointReferences id="_FHXX0DwzEe66NYq4UIzSXQ" vpId="org.polarsys.capella.core.viewpoint" version="7.0.0"/>
<viewpointReferences id="_JO8lUDxAEe66rLiMTK70NQ" vpId="org.polarsys.capella.basic.requirement" version="1.0.0"/>
</metadata:Metadata>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description" uid="_FHIuUDwzEe66NYq4UIzSXQ" selectedViews="_FHmoYDwzEe66NYq4UIzSXQ _FIgnUDwzEe66NYq4UIzSXQ _FLebwDwzEe66NYq4UIzSXQ _FMbeADwzEe66NYq4UIzSXQ _FMhkoDwzEe66NYq4UIzSXQ _FNTAsDwzEe66NYq4UIzSXQ _FOUUYDwzEe66NYq4UIzSXQ _JPRVcDxAEe66rLiMTK70NQ" version="15.2.0.202303281325">
<semanticResources>CrossTable-OAlib.afm</semanticResources>
<semanticResources>CrossTable-OAlib.capella</semanticResources>
<ownedViews xmi:type="viewpoint:DView" uid="_FHmoYDwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.kitalpha.ad.integration.sirius/description/ad.odesign#//@ownedViewpoints[name='ad']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_FIgnUDwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/physical.odesign#//@ownedViewpoints[name='Physical%20Architecture']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_FLebwDwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/context.odesign#//@ownedViewpoints[name='System%20Analysis']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_FMbeADwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/EPBS.odesign#//@ownedViewpoints[name='EPBS%20architecture']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_FMhkoDwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/oa.odesign#//@ownedViewpoints[name='Operational%20Analysis']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_FNTAsDwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/common.odesign#//@ownedViewpoints[name='Common']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_FOUUYDwzEe66NYq4UIzSXQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.core.sirius.analysis/description/logical.odesign#//@ownedViewpoints[name='Logical%20Architecture']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_JPRVcDxAEe66rLiMTK70NQ">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.polarsys.capella.basic.requirement.sirius.analysis/description/Requirement.odesign#//@ownedViewpoints[name='Requirement']"/>
</ownedViews>
</viewpoint:DAnalysis>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<application>${capella-application-id}</application>
<useUIHarness>true</useUIHarness>
<useUIThread>true</useUIThread>
<testClass>org.polarsys.capella.basic.requirement.tests.ju.MainTestSuite</testClass>
<testClass>org.polarsys.capella.basic.requirement.tests.ju.RequirementsTableTestSuite</testClass>
<dependencies>
<!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=462862 -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.basic.requirement.tests.ju;

import java.util.Arrays;
import java.util.List;

import org.polarsys.capella.test.business.queries.ju.BQTestCase;

/**
* @generated
*/
public class CapellaElement_OutgoingRequirement extends BQTestCase {

/**
* @generated
*/
public String getProjectForTest() {
return "CrossTable-OA"; //$NON-NLS-1$
}

/**
* @generated
*/
public String getLibProjectForTest() {
return ""; //$NON-NLS-1$
}

@Override
public List<String> getRequiredTestModels() {
return Arrays.asList(new String[] { getProjectForTest() });
}

/**
* @generated
*/
@Override
public String getBQFullQualifiedName() {
return "org.polarsys.capella.basic.requirement.business.queries.CapellaElement_OutgoingRequirement"; //$NON-NLS-1$
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.basic.requirement.tests.ju;

import java.util.Arrays;
import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.table.metamodel.table.DTable;
import org.polarsys.capella.basic.requirement.sirius.analysis.IRequirementDiagramNameConstants;

public class CrossTableOATestCase extends RequirementsTableTestFramework {


@Override
public void test() throws Exception {
init();
createTable(context, operationalAnalysisId,
IRequirementDiagramNameConstants.OPERATIONAL_ACTIVITIES_REQUIREMENTS_DIAGRAM_NAME);
DTable table = openTable(context, crossTableOAName);

/**
* Create requirement Trace between Capture Meteorological Data OA and Requirement Requirement Trace is created
* between Capture Meteorological Data OA and Requirement\ with source element the OA and the target element as the
* requirement
*/
createRequirementTrace(table, _captureMetDataOA, _captureMetDataReq);

/**
* Create requirement Trace between Publish Meteorological Report OA and Requirement
* <P>
* Requirement Trace is created between Publish Meteorological Report OA and Requirement with source element the OA
* and the target element as the requirement
*/
createRequirementTrace(table, _publishMetReportOA, _publishMetReportReq);

/**
* Create requirement Trace between Build Meteorological Report OA and Requirement
* <P>
* Requirement Trace is created between Build Meteorological Report OA and Requirement with source element the OA
* and the target element as the requirement
*/
createRequirementTrace(table, _buildMetReportOA, _buildMetReportReq);

/**
* Create requirement Trace between Elaborate Meteorological Forecast OA and Requirement
* <P>
* Requirement Trace is created between Elaborate Meteorological Forecast OA and Requirement with source element the
* OA and the target element as the requirement
*/
createRequirementTrace(table, _elabMetForecastOA, _elabMetForecastReq);

/**
* Create requirement Trace between Elaborate Current Situation OA and Requirement
* <P>
* Requirement Trace is created between Elaborate Current Situation OA and Requirement with source element the OA
* and the target element as the requirement
*/
createRequirementTrace(table, _elabCurrSituationOA, _elabCurrSituationReq);

/**
* Create requirement Trace between Access Meteorological Report OA and Requirement
* <P>
* Requirement Trace is created between Access Meteorological Report OA and Requirement with source element the OA
* and the target element as the requirement
*/
createRequirementTrace(table, _accessMetReportOA, _accessMetReportReq);

/**
* Create requirement Trace between Make Meteorological Data Evolve OA and Requirement
* <P>
* Requirement Trace is created between Make Meteorological Data Evolve OA and Requirement with source element the
* OA and the target element as the requirement
*/
createRequirementTrace(table, _makeMetDataEvolveOA, _makeMetDataEvolveReq);

/**
* Delete requirement Trace between Capture Meteorological Data OA and Requirement
* <P>
* Requirement Trace is deleted between Capture Meteorological Data OA and Requirement with source element the OA
* and the target element as the requirement
*/
deleteRequirementTrace(table, _captureMetDataOA, _captureMetDataReq);

/**
* Hide the OA "Publish Meteorological Report" from the table
* <P>
* The OA "Publish Meteorological Report" is hidden from the table
*/
hideLine(context, table, _publishMetReportOA);

/**
* Hide the OA "Deliver Meteorological Information" from the table
* <P>
* The OA "Deliver Meteorological Information" is hidden from the table as well as all its children OA
*/
hideLineWithChildren(table, _deliverMetInfoOA);

/**
* Hide the Requirement "Capture Meteorological Data" column from the table
* <P>
* The Requirement "Capture Meteorological Data" column is hidden from the table
*/
hideColumn(context, table, _captureMetDataReq);

/**
* Execute Show/Hide lines with Elaborate Met Forecast OA and Make Met Data Evolve OA unselected and the rest of the
* OAs selected
* <P>
* Elaborate Met Forecast OA and Make Met Data Evolve OA are hidden and all other lines are shown in the table
*/
List<EObject> visibleLines = Arrays.asList(_deliverMetInfoOA, _publishMetReportOA, _buildMetReportOA,
_elabCurrSituationOA, _accessMetReportOA, _captureMetDataOA);
List<EObject> hiddenLines = Arrays.asList(_elabMetForecastOA, _makeMetDataEvolveOA);
hideLines(context, table, visibleLines, hiddenLines);

/**
* Execute Show/Hide Columns with Capture Met Data, Elaborate Current Situation, and Publish Met Report requirements
* unselected and the rest of the requirements selected
* <P>
* Capture Met Data, Elaborate Current Situation, and Publish Met Report requirement columns are hidden and all
* other columns are shown in the table
*/
List<EObject> visibleColumns = Arrays.asList(_buildMetReportReq, _elabMetForecastReq, _accessMetReportReq,
_makeMetDataEvolveReq);
List<EObject> hiddenColumns = Arrays.asList(_captureMetDataReq, _elabCurrSituationReq, _publishMetReportReq);
hideColumns(context, table, visibleColumns, hiddenColumns);

/**
* Execute Show All Lines command on the table
* <P>
* All Lines in the table become visible
*/
showAllLines(context, table);

/**
* Execute Show All Columns command on the table
* <P>
* All Columns in the table become visible
*/
showAllColumns(context, table);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*******************************************************************************
* Copyright (c) 2019, 2020 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.basic.requirement.tests.ju;

import org.eclipse.sirius.table.metamodel.table.DTable;
import org.polarsys.capella.basic.requirement.sirius.analysis.IRequirementDiagramNameConstants;

public class RequirementsTableTestCase extends RequirementsTableTestFramework {

@Override
public void test() throws Exception {
init();
DTable table = createTable(context, rootReqPkgId, IRequirementDiagramNameConstants.REQUIREMENTS_DIAGRAM_NAME);

/**
* Create a new System User Requirement SUR1 in Root Req Pkg
* <P>
* New System User Requirement is created and added under Root Req Pkg
*/
_systemUserReq = createRequirementSUR(table, _rootReqPkg);

/**
* Create a new System Functional Requirement SFR in Root Req Pkg
* <P>
* New System Functional Requirement is created and added under Root Req Pkg
*/
_systemFuncReq = createRequirementSFR(table, _rootReqPkg);

/**
* Create a new System Functional Interface Requirement SFIR in Root Req Pkg
* <P>
* New System User Requirement is created and added under Root Req Pkg
*/
createRequirementSFIR(table, _rootReqPkg);

/**
* Create a new System Non Functional Requirement SNFR in Root Req Pkg
* <P>
* New System Non Functional Requirement is created and added under Root Req Pkg
*/
createRequirementSNFR(table, _rootReqPkg);

/**
* Create a new System Non Functional Interface Requirement SNFIR in Root Req Pkg
* <P>
* New System Non Functional Interface Requirement is created and added under Root Req Pkg
*/
createRequirementSNFIR(table, _rootReqPkg);

/**
* Create a new Sub Req Pkg in Root Req Pkg
* <P>
* New Sub Req Pkg is created and added under Root Req Pkg
*/
createRequirementREQPKG(table, _rootReqPkg);

}
}
Loading

0 comments on commit 585e871

Please sign in to comment.