Search in sources :

Example 1 with SharedProcessManager

use of com.navercorp.pinpoint.test.plugin.shared.SharedProcessManager in project pinpoint by naver.

the class PinpointPluginTestSuite method createSharedCasesWithDependencies.

private List<PinpointPluginTestInstance> createSharedCasesWithDependencies(PluginTestContext context) throws ArtifactResolutionException, DependencyResolutionException {
    DependencyResolver resolver = getDependencyResolver(this.repositories);
    Map<String, List<Artifact>> dependencyMap = resolver.resolveDependencySets(dependencies);
    if (logger.isDebugEnabled()) {
        for (Map.Entry<String, List<Artifact>> entry : dependencyMap.entrySet()) {
            logger.debug("{} {}", entry.getKey(), entry.getValue());
        }
    }
    List<PinpointPluginTestInstance> cases = new ArrayList<>();
    SharedProcessManager sharedProcessManager = new SharedProcessManager(context);
    for (Map.Entry<String, List<Artifact>> artifactEntry : dependencyMap.entrySet()) {
        final String testId = artifactEntry.getKey();
        final List<Artifact> artifacts = artifactEntry.getValue();
        List<String> libs = null;
        try {
            libs = resolveArtifactsAndDependencies(resolver, artifacts);
        } catch (DependencyResolutionException e) {
            // TODO Skip when running the test
            logger.warn(e, "resolveArtifactsAndDependencies failed testId={}", testId);
            continue;
        }
        PinpointPluginTestInstance testInstance = newSharedProcessPluginTestCase(context, testId, libs, sharedProcessManager);
        cases.add(testInstance);
        sharedProcessManager.registerTest(testInstance.getTestId(), artifacts);
    }
    return cases;
}
Also used : ArrayList(java.util.ArrayList) Artifact(org.eclipse.aether.artifact.Artifact) ArrayList(java.util.ArrayList) List(java.util.List) DependencyResolutionException(org.eclipse.aether.resolution.DependencyResolutionException) HashMap(java.util.HashMap) Map(java.util.Map) SharedProcessManager(com.navercorp.pinpoint.test.plugin.shared.SharedProcessManager)

Aggregations

SharedProcessManager (com.navercorp.pinpoint.test.plugin.shared.SharedProcessManager)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Artifact (org.eclipse.aether.artifact.Artifact)1 DependencyResolutionException (org.eclipse.aether.resolution.DependencyResolutionException)1