Package info.growl

Examples of info.growl.Growl


  private static final String TEST_OK = QUICK_J_UNIT + "Test OK";
  private static final String TEST_FAILURE = QUICK_J_UNIT + "Test FAILURE";
  private static final String TEST_ERROR = QUICK_J_UNIT + "Test ERROR";

  public TestListenerForGrowl() {
    final Growl growl = GrowlUtils.getGrowlInstance(QUICK_J_UNIT);
    growl.addNotification(TEST_OK, true);
    growl.addNotification(TEST_FAILURE, true);
    growl.addNotification(TEST_ERROR, true);
    try {
      growl.register();
    } catch (GrowlException e) {
    }

    JUnitCore.addTestRunListener(new org.eclipse.jdt.junit.TestRunListener() {
      private TemplateParser parser = new TemplateParser();
      @Override
      public void sessionFinished(ITestRunSession session) {
        String template = Preference.TEMPLATE.getValue();
        parser.setTemplate(template);
        RenderedImage icon;
        Result testResult = session.getTestResult(true);
        InputStream input;
        String notification;
        if(Result.ERROR.equals(testResult)){
          notification = TEST_ERROR;
          input = getClass().getResourceAsStream("/icons/tsuiteerror.gif");
        }else if(Result.FAILURE.equals(testResult)){
          notification = TEST_FAILURE;
          input = getClass().getResourceAsStream("/icons/tsuitefail.gif");
        }else{
          notification = TEST_OK;
          input = getClass().getResourceAsStream("/icons/tsuiteok.gif");         
        }
        String parseTemplate = parser.parseTemplate(session);
        try {
          icon = ImageIO.read(input);
          growl.sendNotification(notification, testResult.toString(), parseTemplate, icon);
        } catch (IOException e) {
          e.printStackTrace();
        } catch (GrowlException e) {
          e.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of info.growl.Growl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.