當前位置: 首頁>>代碼示例>>Java>>正文


Java Message類代碼示例

本文整理匯總了Java中jetbrains.buildServer.messages.serviceMessages.Message的典型用法代碼示例。如果您正苦於以下問題:Java Message類的具體用法?Java Message怎麽用?Java Message使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Message類屬於jetbrains.buildServer.messages.serviceMessages包,在下文中一共展示了Message類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldSendSnapshotFileAsArtifactFileWhenHasNoParentDirectory

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Test
public void shouldSendSnapshotFileAsArtifactFileWhenHasNoParentDirectory() throws IOException {
  // Given
  final CommandLineExecutionContext executionContext = new CommandLineExecutionContext(0);
  final File outputFile = new File("output");
  final File snapshotsDir = new File("snapshotsDir");

  myCtx.checking(new Expectations() {{
    oneOf(myRunnerParametersService).tryGetRunnerParameter(Constants.SNAPSHOTS_PATH_VAR);
    will(returnValue(snapshotsDir.getPath()));

    oneOf(myLoggerService).onMessage(with(any(Message.class)));
  }});

  final ResourcePublisher instance = createInstance();

  // When
  instance.publishAfterBuildArtifactFile(executionContext, outputFile);

  // Then
  myCtx.assertIsSatisfied();
}
 
開發者ID:JetBrains,項目名稱:teamcity-dottrace,代碼行數:23,代碼來源:DotTraceSnapshotsPublisherTest.java

示例2: shouldSendAllSnapshotsFileFromDirectoryWhenHasParentDirectory

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Test
public void shouldSendAllSnapshotsFileFromDirectoryWhenHasParentDirectory() throws IOException {
  // Given
  final CommandLineExecutionContext executionContext = new CommandLineExecutionContext(0);
  final File root = new File("root");
  final File outputFile = new File(root, "output");
  final File snapshotsDir = new File("snapshotsDir");

  myCtx.checking(new Expectations() {{
    oneOf(myRunnerParametersService).tryGetRunnerParameter(Constants.SNAPSHOTS_PATH_VAR);
    will(returnValue(snapshotsDir.getPath()));

    oneOf(myFileService).listFiles(root);
    will(returnValue(new File[] { new File("snapshot1"), new File("snapshot2") }));

    exactly(2).of(myLoggerService).onMessage(with(any(Message.class)));
  }});

  final ResourcePublisher instance = createInstance();

  // When
  instance.publishAfterBuildArtifactFile(executionContext, outputFile);

  // Then
  myCtx.assertIsSatisfied();
}
 
開發者ID:JetBrains,項目名稱:teamcity-dottrace,代碼行數:27,代碼來源:DotTraceSnapshotsPublisherTest.java

示例3: shouldNotSendSnapshotFileAsArtifactFilesWhenSnapshotsPathIsNullOrEmpty

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Test(dataProvider = "artefactsPathCases")
public void shouldNotSendSnapshotFileAsArtifactFilesWhenSnapshotsPathIsNullOrEmpty(@Nullable final String artefactsPath) throws IOException {
  // Given
  final CommandLineExecutionContext executionContext = new CommandLineExecutionContext(0);
  final File outputFile = new File("output");

  myCtx.checking(new Expectations() {{
    oneOf(myRunnerParametersService).tryGetRunnerParameter(Constants.SNAPSHOTS_PATH_VAR);
    will(returnValue(artefactsPath));

    never(myLoggerService).onMessage(with(any(Message.class)));
  }});

  final ResourcePublisher instance = createInstance();

  // When
  instance.publishAfterBuildArtifactFile(executionContext, outputFile);

  // Then
  myCtx.assertIsSatisfied();
}
 
開發者ID:JetBrains,項目名稱:teamcity-dottrace,代碼行數:22,代碼來源:DotTraceSnapshotsPublisherTest.java

示例4: shouldShowGrantingPermMessage

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Test
public void shouldShowGrantingPermMessage() throws ExecutionException {
  // Given
  final FileAccessService instance = createInstance();

  myCtx.checking(new Expectations() {{
    oneOf(myLoggerService).onMessage(with(new BaseMatcher<Message>() {
                                            @Override
                                            public boolean matches(final Object o) {
                                              return "NORMAL".equals(((Message)o).getStatus()) && ScopedFileAccessService.MESSAGE_GRANTING_PERMISSIONS.equals(((Message)o).getText());
                                            }

                                            @Override
                                            public void describeTo(final Description description) {
                                            }
                                          }));

    allowing(myFileAccessService).setAccess(with(any(AccessControlList.class)));
    will(returnValue(Lists.emptyList()));
  }});

  // When
  instance.setAccess(new AccessControlList(Arrays.asList(createAce("my_file", AccessControlScope.Build))));

  // Then
  myCtx.assertIsSatisfied();
}
 
開發者ID:JetBrains,項目名稱:teamcity-runas-plugin,代碼行數:28,代碼來源:ScopedFileAccessServiceTest.java

示例5: shouldShowWarningMessage

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Test(dataProvider = "warnCases")
public void shouldShowWarningMessage(
  @NotNull final List<Result<AccessControlEntry, Boolean>> results) throws ExecutionException {
  // Given
  final FileAccessService instance = createInstance();

  myCtx.checking(new Expectations() {{
    one(myLoggerService).onMessage(with(any(Message.class)));

    oneOf(myLoggerService).onMessage(with(new BaseMatcher<Message>() {
      @Override
      public boolean matches(final Object o) {
        return "WARNING".equals(((Message)o).getStatus()) && ScopedFileAccessService.WARNING_PERMISSIONS_ERRORS.equals(((Message)o).getText());
      }

      @Override
      public void describeTo(final Description description) {
      }
    }));

    allowing(myFileAccessService).setAccess(with(any(AccessControlList.class)));
    will(returnValue(results));
  }});

  // When
  instance.setAccess(new AccessControlList(Arrays.asList(createAce("my_file", AccessControlScope.Build))));

  // Then
  myCtx.assertIsSatisfied();
}
 
開發者ID:JetBrains,項目名稱:teamcity-runas-plugin,代碼行數:31,代碼來源:ScopedFileAccessServiceTest.java

示例6: shouldSendWorkspaceFilesAsArtifactFilesWhenPublishAfterBuildArtifactFile

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Test
public void shouldSendWorkspaceFilesAsArtifactFilesWhenPublishAfterBuildArtifactFile() throws IOException {
  // Given
  final CommandLineExecutionContext executionContext = new CommandLineExecutionContext(0);
  final File workspace1File = new File("workspace1");
  final File workspace2File = new File("workspace2");
  final DotMemoryUnitOutput output = new DotMemoryUnitOutput(Arrays.asList(workspace1File, workspace2File));
  final File outputFile = new File("output");
  final File snapshotsDir = new File("snapshotsDir");

  myCtx.checking(new Expectations() {{
    oneOf(myRunnerParametersService).getRunnerParameter(Constants.SNAPSHOTS_PATH_VAR);
    will(returnValue(snapshotsDir.getPath()));

    oneOf(myFileService).readAllTextFile(outputFile);
    will(Expectations.returnValue("output content"));

    oneOf(myOutputParser).parse("output content");
    will(Expectations.returnValue(output));

    oneOf(myAfterBuildPublisher).publishAfterBuildArtifactFile(executionContext, outputFile);

    exactly(2).of(myLoggerService).onMessage(with(any(Message.class)));
  }});

  final ResourcePublisher instance = createInstance();

  // When
  instance.publishAfterBuildArtifactFile(executionContext, outputFile);

  // Then
  myCtx.assertIsSatisfied();
}
 
開發者ID:JetBrains,項目名稱:teamcity-dotmemory,代碼行數:34,代碼來源:DotMemoryUnitPublisherTest.java

示例7: setAccess

import jetbrains.buildServer.messages.serviceMessages.Message; //導入依賴的package包/類
@Override
public Iterable<Result<AccessControlEntry, Boolean>> setAccess(@NotNull final AccessControlList accessControlList) {
  final List<AccessControlEntry> newAcl = new ArrayList<AccessControlEntry>();
  for (AccessControlEntry ace : accessControlList) {
    switch (ace.getScope()) {
      case Global:
        if (!myGlobalFileAccessCache.tryAddEntry(ace)) {
          LOG.info("Skipping setting an access for " + ace + ", because it has being done previously");
          continue;
        }

        break;

      case Build:
        if (!myBuildFileAccessCache.tryAddEntry(ace)) {
          LOG.info("Skipping setting an access for " + ace + ", because it has being done on the previous step");
          continue;
        }

        break;
    }

    newAcl.add(ace);
  }

  if(newAcl.size() == 0) {
    return Collections.emptyList();
  }

  myLoggerService.onMessage(new Message(MESSAGE_GRANTING_PERMISSIONS, "NORMAL", null));
  List<Result<AccessControlEntry, Boolean>> results = new ArrayList<Result<AccessControlEntry, Boolean>>();
  boolean hasError = false;
  for (Result<AccessControlEntry, Boolean> result: myFileAccessService.setAccess(new AccessControlList(newAcl))) {
    results.add(result);
    hasError |= !result.isSuccessful() || (result.getValue() != null && !result.getValue());
  }

  if(hasError) {
    LOG.info(WARNING_PERMISSIONS_ERRORS);
    myLoggerService.onMessage(new Message(WARNING_PERMISSIONS_ERRORS, "WARNING", null));
  }

  return results;
}
 
開發者ID:JetBrains,項目名稱:teamcity-runas-plugin,代碼行數:45,代碼來源:ScopedFileAccessService.java


注:本文中的jetbrains.buildServer.messages.serviceMessages.Message類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。