Package com._1c.g5.v8.dt.testing.compare
Class CompareTestUtils
- java.lang.Object
-
- com._1c.g5.v8.dt.testing.compare.CompareTestUtils
-
public final class CompareTestUtils extends Object
Common utilities for testing of compare/merge mechanism.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addCatalogAndWait(String catalogSymlink, IComparisonSession session, IComparisonManager comparisonManager, IV8ProjectManager v8ProjectManager, IWorkspaceOrchestrator workspaceOrchestrator)
Adds new Catalog object into the MAIN DT project under the active comparison session.static CompareMergeProcessBatch
createComparisonBatch(ComparisonProcessHandle... handles)
static CompareMergeProcessBatch
createComparisonBatch(MatchingStrategy matchingStrategy, boolean mainSideObjectsDeletionAllowed, ComparisonProcessHandle... handles)
static CompareMergeProcessBatch
createComparisonBatch(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)
static CompareMergeProcessBatch
createComparisonBatchForLibraryIntegration(String integrationSettingsName, MatchingStrategy matchingStrategy, boolean mainSideObjectsDeletionAllowed, ComparisonProcessHandle... handles)
Creates comparison batch for the library integration processstatic CompareMergeProcessBatch
createComparisonBatchMergeObjectsContent(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)
static CompareMergeProcessBatch
createComparisonBatchMergeObjectsContent(MatchingStrategy matchingStrategy, List<ObjectsTriple<String>> correspondences, ComparisonProcessHandle... handles)
static CompareMergeProcessBatch
createComparisonBatchMergeWithInfobase(ComparisonProcessHandle handle, IEObjectTrie mainSideModifiedObjectsTrie, IEObjectTrie otherSideModifiedObjectsTrie)
static CompareMergeProcessBatch
createComparisonBatchParseBslModuleStructure(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)
static IComparisonDataSourceDescriptor
createDataSourceDescriptor(IV8Project v8Project, DataSourceType type, Class<?> sourceClass)
Creates comparison data source descriptor.static EObjectTrie
createEObjectTrie(String... symlinks)
CreatesEObjectTrie
for the given collection of symlinks.static FileSystemComparisonDataSourceDescriptor
createFileSystemDescriptor(String projectName, boolean deltaSource, Class<?> sourceClass)
static FileSystemComparisonDataSourceDescriptor
createFileSystemDescriptor(String projectName, Class<?> sourceClass)
static GitComparisonDataSourceDescriptor
createGitDescriptor(File workTree, String projectPathInRepo, String revision, boolean useIndex)
static V8ProjectComparisonDataSourceDescriptor
createV8ProjectDescriptor(IV8Project v8Project)
static V8ProjectComparisonDataSourceDescriptor
createV8ProjectDescriptor(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass)
static void
disableConfigurationNameMerging(IComparisonSession session)
static <T extends FeatureComparisonNode>
TfindChildNodeByFeature(IComparisonSession session, ComparisonNode parent, org.eclipse.emf.ecore.EStructuralFeature feature)
static <T extends ComparisonNode>
TfindChildNodeByFeaturePath(IComparisonSession session, ComparisonNode nearestTopNode, org.eclipse.emf.ecore.EStructuralFeature... featuresPath)
static BslModuleSectionComparisonNode
findMethodOrProcedure(IComparisonSession session, BslModuleComparisonNode parent, String methodName)
static File
getBundleEntry(Class<?> clazz, String path)
static IComparedObjects<?>
getComparedObjects(IComparisonSession session, ComparisonNode node)
static <T extends ComparisonNode>
TgetContainmentNode(IComparisonSession session, String nearestTopNodeSymlink, org.eclipse.emf.ecore.EStructuralFeature... featuresPath)
static List<Path>
getFileListRecursively(IV8Project project, Path path)
Returns all files in given folder and subfolders.static org.eclipse.xtext.naming.QualifiedName
getQualifiedName(String symlink)
Returns the qualified name for the given symlink.static org.eclipse.jgit.revwalk.RevCommit
getRevCommit(org.eclipse.jgit.lib.Repository repo, String refName)
static org.eclipse.emf.ecore.EObject
getTopLevelObject(String symlink, IV8Project v8Project, IBmModelManager bmModelManager)
static TopComparisonNode
getTopNode(IComparisonSession session, String symlink)
static IV8Project
openV8Project(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass)
static IV8Project
openV8Project(String projectName, Path sourceRoot, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager)
static org.eclipse.jgit.lib.Repository
prepareGitRepo(String commitId, File workTree)
Creates a repository matching the parameters passed.static void
resetContent(org.eclipse.jgit.api.Git git, String commitId)
Resets HARD the given git repository to the specified commit.static void
setCorrespondencesAndWait(IComparisonManager comparisonManager, IComparisonSession session, ObjectsTriple<String> correspondence)
static void
setMergeRule(IComparisonSession session, ComparisonNode node, MergeRule ruleToSet)
static void
setOrderSide(IComparisonSession session, ComparisonNode node, ComparisonSide orderSideToSet)
static void
startComparison(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
static void
startComparison(IComparisonManager comparisonManager, ComparisonProcessHandle handle)
static void
startComparisonAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
static void
startComparisonAndWait(IComparisonManager comparisonManager, ComparisonProcessHandle handle)
static void
startComparisonAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
static void
startMerge(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
static void
startMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace)
static void
startMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider)
static void
startMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider, boolean expectSuccess)
static void
startMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace)
static void
startMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider)
static void
startMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider, boolean expectSuccess)
static boolean
stopJob(String jobFamily, boolean waitToStop)
static void
waitForJobFinish(Object jobFamily)
-
-
-
Method Detail
-
getBundleEntry
public static File getBundleEntry(Class<?> clazz, String path) throws IOException
- Throws:
IOException
-
createComparisonBatch
public static CompareMergeProcessBatch createComparisonBatch(ComparisonProcessHandle... handles)
-
createComparisonBatch
public static CompareMergeProcessBatch createComparisonBatch(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)
-
createComparisonBatch
public static CompareMergeProcessBatch createComparisonBatch(MatchingStrategy matchingStrategy, boolean mainSideObjectsDeletionAllowed, ComparisonProcessHandle... handles)
-
createComparisonBatchMergeObjectsContent
public static CompareMergeProcessBatch createComparisonBatchMergeObjectsContent(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)
-
createComparisonBatchMergeObjectsContent
public static CompareMergeProcessBatch createComparisonBatchMergeObjectsContent(MatchingStrategy matchingStrategy, List<ObjectsTriple<String>> correspondences, ComparisonProcessHandle... handles)
-
createComparisonBatchMergeWithInfobase
public static CompareMergeProcessBatch createComparisonBatchMergeWithInfobase(ComparisonProcessHandle handle, IEObjectTrie mainSideModifiedObjectsTrie, IEObjectTrie otherSideModifiedObjectsTrie)
-
createComparisonBatchParseBslModuleStructure
public static CompareMergeProcessBatch createComparisonBatchParseBslModuleStructure(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)
-
startComparison
public static void startComparison(IComparisonManager comparisonManager, ComparisonProcessHandle handle)
-
startComparison
public static void startComparison(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
-
startMerge
public static void startMerge(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
-
startComparisonAndWait
public static void startComparisonAndWait(IComparisonManager comparisonManager, ComparisonProcessHandle handle)
-
startComparisonAndWait
public static void startComparisonAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
-
startComparisonAndWait
public static void startComparisonAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)
-
startMergeAndWait
public static void startMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace)
-
startMergeAndWait
public static void startMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace)
-
startMergeAndWait
public static void startMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider)
-
startMergeAndWait
public static void startMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider)
-
startMergeAndWait
public static void startMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider, boolean expectSuccess)
-
startMergeAndWait
public static void startMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider, boolean expectSuccess)
-
stopJob
public static boolean stopJob(String jobFamily, boolean waitToStop)
-
waitForJobFinish
public static void waitForJobFinish(Object jobFamily)
-
disableConfigurationNameMerging
public static void disableConfigurationNameMerging(IComparisonSession session)
-
getRevCommit
public static org.eclipse.jgit.revwalk.RevCommit getRevCommit(org.eclipse.jgit.lib.Repository repo, String refName) throws IOException
- Throws:
IOException
-
getTopNode
public static TopComparisonNode getTopNode(IComparisonSession session, String symlink)
-
getComparedObjects
public static IComparedObjects<?> getComparedObjects(IComparisonSession session, ComparisonNode node)
-
findChildNodeByFeature
public static <T extends FeatureComparisonNode> T findChildNodeByFeature(IComparisonSession session, ComparisonNode parent, org.eclipse.emf.ecore.EStructuralFeature feature)
-
findMethodOrProcedure
public static BslModuleSectionComparisonNode findMethodOrProcedure(IComparisonSession session, BslModuleComparisonNode parent, String methodName)
-
findChildNodeByFeaturePath
public static <T extends ComparisonNode> T findChildNodeByFeaturePath(IComparisonSession session, ComparisonNode nearestTopNode, org.eclipse.emf.ecore.EStructuralFeature... featuresPath)
-
getContainmentNode
public static <T extends ComparisonNode> T getContainmentNode(IComparisonSession session, String nearestTopNodeSymlink, org.eclipse.emf.ecore.EStructuralFeature... featuresPath)
-
setCorrespondencesAndWait
public static void setCorrespondencesAndWait(IComparisonManager comparisonManager, IComparisonSession session, ObjectsTriple<String> correspondence)
-
setMergeRule
public static void setMergeRule(IComparisonSession session, ComparisonNode node, MergeRule ruleToSet)
-
setOrderSide
public static void setOrderSide(IComparisonSession session, ComparisonNode node, ComparisonSide orderSideToSet)
-
openV8Project
public static IV8Project openV8Project(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
openV8Project
public static IV8Project openV8Project(String projectName, Path sourceRoot, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager) throws Exception
- Throws:
Exception
-
createV8ProjectDescriptor
public static V8ProjectComparisonDataSourceDescriptor createV8ProjectDescriptor(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
createV8ProjectDescriptor
public static V8ProjectComparisonDataSourceDescriptor createV8ProjectDescriptor(IV8Project v8Project)
-
createFileSystemDescriptor
public static FileSystemComparisonDataSourceDescriptor createFileSystemDescriptor(String projectName, Class<?> sourceClass) throws IOException
- Throws:
IOException
-
createFileSystemDescriptor
public static FileSystemComparisonDataSourceDescriptor createFileSystemDescriptor(String projectName, boolean deltaSource, Class<?> sourceClass) throws IOException
- Throws:
IOException
-
createGitDescriptor
public static GitComparisonDataSourceDescriptor createGitDescriptor(File workTree, String projectPathInRepo, String revision, boolean useIndex) throws Exception
- Throws:
Exception
-
getTopLevelObject
public static org.eclipse.emf.ecore.EObject getTopLevelObject(String symlink, IV8Project v8Project, IBmModelManager bmModelManager)
-
getFileListRecursively
public static List<Path> getFileListRecursively(IV8Project project, Path path)
Returns all files in given folder and subfolders.- Parameters:
project
- the project path belongs to, cannot benull
path
- folder path, where to search for files, cannot benull
- Returns:
- all files in given folder and subfolders
-
createComparisonBatchForLibraryIntegration
public static CompareMergeProcessBatch createComparisonBatchForLibraryIntegration(String integrationSettingsName, MatchingStrategy matchingStrategy, boolean mainSideObjectsDeletionAllowed, ComparisonProcessHandle... handles)
Creates comparison batch for the library integration process- Parameters:
integrationSettingsName
- The name of the integration settings. The corresponding file should be present in the target configuration. May not benull
matchingStrategy
- The matching strategy. May not benull
mainSideObjectsDeletionAllowed
- The main side removal allowance flaghandles
- The comparison process handle set. May not benull
or empty- Returns:
- The comparison process batch. May not be
null
-
createDataSourceDescriptor
public static IComparisonDataSourceDescriptor createDataSourceDescriptor(IV8Project v8Project, DataSourceType type, Class<?> sourceClass)
Creates comparison data source descriptor.- Parameters:
v8Project
- V8 project, cannot benull
type
- data source type, cannot benull
sourceClass
- the source class, cannot benull
- Returns:
- reference to {link IComparisonDataSourceDescriptor} for selected
DataSourceType
, nevernull
-
addCatalogAndWait
public static void addCatalogAndWait(String catalogSymlink, IComparisonSession session, IComparisonManager comparisonManager, IV8ProjectManager v8ProjectManager, IWorkspaceOrchestrator workspaceOrchestrator)
Adds new Catalog object into the MAIN DT project under the active comparison session.- Parameters:
catalogSymlink
- the symlink of the catalog to be added, cannot benull
or emptysession
- the active comparison session, cannot benull
comparisonManager
- the comparison manager, cannot benull
v8ProjectManager
- the V8 project manager, cannot benull
workspaceOrchestrator
- the workspace orchestrator, cannot benull
-
prepareGitRepo
public static org.eclipse.jgit.lib.Repository prepareGitRepo(String commitId, File workTree) throws Exception
Creates a repository matching the parameters passed.- Parameters:
commitId
- commit id to reset repository to, cannot benull
workTree
- top level directory of the working files, cannor benull
- Returns:
- reposity repository matching parameters passed, cannot be
null
- Throws:
Exception
- if an error occurred while configuring the repository
-
resetContent
public static void resetContent(org.eclipse.jgit.api.Git git, String commitId) throws Exception
Resets HARD the given git repository to the specified commit.- Parameters:
git
- git object, cannot benull
commitId
- commit to reset to, cannot benull
- Throws:
Exception
- if an error occurred while execute reset command.
-
createEObjectTrie
public static EObjectTrie createEObjectTrie(String... symlinks)
CreatesEObjectTrie
for the given collection of symlinks.- Parameters:
symlinks
- the collection of symlinks to createEObjectTrie
for, cannot benull
- Returns:
- the
EObjectTrie
for the given collection of symlinks, nevernull
-
getQualifiedName
public static org.eclipse.xtext.naming.QualifiedName getQualifiedName(String symlink)
Returns the qualified name for the given symlink.- Parameters:
symlink
- the symlink to get the qualified name for, cannot benull
- Returns:
- the qualified name, never
null
-
-