• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BuildMessage1类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: commonExpectations

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
private void commonExpectations() {
  myContext.checking(new Expectations() {{
    try {
      allowing(mySessionProvider).getSession();
      will(returnValue(mySession));

      allowing(mySession).getHost();
      allowing(mySession).openChannel("exec");
      will(returnValue(myChannel));
      allowing(mySession).disconnect();

      allowing(myChannel).setCommand(DEFAULT_COMMAND);
      allowing(myChannel).connect();
      allowing(myChannel).isClosed();
      will(returnValue(true));
      allowing(myChannel).disconnect();
      allowing(myChannel).getExitStatus();
      allowing(myLogger).logMessage(with(any(BuildMessage1.class)));
    } catch (JSchException e) {
      Assert.fail("Unexpected exception in jmock expectations list.", e);
    }
  }});

}
 
开发者ID:JetBrains,项目名称:teamcity-deployer-plugin,代码行数:25,代码来源:SSHExecProcessAdapterTest.java


示例2: translateMessages

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@NotNull
public List<BuildMessage1> translateMessages(@NotNull final SRunningBuild build,
                                             @NotNull final List<BuildMessage1> messages
) {
  final UserDataStorage storage = ((RunningBuildEx) build).getUserDataStorage();
  Set<String> storedPasswords = storage.getValue(myUtil.passwordsKEY);

  List<BuildMessage1> result = new ArrayList<BuildMessage1>();
  for (BuildMessage1 originalMessage : messages) {
    final Object data = originalMessage.getValue();
    if (!DefaultMessagesInfo.MSG_TEXT.equals(originalMessage.getTypeId()) || data == null || !(data instanceof String)) {
      result.add(originalMessage);
      continue;
    }
    String text = (String) data;

    if (storedPasswords != null) {
      for (String value : storedPasswords) {
        if (!value.equals(""))
          text = text.replaceAll(value, "******");
      }
    }
    result.add(DefaultMessagesInfo.createTextMessage(originalMessage, text));
  }
  return result;
}
 
开发者ID:IIIEII,项目名称:ServerConfigurations,代码行数:27,代码来源:BuildLogFilter.java


示例3: setUp

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@BeforeMethod
public void setUp()
{
  myCtx = new Mockery();

  myServerExtensionHolder = myCtx.mock(ServerExtensionHolder.class);
  myBuildDataStorage = myCtx.mock(BuildDataStorage.class);
  myMetricComparer = myCtx.mock(MetricComparer.class);
  myStatisticKeyFactory = myCtx.mock(StatisticKeyFactory.class);
  myStatisticProvider = myCtx.mock(StatisticProvider.class);
  myHistory = myCtx.mock(History.class);
  myRunningBuild = myCtx.mock(SRunningBuild.class);
  myBuildType = myCtx.mock(SBuildType.class);

  buildMessage1 = new BuildMessage1("sourceId", "typeId", Status.NORMAL, new Date(1234567), "value", Arrays.asList("a", "b"));
  myBuild1 = myCtx.mock(SFinishedBuild.class, "Build1");
  myBuild2 = myCtx.mock(SFinishedBuild.class, "Build2");

  myHistoryElement1 = myCtx.mock(HistoryElement.class, "HistoryElement1");
  myHistoryElement2 = myCtx.mock(HistoryElement.class, "HistoryElement2");
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:22,代码来源:DotTraceStatisticTranslatorTest.java


示例4: shouldNotGenerateMessageAndShouldNotPublishValuesWhenBuildTypeIsNull

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotGenerateMessageAndShouldNotPublishValuesWhenBuildTypeIsNull() {
  // Given
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()),
                                                     with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(null));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(1);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:22,代码来源:DotTraceStatisticTranslatorTest.java


示例5: shouldNotGenerateMessageAndShouldNotPublishValuesWhenIsNotStatisticMessage

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotGenerateMessageAndShouldNotPublishValuesWhenIsNotStatisticMessage() {
  // Given
  final ServiceMessage message = new MyMessage();

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, message);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(1);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:18,代码来源:DotTraceStatisticTranslatorTest.java


示例6: translate

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@NotNull
@Override
public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1,
                                     @NotNull ServiceMessage serviceMessage)
{
    final Map<String, String> messageAttributes = serviceMessage.getAttributes();
    if (messageAttributes.isEmpty())
    {
        LOG.warning("Could not translate service message with empty attributes.");
        return Arrays.asList(buildMessage1);
    }

    dataStoreServices.get(activeDataStoreName)
            .saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"),
                                                       Arrays.asList(messageAttributes.get("text")),
                                                       valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info),
                                                       valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded),
                                                       valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none)));

    return Arrays.asList(buildMessage1);
}
 
开发者ID:jpfeffer,项目名称:teamcity-highlighter,代码行数:22,代码来源:HighlightServiceMessageTranslator.java


示例7: doProcessText

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Override
public Result doProcessText(@NotNull final String text, @NotNull final BuildLogTail tail) {
  final List<BuildMessage1> messages;
  final boolean consumed;
  synchronized (this) {
    consumed = myParser.processLine(text, myManager);
    messages = myLogger.getUnprocessedMessagesAndReset();
  }
  if (!consumed) {
    if (!messages.isEmpty()) {
      LOG.warn("Parser '" + myParser.getId() + "'not consumed message but there some pending messages produced: " + messages);
    }
    return Result.SKIP;
  }
  if (messages.isEmpty()) {
    return Result.EAT;
  }
  if (messages.size() == 1) {
    final BuildMessage1 msg = messages.iterator().next();
    if (msg.getValue() instanceof String && text.equals(msg.getValue())) {
      return Result.KEEP_ORIGIN;
    }
  }
  return Result.REPLACE(messages);
}
 
开发者ID:JetBrains,项目名称:teamcity-process-output-parsers,代码行数:26,代码来源:RegexParserToSimpleMessagesTranslatorAdapter.java


示例8: processMessage

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
protected void processMessage(AgentRunningBuild build, String message, BuildMessage1 buildMessage) {
    if (mySonarIsWorking) {
        final int start = message.indexOf(ANALYSIS_SUCCESSFUL);
        if (start >= 0) {
            final String url = message.substring(start + ANALYSIS_SUCCESSFUL.length());
            // TODO: save URL to a parameter instead to be able to specify URL strictly in configuration
            FileWriter fw = null;
            try {
                final File output = new File(build.getBuildTempDirectory(), Constants.SONAR_SERVER_URL_FILENAME);
                fw = new FileWriter(output);
                fw.write(url);
                myWatcher.addNewArtifactsPath(output.getAbsolutePath() + "=>" + Constants.SONAR_SERVER_URL_ARTIF_LOCATION);
            } catch (IOException e) {
                build.getBuildLogger().message("Cannot save Sonar URL \"" + url + "\" to file \"" + "\": " + e.getMessage());
            } finally {
                Util.close(fw);
            }
        }
    } else {
        ServiceMessagesProcessor.processTextMessage(buildMessage, myMessageProcessor);
    }
}
 
开发者ID:JetBrains,项目名称:TeamCity.SonarQubePlugin,代码行数:23,代码来源:SonarProcessListener.java


示例9: processServiceMessage

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
public void processServiceMessage(@NotNull ServiceMessage serviceMessage, @NotNull BuildMessage1 buildMessage1) {
    if ("importData".equals(serviceMessage.getMessageName())) {
        String path = serviceMessage.getAttributes().get("path");
        if (path == null) {
            path = serviceMessage.getAttributes().get("file");
        }
        if (path != null) {
            final String dir;
            final File file = new File(path);
            if (file.exists() && file.isDirectory()) {
                dir = path;
            } else {
                final int endIndex = path.lastIndexOf(File.separatorChar);
                dir = endIndex >= 0 ? path.substring(0, endIndex) : path;
            }
            myCollectedReports.add(dir);
        }
    }
}
 
开发者ID:JetBrains,项目名称:TeamCity.SonarQubePlugin,代码行数:20,代码来源:SonarProcessListener.java


示例10: log

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Override
public void log(int level, String message) {
  BuildMessage1 buildMessage = createTextMessage(message);
  if (level < WARN) {
    buildMessage = internalize(buildMessage);
  }
  myBuildLogger.logMessage(buildMessage);
}
 
开发者ID:JetBrains,项目名称:teamcity-deployer-plugin,代码行数:9,代码来源:JSchBuildLogger.java


示例11: shouldNotGenerateMessageAndShouldNotPublishValuesWhenStatistic

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotGenerateMessageAndShouldNotPublishValuesWhenStatistic() {
  // Given
  final List<SFinishedBuild> builds = Arrays.asList(myBuild1, myBuild2);
  final List<HistoryElement> historyElements = Arrays.asList(myHistoryElement1, myHistoryElement2);
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(myBuildType));

    oneOf(myBuildType).getHistory();
    will(returnValue(builds));

    oneOf(myHistory).getElements(builds);
    will(returnValue(historyElements));

    oneOf(myStatisticProvider).tryCreateStatistic(statisticMessage, historyElements);
    will(returnValue(null));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(1);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:32,代码来源:DotTraceStatisticTranslatorTest.java


示例12: testTranslate

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void testTranslate() throws Exception
{
    when(serviceMessage.getAttributes()).thenReturn(TEST_MAP);
    final List<BuildMessage1> ret = highlightServiceMessageTranslator.translate(sRunningBuild, buildMessage1, serviceMessage);

    assertThat(Arrays.asList(buildMessage1).equals(ret), is(true));
    verify(dataStoreService).saveData(eq(sRunningBuild), any(HighlightData.class));
}
 
开发者ID:jpfeffer,项目名称:teamcity-highlighter,代码行数:10,代码来源:HighlightServiceMessageTranslatorTest.java


示例13: testTranslate_empty_msg_attributes

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void testTranslate_empty_msg_attributes() throws Exception
{
    when(serviceMessage.getAttributes()).thenReturn(new HashMap<String, String>(0));
    final List<BuildMessage1> ret = highlightServiceMessageTranslator.translate(sRunningBuild, buildMessage1, serviceMessage);

    assertThat(Arrays.asList(buildMessage1).equals(ret), is(true));
    verify(dataStoreService, never()).saveData(eq(sRunningBuild), any(HighlightData.class));
}
 
开发者ID:jpfeffer,项目名称:teamcity-highlighter,代码行数:10,代码来源:HighlightServiceMessageTranslatorTest.java


示例14: messageLogged

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Override
public void messageLogged(@NotNull final BuildMessage1 buildMessage) {
    if (mySonarIsWorking && buildMessage.getValue() instanceof String) {
        final String message = (String) buildMessage.getValue();
        final int idx = message.indexOf(BUILD_BREAKER_MESSAGE);
        if (idx > 0) {
            final String cause = message.substring(idx + BUILD_BREAKER_MESSAGE.length(), message.length());
            myBuildProblems.add(cause);
        }
    }
}
 
开发者ID:JetBrains,项目名称:TeamCity.SonarQubePlugin,代码行数:12,代码来源:BuildBreakerProblemListener.java


示例15: logMessage

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Override
public void logMessage(final BuildMessage1 arg0) {
}
 
开发者ID:blackducksoftware,项目名称:hub-teamcity,代码行数:4,代码来源:TestBuildProgressLogger.java


示例16: shouldTranslate

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldTranslate() {
  // Given
  final List<SFinishedBuild> builds = Arrays.asList(myBuild1, myBuild2);
  final List<HistoryElement> historyElements = Arrays.asList(myHistoryElement1, myHistoryElement2);
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");
  final Statistic statistic = new Statistic(new BigDecimal(1), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)), new BigDecimal(5), new BigDecimal(6));

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(myBuildType));

    oneOf(myBuildType).getHistory();
    will(returnValue(builds));

    oneOf(myHistory).getElements(builds);
    will(returnValue(historyElements));

    oneOf(myStatisticProvider).tryCreateStatistic(statisticMessage, historyElements);
    will(returnValue(statistic));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(5), new BigDecimal(1), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)));
    will(returnValue(false));

    oneOf(myMetricComparer).tryGetThresholdValue(new BigDecimal(5), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)));
    will(returnValue(new BigDecimal(10)));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(6), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)));
    will(returnValue(false));

    oneOf(myMetricComparer).tryGetThresholdValue(new BigDecimal(6), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)));
    will(returnValue(new BigDecimal(10)));

    oneOf(myStatisticKeyFactory).createTotalTimeKey("method1");
    will(returnValue("TotalTimeKey"));

    oneOf(myStatisticKeyFactory).createOwnTimeKey("method1");
    will(returnValue("OwnTimeKey"));

    oneOf(myRunningBuild).getBuildId();
    will(returnValue(33L));

    oneOf(myBuildDataStorage).publishValue("TotalTimeKey", 33L, new BigDecimal(1));
    oneOf(myBuildDataStorage).publishValue("OwnTimeKey", 33L, new BigDecimal(2));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(3);
  then(messages.get(0)).isEqualTo(buildMessage1);

  final BuildMessage1 message1 = messages.get(1);
  then(message1.getSourceId()).isEqualTo(buildMessage1.getSourceId());
  then(message1.getTypeId()).isEqualTo(buildMessage1.getTypeId());
  then(message1.getStatus()).isEqualTo(Status.FAILURE);
  then(message1.getTimestamp()).isEqualTo(buildMessage1.getTimestamp());
  then(message1.getValue()).isNotNull();
  then(message1.getValue()).isInstanceOf(String.class);

  final BuildMessage1 message2 = messages.get(2);
  then(message2.getSourceId()).isEqualTo(buildMessage1.getSourceId());
  then(message2.getTypeId()).isEqualTo(buildMessage1.getTypeId());
  then(message2.getStatus()).isEqualTo(Status.FAILURE);
  then(message2.getTimestamp()).isEqualTo(buildMessage1.getTimestamp());
  then(message2.getValue()).isNotNull();
  then(message2.getValue()).isInstanceOf(String.class);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:74,代码来源:DotTraceStatisticTranslatorTest.java


示例17: shouldNotSendBuildProblemsWhenPrevValuesAreNull

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotSendBuildProblemsWhenPrevValuesAreNull() {
  // Given
  final List<SFinishedBuild> builds = Arrays.asList(myBuild1, myBuild2);
  final List<HistoryElement> historyElements = Arrays.asList(myHistoryElement1, myHistoryElement2);
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");
  final Statistic statistic = new Statistic(new BigDecimal(1), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)), null, null);

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(myBuildType));

    oneOf(myBuildType).getHistory();
    will(returnValue(builds));

    oneOf(myHistory).getElements(builds);
    will(returnValue(historyElements));

    oneOf(myStatisticProvider).tryCreateStatistic(statisticMessage, historyElements);
    will(returnValue(statistic));

    oneOf(myStatisticKeyFactory).createTotalTimeKey("method1");
    will(returnValue("TotalTimeKey"));

    oneOf(myStatisticKeyFactory).createOwnTimeKey("method1");
    will(returnValue("OwnTimeKey"));

    oneOf(myRunningBuild).getBuildId();
    will(returnValue(33L));

    oneOf(myBuildDataStorage).publishValue("TotalTimeKey", 33L, new BigDecimal(1));
    oneOf(myBuildDataStorage).publishValue("OwnTimeKey", 33L, new BigDecimal(2));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(1);
  then(messages.get(0)).isEqualTo(buildMessage1);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:46,代码来源:DotTraceStatisticTranslatorTest.java


示例18: shouldNotGenerateMessageWhenTotalTimeWithinThresholds

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotGenerateMessageWhenTotalTimeWithinThresholds() {
  // Given
  final List<SFinishedBuild> builds = Arrays.asList(myBuild1, myBuild2);
  final List<HistoryElement> historyElements = Arrays.asList(myHistoryElement1, myHistoryElement2);
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");
  final Statistic statistic = new Statistic(new BigDecimal(1), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)), new BigDecimal(5), new BigDecimal(6));

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(myBuildType));

    oneOf(myBuildType).getHistory();
    will(returnValue(builds));

    oneOf(myHistory).getElements(builds);
    will(returnValue(historyElements));

    oneOf(myStatisticProvider).tryCreateStatistic(statisticMessage, historyElements);
    will(returnValue(statistic));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(5), new BigDecimal(1), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)));
    will(returnValue(false));

    oneOf(myMetricComparer).tryGetThresholdValue(new BigDecimal(5), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)));
    will(returnValue(new BigDecimal(10)));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(6), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)));
    will(returnValue(true));

    oneOf(myStatisticKeyFactory).createTotalTimeKey("method1");
    will(returnValue("TotalTimeKey"));

    oneOf(myStatisticKeyFactory).createOwnTimeKey("method1");
    will(returnValue("OwnTimeKey"));

    oneOf(myRunningBuild).getBuildId();
    will(returnValue(33L));

    oneOf(myBuildDataStorage).publishValue("TotalTimeKey", 33L, new BigDecimal(1));
    oneOf(myBuildDataStorage).publishValue("OwnTimeKey", 33L, new BigDecimal(2));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(2);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:54,代码来源:DotTraceStatisticTranslatorTest.java


示例19: shouldNotGenerateMessageWhenOwnTimeWithinThresholds

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotGenerateMessageWhenOwnTimeWithinThresholds() {
  // Given
  final List<SFinishedBuild> builds = Arrays.asList(myBuild1, myBuild2);
  final List<HistoryElement> historyElements = Arrays.asList(myHistoryElement1, myHistoryElement2);
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");
  final Statistic statistic = new Statistic(new BigDecimal(1), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)), new BigDecimal(5), new BigDecimal(6));

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(myBuildType));

    oneOf(myBuildType).getHistory();
    will(returnValue(builds));

    oneOf(myHistory).getElements(builds);
    will(returnValue(historyElements));

    oneOf(myStatisticProvider).tryCreateStatistic(statisticMessage, historyElements);
    will(returnValue(statistic));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(5), new BigDecimal(1), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)));
    will(returnValue(true));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(6), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)));
    will(returnValue(false));

    oneOf(myMetricComparer).tryGetThresholdValue(new BigDecimal(6), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)));
    will(returnValue(new BigDecimal(10)));

    oneOf(myStatisticKeyFactory).createTotalTimeKey("method1");
    will(returnValue("TotalTimeKey"));

    oneOf(myStatisticKeyFactory).createOwnTimeKey("method1");
    will(returnValue("OwnTimeKey"));

    oneOf(myRunningBuild).getBuildId();
    will(returnValue(33L));

    oneOf(myBuildDataStorage).publishValue("TotalTimeKey", 33L, new BigDecimal(1));
    oneOf(myBuildDataStorage).publishValue("OwnTimeKey", 33L, new BigDecimal(2));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(2);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:54,代码来源:DotTraceStatisticTranslatorTest.java


示例20: shouldNotGenerateMessageWhenValuesWithinThresholds

import jetbrains.buildServer.messages.BuildMessage1; //导入依赖的package包/类
@Test
public void shouldNotGenerateMessageWhenValuesWithinThresholds() {
  // Given
  final List<SFinishedBuild> builds = Arrays.asList(myBuild1, myBuild2);
  final List<HistoryElement> historyElements = Arrays.asList(myHistoryElement1, myHistoryElement2);
  final StatisticMessage statisticMessage = new StatisticMessage("method1", "L10", "F20", "12", "34");
  final Statistic statistic = new Statistic(new BigDecimal(1), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)), new BigDecimal(5), new BigDecimal(6));

  myCtx.checking(new Expectations() {{
    oneOf(myServerExtensionHolder).registerExtension(with(ServiceMessageTranslator.class), with(DotTraceStatisticTranslator.class.getName()), with(any(ServiceMessageTranslator.class)));

    oneOf(myRunningBuild).getBuildType();
    will(returnValue(myBuildType));

    oneOf(myBuildType).getHistory();
    will(returnValue(builds));

    oneOf(myHistory).getElements(builds);
    will(returnValue(historyElements));

    oneOf(myStatisticProvider).tryCreateStatistic(statisticMessage, historyElements);
    will(returnValue(statistic));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(5), new BigDecimal(1), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(3)));
    will(returnValue(true));

    oneOf(myMetricComparer).isMeasuredValueWithinThresholds(new BigDecimal(6), new BigDecimal(2), new ThresholdValue(ThresholdValueType.LAST, new BigDecimal(4)));
    will(returnValue(true));

    oneOf(myStatisticKeyFactory).createTotalTimeKey("method1");
    will(returnValue("TotalTimeKey"));

    oneOf(myStatisticKeyFactory).createOwnTimeKey("method1");
    will(returnValue("OwnTimeKey"));

    oneOf(myRunningBuild).getBuildId();
    will(returnValue(33L));

    oneOf(myBuildDataStorage).publishValue("TotalTimeKey", 33L, new BigDecimal(1));
    oneOf(myBuildDataStorage).publishValue("OwnTimeKey", 33L, new BigDecimal(2));
  }});

  // When
  final ServiceMessageTranslator instance = createInstance();
  final List<BuildMessage1> messages = instance.translate(myRunningBuild, buildMessage1, statisticMessage);

  // Then
  myCtx.assertIsSatisfied();
  then(messages.size()).isEqualTo(1);
}
 
开发者ID:JetBrains,项目名称:teamcity-dottrace,代码行数:51,代码来源:DotTraceStatisticTranslatorTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java C类代码示例发布时间:2022-05-22
下一篇:
Java JspIdConsumer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap