本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}