当前位置: 首页>>代码示例>>Java>>正文


Java JavaTestConfigurationBase类代码示例

本文整理汇总了Java中com.intellij.execution.JavaTestConfigurationBase的典型用法代码示例。如果您正苦于以下问题:Java JavaTestConfigurationBase类的具体用法?Java JavaTestConfigurationBase怎么用?Java JavaTestConfigurationBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavaTestConfigurationBase类属于com.intellij.execution包,在下文中一共展示了JavaTestConfigurationBase类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachToProcess

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
public void attachToProcess(@NotNull final RunConfigurationBase configuration, @NotNull final ProcessHandler handler, @Nullable RunnerSettings runnerSettings) {
    super.attachToProcess(configuration, handler, runnerSettings);
    if (!(runnerSettings instanceof DynatraceRunnerSettings)) {
        return;
    }
    if (!(handler instanceof OSProcessHandler)) {
        return;
    }

    DynatraceConfigurableStorage executionSettings = DynatraceConfigurableStorage.getOrCreateStorage(configuration);
    handler.putCopyableUserData(PROFILE_KEY, executionSettings.getSystemProfile());

    OSProcessHandler procHandler = (OSProcessHandler) handler;
    handler.addProcessListener(new DynatraceProcessListener(executionSettings.getSystemProfile(), configuration.getProject()));

    if(!(configuration instanceof JavaTestConfigurationBase)) {
        return;
    }

    Matcher matcher = TRID_EXTRACTOR.matcher(procHandler.getCommandLine());
    if (!matcher.find()) {
        return;
    }
    handler.putCopyableUserData(TRID_KEY, matcher.group(1));
}
 
开发者ID:Dynatrace,项目名称:Dynatrace-AppMon-IntelliJ-IDEA-Integration-Plugin,代码行数:27,代码来源:DynatraceRunConfigurationExtension.java

示例2: processAvailableTraces

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
private static void processAvailableTraces(RunConfigurationBase configuration)
{
	final String tracesDirectory = getTracesDirectory(configuration);
	final TestDiscoveryIndex coverageIndex = TestDiscoveryIndex.getInstance(configuration.getProject());
	synchronized(ourTracesLock)
	{
		final File tracesDirectoryFile = new File(tracesDirectory);
		final File[] testMethodTraces = tracesDirectoryFile.listFiles((dir, name) -> name.endsWith(".tr"));
		if(testMethodTraces != null)
		{
			for(File testMethodTrace : testMethodTraces)
			{
				try
				{
					coverageIndex.updateFromTestTrace(testMethodTrace, ((JavaTestConfigurationBase) configuration).getConfigurationModule().getModuleName(), ((JavaTestConfigurationBase)
							configuration).getFrameworkPrefix());
					FileUtil.delete(testMethodTrace);
				}
				catch(IOException e)
				{
					LOG.error("Can not load " + testMethodTrace, e);
				}
			}

			final String[] filesInTracedDirectories = tracesDirectoryFile.list();
			if(filesInTracedDirectories == null || filesInTracedDirectories.length == 0)
			{
				FileUtil.delete(tracesDirectoryFile);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:33,代码来源:TestDiscoveryExtension.java

示例3: attachToProcess

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
protected void attachToProcess(@NotNull final RunConfigurationBase configuration,
                               @NotNull final ProcessHandler handler,
                               @Nullable RunnerSettings runnerSettings) {
  if (runnerSettings == null && isApplicableFor(configuration)) {
    final Alarm processTracesAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, null);
    final MessageBusConnection connection = configuration.getProject().getMessageBus().connect();
    connection.subscribe(SMTRunnerEventsListener.TEST_STATUS, new SMTRunnerEventsAdapter() {
      private List<String> myCompletedMethodNames = new ArrayList<String>();
      @Override
      public void onTestFinished(@NotNull SMTestProxy test) {
        final SMTestProxy.SMRootTestProxy root = test.getRoot();
        if ((root == null || root.getHandler() == handler)) {
          final String fullTestName = test.getLocationUrl();
          if (fullTestName != null && fullTestName.startsWith(JavaTestLocator.TEST_PROTOCOL)) {
            myCompletedMethodNames.add(((JavaTestConfigurationBase)configuration).getFrameworkPrefix() + fullTestName.substring(JavaTestLocator.TEST_PROTOCOL.length() + 3));
            if (myCompletedMethodNames.size() > 50) {
              final String[] fullTestNames = ArrayUtil.toStringArray(myCompletedMethodNames);
              myCompletedMethodNames.clear();
              processTracesAlarm.addRequest(new Runnable() {
                @Override
                public void run() {
                  processAvailableTraces(configuration, fullTestNames);
                }
              }, 100);
            }
          }
        }
      }

      @Override
      public void onTestingFinished(@NotNull SMTestProxy.SMRootTestProxy testsRoot) {
        if (testsRoot.getHandler() == handler) {
          processTracesAlarm.cancelAllRequests();
          processTracesAlarm.addRequest(new Runnable() {
            @Override
            public void run() {
              processAvailableTraces(configuration);
              Disposer.dispose(processTracesAlarm);
            }
          }, 0);
          connection.disconnect();
        }
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:TestDiscoveryExtension.java

示例4: isApplicableFor

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
protected boolean isApplicableFor(@NotNull final RunConfigurationBase configuration) {
  return configuration instanceof JavaTestConfigurationBase && Registry.is("testDiscovery.enabled");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TestDiscoveryExtension.java

示例5: updateJavaParameters

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
public void updateJavaParameters(RunConfigurationBase configuration, JavaParameters javaParameters, RunnerSettings runnerSettings) throws ExecutionException {
    //Check if the action was ran by DynatraceExecutor
    if (!(runnerSettings instanceof DynatraceRunnerSettings)) {
        return;
    }
    //get global settings
    DynatraceSettingsProvider.State settings = DynatraceSettingsProvider.getInstance().getState();

    try {
        DynatraceClient client = SDKClient.getInstance();
        //get local (runconfiguration) settings
        DynatraceConfigurableStorage executionSettings = DynatraceConfigurableStorage.getOrCreateStorage(configuration);

        SessionStorage ss = configuration.getProject().getComponent(SessionStorage.class);
        if (executionSettings.isRecordSessionPerLaunch() && !ss.isRecording(executionSettings.getSystemProfile())) {
            ss.startRecording(executionSettings.getSystemProfile());
        }

        StringBuilder builder = new StringBuilder("-agentpath:");
        builder.append(settings.getAgent().getAgentLibrary()).append('=');
        builder.append("wait=").append(settings.getServer().getTimeout()).append(',');
        builder.append("name=").append(executionSettings.getAgentName()).append(',');
        builder.append("server=").append(settings.getAgent().getCollectorHost()).append(':');
        builder.append(settings.getAgent().getCollectorPort());

        if (executionSettings.getAdditionalParameters() != null && !executionSettings.getAdditionalParameters().isEmpty()) {
            builder.append(',').append(executionSettings.getAdditionalParameters());
        }

        if(configuration instanceof JavaTestConfigurationBase) {
            Calendar now = Calendar.getInstance();

            //fetch test id
            TestAutomation testAutomation = new TestAutomation(client);
            CreateTestRunRequest request = new CreateTestRunRequest(executionSettings.getSystemProfile(), String.valueOf(new SimpleDateFormat("HH:mm:ss").format(now.getTime())));
            request.setVersionMajor(String.valueOf(now.get(Calendar.YEAR)));
            request.setVersionMinor(String.valueOf(now.get(Calendar.MONTH) + 1));
            request.setVersionRevision(String.valueOf(now.get(Calendar.DAY_OF_WEEK)));

            TestRun testRun = testAutomation.createTestRun(request);

            builder.append(',').append("optionTestRunIdJava=").append(testRun.getId());
            IDEADescriptor.getInstance().log(Level.INFO, "TestRun", "", Messages.getMessage("execution.configuration.tests.running", testRun.getId()), false);
        }

        //mutate java parameters
        javaParameters.getVMParametersList().add(builder.toString());
    } catch (Exception e) {
        //IDEADescriptor.getInstance(configuration.getProject()).log(Level.SEVERE, Messages.getMessage("notifications.error.title"), "", Messages.getMessage("notifications.error.configuration"), true);
        throw new ExecutionException(e);
    }
}
 
开发者ID:Dynatrace,项目名称:Dynatrace-AppMon-IntelliJ-IDEA-Integration-Plugin,代码行数:54,代码来源:DynatraceRunConfigurationExtension.java

示例6: findModule

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
protected Module findModule(JavaTestConfigurationBase configuration, Module contextModule)
{
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:6,代码来源:TestDiscoveryConfigurationProducer.java

示例7: isConfigurationFromContext

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
public boolean isConfigurationFromContext(JavaTestConfigurationBase configuration, ConfigurationContext configurationContext)
{
	final Pair<String, String> position = getPosition(getSourceMethod(configurationContext.getLocation()));
	return position != null && position.equals(getPosition(configuration));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:7,代码来源:TestDiscoveryConfigurationProducer.java

示例8: attachToProcess

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
protected void attachToProcess(@NotNull final RunConfigurationBase configuration, @NotNull final ProcessHandler handler, @Nullable RunnerSettings runnerSettings)
{
	if(runnerSettings == null && isApplicableFor(configuration))
	{
		final String frameworkPrefix = ((JavaTestConfigurationBase) configuration).getFrameworkPrefix();
		final String moduleName = ((JavaTestConfigurationBase) configuration).getConfigurationModule().getModuleName();

		Disposable disposable = Disposer.newDisposable();
		final Alarm processTracesAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, disposable);
		final MessageBusConnection connection = configuration.getProject().getMessageBus().connect();
		connection.subscribe(SMTRunnerEventsListener.TEST_STATUS, new SMTRunnerEventsAdapter()
		{
			private List<String> myCompletedMethodNames = new ArrayList<>();

			@Override
			public void onTestFinished(@NotNull SMTestProxy test)
			{
				final SMTestProxy.SMRootTestProxy root = test.getRoot();
				if((root == null || root.getHandler() == handler))
				{
					final String fullTestName = test.getLocationUrl();
					if(fullTestName != null && fullTestName.startsWith(JavaTestLocator.TEST_PROTOCOL))
					{
						myCompletedMethodNames.add(frameworkPrefix + fullTestName.substring(JavaTestLocator.TEST_PROTOCOL.length() + 3));
						if(myCompletedMethodNames.size() > 50)
						{
							final String[] fullTestNames = ArrayUtil.toStringArray(myCompletedMethodNames);
							myCompletedMethodNames.clear();
							processTracesAlarm.addRequest(() -> processAvailableTraces(fullTestNames, getTracesDirectory(configuration), moduleName, frameworkPrefix, TestDiscoveryIndex
									.getInstance(configuration.getProject())), 100);
						}
					}
				}
			}

			@Override
			public void onTestingFinished(@NotNull SMTestProxy.SMRootTestProxy testsRoot)
			{
				if(testsRoot.getHandler() == handler)
				{
					processTracesAlarm.cancelAllRequests();
					processTracesAlarm.addRequest(() ->
					{
						processAvailableTraces(configuration);
						Disposer.dispose(disposable);
					}, 0);
					connection.disconnect();
				}
			}
		});
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:54,代码来源:TestDiscoveryExtension.java

示例9: isApplicableFor

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
@Override
protected boolean isApplicableFor(@NotNull final RunConfigurationBase configuration)
{
	return configuration instanceof JavaTestConfigurationBase && TESTDISCOVERY_ENABLED;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:6,代码来源:TestDiscoveryExtension.java

示例10: setPosition

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
protected abstract void setPosition(JavaTestConfigurationBase configuration, PsiLocation<PsiMethod> position); 
开发者ID:consulo,项目名称:consulo-java,代码行数:2,代码来源:TestDiscoveryConfigurationProducer.java

示例11: getPosition

import com.intellij.execution.JavaTestConfigurationBase; //导入依赖的package包/类
protected abstract Pair<String, String> getPosition(JavaTestConfigurationBase configuration); 
开发者ID:consulo,项目名称:consulo-java,代码行数:2,代码来源:TestDiscoveryConfigurationProducer.java


注:本文中的com.intellij.execution.JavaTestConfigurationBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。