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 voidaddCatalogAndWait(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 voidaddEnumAndWait(String enumSymlink, IComparisonSession session, IComparisonManager comparisonManager, IV8ProjectManager v8ProjectManager, IWorkspaceOrchestrator workspaceOrchestrator)Adds new Enum object into the MAIN DT project under the active comparison session.static CompareMergeProcessBatchcreateComparisonBatch(ComparisonProcessHandle... handles)static CompareMergeProcessBatchcreateComparisonBatch(MatchingStrategy matchingStrategy, boolean mainSideObjectsDeletionAllowed, ComparisonProcessHandle... handles)static CompareMergeProcessBatchcreateComparisonBatch(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)static CompareMergeProcessBatchcreateComparisonBatchForLibraryIntegration(String integrationSettingsName, MatchingStrategy matchingStrategy, boolean mainSideObjectsDeletionAllowed, ComparisonProcessHandle... handles)Creates comparison batch for the library integration processstatic CompareMergeProcessBatchcreateComparisonBatchMergeObjectsContent(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)static CompareMergeProcessBatchcreateComparisonBatchMergeObjectsContent(MatchingStrategy matchingStrategy, List<ObjectsTriple<String>> correspondences, ComparisonProcessHandle... handles)static CompareMergeProcessBatchcreateComparisonBatchMergeWithInfobase(ComparisonProcessHandle handle, IEObjectTrie mainSideModifiedObjectsTrie, IEObjectTrie otherSideModifiedObjectsTrie)static CompareMergeProcessBatchcreateComparisonBatchMergeWithInfobase(ComparisonProcessHandle handle, MatchingStrategy matchingStrategy, IEObjectTrie mainSideModifiedObjectsTrie, IEObjectTrie otherSideModifiedObjectsTrie)static CompareMergeProcessBatchcreateComparisonBatchParseBslModuleStructure(MatchingStrategy matchingStrategy, ComparisonProcessHandle... handles)static IComparisonDataSourceDescriptorcreateDataSourceDescriptor(IV8Project v8Project, DataSourceType type, Class<?> sourceClass)Creates comparison data source descriptor.static EObjectTriecreateEObjectTrie(String... symlinks)CreatesEObjectTriefor the given collection of symlinks.static FileSystemComparisonDataSourceDescriptorcreateFileSystemDescriptor(String projectName, Class<?> sourceClass)static FileSystemComparisonDataSourceDescriptorcreateFileSystemDescriptor(String folderName, String deltaBaseProjectName, Class<?> sourceClass)static GitComparisonDataSourceDescriptorcreateGitDescriptor(File workTree, String projectPathInRepo, String revision)static V8ProjectComparisonDataSourceDescriptorcreateV8ProjectDescriptor(IV8Project v8Project)static V8ProjectComparisonDataSourceDescriptorcreateV8ProjectDescriptor(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass)static voiddisableConfigurationNameMerging(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 BslModuleSectionComparisonNodefindMethodOrProcedure(IComparisonSession session, BslModuleComparisonNode parent, String methodName)static FilegetBundleEntry(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.QualifiedNamegetQualifiedName(String symlink)Returns the qualified name for the given symlink.static org.eclipse.jgit.revwalk.RevCommitgetRevCommit(org.eclipse.jgit.lib.Repository repo, String refName)static org.eclipse.emf.ecore.EObjectgetTopLevelObject(String symlink, IV8Project v8Project, IBmModelManager bmModelManager)static TopComparisonNodegetTopNode(IComparisonSession session, String symlink)static IV8ProjectopenV8Project(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass)static IV8ProjectopenV8Project(String projectName, Path sourceRoot, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager)static IV8ProjectopenV8ProjectAndDisableAllChecks(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, IWorkspaceOrchestrator workspaceOrchestrator, ICheckRepository checkRepository, Class<?> sourceClass)static IV8ProjectopenV8ProjectAndDisableAllChecks(String projectName, Path sourceRoot, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, IWorkspaceOrchestrator workspaceOrchestrator, ICheckRepository checkRepository)static org.eclipse.jgit.lib.RepositoryprepareGitRepo(String commitId, File workTree)Creates a repository matching the parameters passed.static voidresetContent(org.eclipse.jgit.api.Git git, String commitId)Resets HARD the given git repository to the specified commit.static voidsetCorrespondencesAndWait(IComparisonManager comparisonManager, IComparisonSession session, ObjectsTriple<String> correspondence)static voidsetMergeRule(IComparisonSession session, ComparisonNode node, MergeRule ruleToSet)static voidsetOrderSide(IComparisonSession session, ComparisonNode node, ComparisonSide orderSideToSet)static voidstartComparison(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)static voidstartComparison(IComparisonManager comparisonManager, ComparisonProcessHandle handle)static voidstartComparisonAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)static voidstartComparisonAndWait(IComparisonManager comparisonManager, ComparisonProcessHandle handle)static voidstartComparisonAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch)static voidstartMerge(IComparisonManager comparisonManager, CompareMergeProcessBatch batch)static voidstartMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace)static voidstartMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider)static voidstartMergeAndWait(IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider, boolean expectSuccess)static voidstartMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace)static voidstartMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider)static voidstartMergeAndWait(String message, IComparisonManager comparisonManager, CompareMergeProcessBatch batch, TestingWorkspace testingWorkspace, IDerivedDataManagerProvider derivedDataManagerProvider, boolean expectSuccess)static booleanstopJob(String jobFamily, boolean waitToStop)static voidwaitComparison(IComparisonManager comparisonManager, ComparisonProcessHandle comparisonHandle)static voidwaitForJobFinish(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)
-
createComparisonBatchMergeWithInfobase
public static CompareMergeProcessBatch createComparisonBatchMergeWithInfobase(ComparisonProcessHandle handle, MatchingStrategy matchingStrategy, 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)
-
waitComparison
public static void waitComparison(IComparisonManager comparisonManager, ComparisonProcessHandle comparisonHandle)
-
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 org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
openV8ProjectAndDisableAllChecks
public static IV8Project openV8ProjectAndDisableAllChecks(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, IWorkspaceOrchestrator workspaceOrchestrator, ICheckRepository checkRepository, Class<?> sourceClass) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
openV8ProjectAndDisableAllChecks
public static IV8Project openV8ProjectAndDisableAllChecks(String projectName, Path sourceRoot, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, IWorkspaceOrchestrator workspaceOrchestrator, ICheckRepository checkRepository) throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
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 folderName, String deltaBaseProjectName, Class<?> sourceClass) throws IOException
- Throws:
IOException
-
createGitDescriptor
public static GitComparisonDataSourceDescriptor createGitDescriptor(File workTree, String projectPathInRepo, String revision) throws IOException
- Throws:
IOException
-
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 benullpath- 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 benullmatchingStrategy- The matching strategy. May not benullmainSideObjectsDeletionAllowed- The main side removal allowance flaghandles- The comparison process handle set. May not benullor 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 benulltype- data source type, cannot benullsourceClass- 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 benullor emptysession- the active comparison session, cannot benullcomparisonManager- the comparison manager, cannot benullv8ProjectManager- the V8 project manager, cannot benullworkspaceOrchestrator- the workspace orchestrator, cannot benull
-
addEnumAndWait
public static void addEnumAndWait(String enumSymlink, IComparisonSession session, IComparisonManager comparisonManager, IV8ProjectManager v8ProjectManager, IWorkspaceOrchestrator workspaceOrchestrator)
Adds new Enum object into the MAIN DT project under the active comparison session.- Parameters:
enumSymlink- the symlink of the enum to be added, cannot benullor emptysession- the active comparison session, cannot benullcomparisonManager- the comparison manager, cannot benullv8ProjectManager- the V8 project manager, cannot benullworkspaceOrchestrator- 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 benullworkTree- 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 ExceptionResets HARD the given git repository to the specified commit.- Parameters:
git- git object, cannot benullcommitId- commit to reset to, cannot benull- Throws:
Exception- if an error occurred while execute reset command.
-
createEObjectTrie
public static EObjectTrie createEObjectTrie(String... symlinks)
CreatesEObjectTriefor the given collection of symlinks.- Parameters:
symlinks- the collection of symlinks to createEObjectTriefor, cannot benull- Returns:
- the
EObjectTriefor 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
-
-