Package com._1c.g5.v8.dt.testing.compare
Class CompareTestUtils
java.lang.Object
com._1c.g5.v8.dt.testing.compare.CompareTestUtils
Common utilities for testing of compare/merge mechanism.
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 voidcheckoutContent(org.eclipse.jgit.api.Git git, String commitId) Checkouts git repository to the specific commit.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) createDataSourceDescriptor(IV8Project v8Project, DataSourceType type, Class<?> sourceClass) Creates comparison data source descriptor.static EObjectTriecreateEObjectTrie(String... symlinks) CreatesEObjectTriefor the given collection of symlinks.createFileSystemDescriptor(String projectName, Class<?> sourceClass) createFileSystemDescriptor(String folderName, String deltaBaseProjectName, Class<?> sourceClass) createGitDescriptor(File workTree, String projectPathInRepo, String revision) createV8ProjectDescriptor(IV8Project v8Project) createV8ProjectDescriptor(String projectName, TestingWorkspace testingWorkspace, IV8ProjectManager projectManager, Class<?> sourceClass) static voidstatic <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) findMethodOrProcedure(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) getFileListRecursively(IV8Project project, Path path) Returns all files in given folder and subfolders.static org.eclipse.jgit.lib.RepositorygetGitRepository(File workTree) Opens a repository from given work tree file.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.RepositoryprepareGitRepoWithCheckout(String commitId, File workTree) Creates a repository matching the parameters passed using checkout.static org.eclipse.jgit.lib.RepositoryprepareGitRepoWithHardReset(String commitId, File workTree) Creates a repository matching the parameters passed using hard reset.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 booleanstatic voidwaitComparison(IComparisonManager comparisonManager, ComparisonProcessHandle comparisonHandle) static voidwaitForJobFinish(Object jobFamily)
-
Method Details
-
getBundleEntry
- Throws:
IOException
-
createComparisonBatch
-
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
-
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
-
waitForJobFinish
-
disableConfigurationNameMerging
-
getRevCommit
public static org.eclipse.jgit.revwalk.RevCommit getRevCommit(org.eclipse.jgit.lib.Repository repo, String refName) throws IOException - Throws:
IOException
-
getTopNode
-
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
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
-
prepareGitRepoWithHardReset
public static org.eclipse.jgit.lib.Repository prepareGitRepoWithHardReset(String commitId, File workTree) throws Exception Creates a repository matching the parameters passed using hard reset.- Parameters:
commitId- commit id to reset repository to, cannot benullworkTree- top level directory of the working files, cannot benull- Returns:
- repository matching parameters passed, never
null - Throws:
Exception- if an error occurred while configuring the repository
-
resetContent
Resets 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.
-
prepareGitRepoWithCheckout
public static org.eclipse.jgit.lib.Repository prepareGitRepoWithCheckout(String commitId, File workTree) throws Exception Creates a repository matching the parameters passed using checkout.- Parameters:
commitId- commit id to checkout to, cannot benullworkTree- top level directory of the working files, cannot benull- Returns:
- repository matching parameters passed, never
null - Throws:
Exception- if an error occurred while configuring the repository
-
getGitRepository
Opens a repository from given work tree file.- Parameters:
workTree- top level directory of the working files, cannot benull- Returns:
- opened repository, never
null - Throws:
IOException- if an error occurred while configuring the repository
-
checkoutContent
Checkouts git repository to the specific commit.- Parameters:
git- git object, cannot benullcommitId- commit to checkout to, cannot benull- Throws:
Exception- if an error occurred while executing reset command
-
createEObjectTrie
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
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
-