本文整理汇总了Java中jetbrains.buildServer.messages.serviceMessages.ServiceMessage类的典型用法代码示例。如果您正苦于以下问题:Java ServiceMessage类的具体用法?Java ServiceMessage怎么用?Java ServiceMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceMessage类属于jetbrains.buildServer.messages.serviceMessages包,在下文中一共展示了ServiceMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFailureLines
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
public static String[] testFailureLines(String line) {
try {
ServiceMessage msg = ServiceMessage.parse(line.trim());
if (msg != null) {
Map<String, String> attributes = msg.getAttributes();
if (attributes.containsKey("message") && attributes.containsKey("details")) {
String state = TestErrorState.buildErrorPresentationText(attributes.get("message"), attributes.get("details"));
if (state != null) {
return state.split("\n");
} else {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
} else {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
} else {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
} catch (ParseException e) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
}
示例2: shouldNotGenerateMessageAndShouldNotPublishValuesWhenIsNotStatisticMessage
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的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);
}
示例3: translate
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的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);
}
示例4: processServiceMessage
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的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);
}
}
}
示例5: testFailure
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
public void testFailure(Failure failure) throws Exception {
final String failureMessage = failure.getMessage();
final String trace = failure.getTrace();
final Map attrs = new HashMap();
attrs.put("name", JUnit4ReflectionUtil.getMethodName(failure.getDescription()));
attrs.put("message", failureMessage != null ? failureMessage : "");
final ComparisonFailureData notification = createExceptionNotification(failure.getException());
if (notification != null) {
attrs.put("expected", notification.getExpected());
attrs.put("actual", notification.getActual());
final int failureIdx = trace.indexOf(failureMessage);
attrs.put("details", failureIdx > -1 ? trace.substring(failureIdx + failureMessage.length()) : trace);
} else {
attrs.put("details", trace);
attrs.put("error", "true");
}
System.out.println(ServiceMessage.asString(ServiceMessageTypes.TEST_FAILED, attrs));
}
示例6: prepareIgnoreMessage
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
private static void prepareIgnoreMessage(Description description, boolean commentMessage) {
Map attrs = new HashMap();
if (commentMessage) {
try {
final Ignore ignoredAnnotation = (Ignore)description.getAnnotation(Ignore.class);
if (ignoredAnnotation != null) {
final String val = ignoredAnnotation.value();
if (val != null) {
attrs.put("message", val);
}
}
}
catch (NoSuchMethodError ignored) {
//junit < 4.4
}
}
attrs.put("name", JUnit4ReflectionUtil.getMethodName(description));
System.out.println(ServiceMessage.asString(ServiceMessageTypes.TEST_IGNORED, attrs));
}
示例7: testFailure
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
@Override
public void testFailure(Failure failure) throws Exception {
final String failureMessage = failure.getMessage();
final String trace = failure.getTrace();
final Map attrs = new HashMap();
attrs.put("name", getMethodName(failure.getDescription()));
attrs.put("message", failureMessage != null ? failureMessage : "");
final ComparisonFailureData notification = createExceptionNotification(failure.getException());
if (notification != null) {
attrs.put("expected", notification.getExpected());
attrs.put("actual", notification.getActual());
final int failureIdx = trace.indexOf(failureMessage);
attrs.put("details", failureIdx > -1 ? trace.substring(failureIdx + failureMessage.length()) : trace);
}
else {
attrs.put("details", trace);
attrs.put("error", "true");
}
System.out.println(ServiceMessage.asString(ServiceMessageTypes.TEST_FAILED, attrs));
}
示例8: prepareIgnoreMessage
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
private static void prepareIgnoreMessage(Description description, boolean commentMessage) {
Map attrs = new HashMap();
if (commentMessage) {
try {
final Ignore ignoredAnnotation = (Ignore)description.getAnnotation(Ignore.class);
if (ignoredAnnotation != null) {
final String val = ignoredAnnotation.value();
if (val != null) {
attrs.put("message", val);
}
}
}
catch (NoSuchMethodError ignored) {
//junit < 4.4
}
}
attrs.put("name", getMethodName(description));
System.out.println(ServiceMessage.asString(ServiceMessageTypes.TEST_IGNORED, attrs));
}
示例9: getIntAttribute
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
public static int getIntAttribute(@NotNull ServiceMessage message, @NotNull String key) {
String value = message.getAttributes().get(key);
if (value == null) {
return -1;
}
return Integer.parseInt(value);
}
示例10: shouldSetPermissions
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
@Test(dataProvider = "getSetPermissionsCases")
public void shouldSetPermissions(
@NotNull final Iterable<AccessControlList> accessControlLists,
@NotNull final Iterable<AccessControlList> expectedAccessControlLists,
final int expectedGlobalCacheSize,
final int expectedBuildCacheSize) throws ExecutionException {
// Given
final List<AccessControlList> actualAccessControlLists = new ArrayList<AccessControlList>();
final FileAccessService instance = createInstance();
myCtx.checking(new Expectations() {{
allowing(myLoggerService).onMessage(with(any(ServiceMessage.class)));
allowing(myFileAccessService).setAccess(with(any(AccessControlList.class)));
will(new CustomAction("setAccess") {
@Override
public Object invoke(final Invocation invocation) throws Throwable {
actualAccessControlLists.add((AccessControlList)invocation.getParameter(0));
return Lists.emptyList();
}
});
}});
// When
for (AccessControlList acl: accessControlLists) {
instance.setAccess(acl);
}
// Then
myCtx.assertIsSatisfied();
then(actualAccessControlLists).isEqualTo(expectedAccessControlLists);
then(myGlobalFileAccessCache.size()).isEqualTo(expectedGlobalCacheSize);
then(myBuildFileAccessCache.size()).isEqualTo(expectedBuildCacheSize);
}
示例11: tryParse
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
@Nullable
public static StatisticMessage tryParse(@NotNull final ServiceMessage message) {
if(!MESSAGE_NAME.equalsIgnoreCase(message.getMessageName())) {
return null;
}
return new StatisticMessage(message.getAttributes());
}
示例12: handle
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
@Override
public void handle(@NotNull final ServiceMessage message) {
if (LOG.isDebugEnabled()) {
LOG.debug(message.getMessageName() + " message found: " + message);
}
final ParserCommand command;
try {
command = ParserCommand.fromSM(message);
} catch (IllegalArgumentException e) {
LOG.warn("Cannot create parser command from service message '" + message + "':" + e.getMessage());
return;
}
command.apply(myManipulator);
}
开发者ID:JetBrains,项目名称:teamcity-process-output-parsers,代码行数:15,代码来源:ParserCommandServiceMessageHandler.java
示例13: fromSM
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
public static ParserCommand fromSM(@NotNull final ServiceMessage message) {
final Map<String, String> attributes = message.getAttributes();
final String command = message.getMessageName();
assert command.startsWith(PREFIX);
if (COMMAND_ENABLE.equals(command)) {
return new Enable(message);
} else if (COMMAND_DISABLE.equals(command)) {
return new Disable(message);
} else if (COMMAND_RESET.equals(command)) {
return new Reset(message);
} else {
throw new IllegalArgumentException("Unsupported command type " + command);
}
}
示例14: getParserId
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
@NotNull
protected static ParserId getParserId(@NotNull final ServiceMessage message) {
final Map<String, String> attributes = message.getAttributes();
final String argument = message.getArgument();
final String file = attributes.get("file");
final String name = attributes.get("name");
final String resource = attributes.get("resource");
final String id = attributes.get("id");
if (isEmptyOrSpaces(argument) && isEmptyOrSpaces(file) && isEmptyOrSpaces(name) && isEmptyOrSpaces(resource) && isEmptyOrSpaces(id)) {
throw new IllegalArgumentException("Command requires either attribute 'name', 'file', 'id' or single argument. Actual message: " + message);
}
// TODO: improve
return new ParserId(name, resource, file);
}
示例15: run
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; //导入依赖的package包/类
public void run() {
try {
initializeSuitesAndJarFile();
List<XmlSuite> suites = Lists.newArrayList();
calculateAllSuites(m_suites, suites);
if(suites.size() > 0) {
int testCount= 0;
for (XmlSuite suite : suites) {
final List<XmlTest> tests = suite.getTests();
for (XmlTest test : tests) {
testCount += test.getClasses().size();
}
}
final HashMap<String, String> map = new HashMap<String, String>();
map.put("count", String.valueOf(testCount));
System.out.println(ServiceMessage.asString("testCount", map));
addListener((ISuiteListener) new IDEATestNGRemoteListener());
addListener((ITestListener) new IDEATestNGRemoteListener());
super.run();
}
else {
System.err.println("Nothing found to run");
}
}
catch(Throwable cause) {
cause.printStackTrace(System.err);
}
}