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


Java BuildMessage1类代码示例

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


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


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