Package eu.admire.gateway.common.errors

Examples of eu.admire.gateway.common.errors.Errors


                    {
                        while (!remote.getStatus().isDone())
                        {
                            Thread.sleep(1000);
                        }
                        Errors errors = remote.getErrors();
                        // we're not handling compile time errors
                        // because they would have occurred before this method is reached
                        if (errors.getRuntime() != null)
                        {
                            ErrorHelper.getRuntimeInstance(mErrors).getProcessingElement().addAll(
                                    errors.getRuntime().getProcessingElement());
                        }
                        if (errors.getSystem() != null)
                        {
                            mErrors.setSystem(errors.getSystem());
                        }
                        return !remote.getStatus().isError();
                    }
                    finally
                    {
View Full Code Here


   
    @Override
    public void resultsReady(GatewayProcess process)
    {
        LOG.debug("Remote process is initialised.");
        Errors errors = new Errors();
        try
        {
            errors = process.getErrors();
        }
        catch (ClientException e)
        {
            LOG.error("Failed to read errors from gateway process.", e);
        }
       
        if (errors.getCompiletime() == null
                && errors.getRuntime() == null
                && errors.getSystem() == null)
        {
            LOG.debug("Trying results...");
            Map<String, Result> results = process.getResults();
            LOG.debug("Results are ready: " + results);
           
           
            for (Entry<String, Result> entry : results.entrySet())
            {
                LOG.debug("resultName = " + entry.getKey() + "; address = " + entry.getValue().getAddress());
                mResults.put(entry.getKey(), entry.getValue().getAddress());
               
            }
            Map<String, String> transfers = getManagedTransfers(process);
            mManagedTransfers.putAll(transfers);
            mExternalTransfers.putAll(transfers);
            mDone.countDown();
            LOG.debug("Waiting for " + mDone.getCount() + " processor(s)...");
        }
        else
        {
            LOG.debug("An error occurred while waiting for remote process to complete:\n"
                    + ErrorHelper.getAsString(errors));
            if (errors.getCompiletime() != null)
            {
                ErrorHelper.getCompiletimeInstance(mErrors).getError().addAll(
                        errors.getCompiletime().getError());
            }
            if (errors.getRuntime() != null)
            {
                RuntimeErrorType runtime = ErrorHelper.getRuntimeInstance(mErrors);
                runtime.getError().addAll(errors.getRuntime().getError());
                runtime.getProcessingElement().addAll(
                        errors.getRuntime().getProcessingElement());
            }
            if (errors.getSystem() != null)
            {
                mErrors.setSystem(errors.getSystem());
            }
            // TODO stop other processes?
            mFail = true;
            mDone.countDown();
        }
View Full Code Here

                if (obj instanceof NamedProcess) {
                    NamedProcess np = (NamedProcess) obj;

                    if (np.getGatewayProcess().getStatus().isError()) {

                      Errors errs;
            try {
              errs = np.getGatewayProcess().getErrors();
              ErrorWindow.showError(errs);
            } catch (ClientException e) {
              showMessage("Error retrieving errors!\n"
View Full Code Here

            // waiting for results
            // *****************************************************
   
            case 0:
                mGatewayProcess.waitForResults();
                Errors errors = mGatewayProcess.getErrors();
                if (hasErrors(errors))
                {
                    return;
                }
               
View Full Code Here

public class TestErrors {

  @Test
  public void noErrors(){

    Errors mErrors = new ObjectFactory().createErrors();

    String errorString = marshallErrors(mErrors);
    System.out.println(errorString);   
      Errors ret = unmarshallErrors(errorString);
   
    assertEquals("Caught a compile time error", null, ret.getCompiletime());
    assertEquals("Caught a runtime error", null, ret.getRuntime());
    assertEquals("Caught a registration error", null, ret.getRegistration());
    assertEquals("Caught a system error", null, ret.getSystem());
   
  }
View Full Code Here

  }
 
  @Test
  public void system(){

    Errors mErrors = new ObjectFactory().createErrors();
   
    String expected = "system";
    mErrors.setSystem(expected);

    String errorString = marshallErrors(mErrors);
    System.out.println(errorString);   
      Errors ret = unmarshallErrors(errorString);
   
    assertEquals("Caught a compile time error", null, ret.getCompiletime());
    assertEquals("Caught a runtime error", null, ret.getRuntime());
    assertEquals("Caught a registration error", null, ret.getRegistration());
    assertEquals("Incorrect system error", expected, ret.getSystem());

  }
View Full Code Here

  }
 
  @Test
  public void compile(){

    Errors mErrors = new ObjectFactory().createErrors();
    CompiletimeErrorType mCompiletimeErrorType = new ObjectFactory().createCompiletimeErrorType();
    ErrorType mErrorType = new ErrorType();

    String expected = "compile";
   
    mErrorType.setMessage(expected);
    mCompiletimeErrorType.getError().add(mErrorType);   
    mErrors.setCompiletime(mCompiletimeErrorType);

    String errorString = marshallErrors(mErrors);
    System.out.println(errorString);   
      Errors ret = unmarshallErrors(errorString);
   
      assertEquals("Only one error expected", 1, ret.getCompiletime().getError().size());
    assertEquals("Unexpected compile time error", expected, ret.getCompiletime().getError().get(0).getMessage());
    assertEquals("Caught a runtime error", null, ret.getRuntime());
    assertEquals("Caught a registration error", null, ret.getRegistration());
    assertEquals("Caught a system error", null, ret.getSystem());

  }
View Full Code Here

  }
 
  @Test
  public void runtime(){

    Errors mErrors = new ObjectFactory().createErrors();
    RuntimeErrorType mRuntimeErrorType = new ObjectFactory().createRuntimeErrorType();
    ProcessingElementErrorType mProcessingElementErrorType = new ProcessingElementErrorType();

    String expectedType = "run-type";
    String expectedInstance = "run-instance";
   
    mProcessingElementErrorType.setType(expectedType);
    mProcessingElementErrorType.setInstance(expectedInstance);
   
    mRuntimeErrorType.getProcessingElement().add(mProcessingElementErrorType);   
    mErrors.setRuntime(mRuntimeErrorType);

    String errorString = marshallErrors(mErrors);
    System.out.println(errorString);   
      Errors ret = unmarshallErrors(errorString);
   
    assertEquals("Caught a compile time error", null, ret.getCompiletime());
      assertEquals("Only one error expected", 1, ret.getRuntime().getProcessingElement().size());
      assertEquals("Unexpected run time error type", expectedType, ret.getRuntime().getProcessingElement().get(0).getType());
      assertEquals("Unexpected run time error instance", expectedInstance, ret.getRuntime().getProcessingElement().get(0).getInstance());
    assertEquals("Caught a registration error", null, ret.getRegistration());
    assertEquals("Caught a system error", null, ret.getSystem());

  }
View Full Code Here

        return sw.toString();
  }
 
  private Errors unmarshallErrors(String errorString){
   
      Errors mErrors = null;
      try {
      Unmarshaller unmarshaller =
      JAXBContext.newInstance(Errors.class).createUnmarshaller();
      mErrors = (Errors)unmarshaller.unmarshal(new StringReader(errorString));
    } catch (JAXBException e) {
View Full Code Here

          Result result = results.get("results");
          assertNotNull(result);
          String resultStr = Util.getAsString(result);
          assertEquals("Received wrong result", "[Hello World2!]", resultStr);
         
          Errors e = p.getErrors();
          assertNull("Caught a compile time error", e.getCompiletime());
          assertNull("Caught a runtime error", e.getRuntime());
          assertNull("Caught a registration error", e.getRegistration());
          assertNull("Caught a system error", e.getSystem());
   
          assertEquals(ProcessingStatus.COMPLETED, p.getStatus());
         
            // list all processes and check that this one in the list
          List<String> processes = g.getGatewayProcesses();
View Full Code Here

TOP

Related Classes of eu.admire.gateway.common.errors.Errors

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.