Search in sources :

Example 6 with AcsJCompletion

use of alma.acs.exceptions.AcsJCompletion in project ACS by ACS-Community.

the class ErrorComponentImpl method completionFromCompletion.

/**
	 * 
	 * @see alma.acsexmplErrorComponent.ErrorComponentOperations#completionFromCompletion(short)
	 */
@Override
public Completion completionFromCompletion(short depth) {
    AcsJCompletion completion = null;
    if (depth <= 1) {
        completion = internalCompletionMethod(depth);
        return completion.toCorbaCompletion();
    } else {
        completion = internalCompletionMethod(depth - 1);
        // here we show how to wrap the error from a given completion with a new completion
        AcsJCompletion newCompletion = new GenericErrorAcsJCompletion(completion);
        return newCompletion.toCorbaCompletion();
    }
}
Also used : GenericErrorAcsJCompletion(alma.ACSErrTypeCommon.wrappers.GenericErrorAcsJCompletion) AcsJCompletion(alma.acs.exceptions.AcsJCompletion) ACSErrOKAcsJCompletion(alma.ACSErrTypeOK.wrappers.ACSErrOKAcsJCompletion) GenericErrorAcsJCompletion(alma.ACSErrTypeCommon.wrappers.GenericErrorAcsJCompletion)

Example 7 with AcsJCompletion

use of alma.acs.exceptions.AcsJCompletion in project ACS by ACS-Community.

the class ErrorComponentTest method testCompletionFromException.

public void testCompletionFromException() {
    // depth == 0
    AcsJCompletion comp = null;
    try {
        // call the component method
        comp = AcsJCompletion.fromCorbaCompletion(errorComp.completionFromException((short) 0));
    } catch (Throwable th) {
        m_logger.info("Caught an unexpected Exception");
        AcsJUnknownEx ex = new AcsJUnknownEx(th);
        ex.log(m_logger);
        fail("No exception should be thrown");
    }
    verifyErrorTrace(1, new AcsJGenericErrorEx(comp.getAcsJException()));
    // depth > 0
    short[] depths = new short[] { 1, 2, 3, 5, 13 };
    for (int i = 0; i < depths.length; i++) {
        try {
            // call the component method
            comp = AcsJCompletion.fromCorbaCompletion(errorComp.completionFromException((depths[i])));
        } catch (Throwable th) {
            m_logger.info("Caught an unexpected Exception at depth " + depths[i]);
            AcsJUnknownEx ex = new AcsJUnknownEx(th);
            ex.log(m_logger);
            fail("No exception should be thrown");
        }
        verifyErrorTrace(depths[i] + 1, new AcsJGenericErrorEx(comp.getAcsJException()));
    }
}
Also used : AcsJCompletion(alma.acs.exceptions.AcsJCompletion) AcsJGenericErrorEx(alma.ACSErrTypeCommon.wrappers.AcsJGenericErrorEx) AcsJUnknownEx(alma.ACSErrTypeCommon.wrappers.AcsJUnknownEx)

Example 8 with AcsJCompletion

use of alma.acs.exceptions.AcsJCompletion in project ACS by ACS-Community.

the class MasterComponentTest method verifyCurrentState.

/**
	 * Helper method for the repeated task of getting the current state hierarchy and 
	 * comparing it against the expected hierarchy.
	 * <p>
	 * This method is a replica of {@link StateChangeListener#verifyCurrentState(String[])} 
	 * which is necessary for testing w/o using the synchronization facilities offered by <code>StateChangeListener</code>.
	 */
private void verifyCurrentState(ROstringSeq statesProperty, String[] expectedHierarchy) {
    CompletionHolder ch = new CompletionHolder();
    String[] states = statesProperty.get_sync(ch);
    AcsJCompletion statesSyncCompletion = AcsJCompletion.fromCorbaCompletion(ch.value);
    assertFalse(statesSyncCompletion.isError());
    assertEquals(ACSErrTypeOK.value, statesSyncCompletion.getType());
    assertEquals(ACSErrOK.value, statesSyncCompletion.getCode());
    assertNotNull(states);
    // verify state
    String expectedPath = AcsStateUtil.stateHierarchyNamesToString(expectedHierarchy);
    String actualPath = AcsStateUtil.stateHierarchyNamesToString(states);
    assertEquals("current states hierarchy was not as expected!", expectedPath, actualPath);
}
Also used : AcsJCompletion(alma.acs.exceptions.AcsJCompletion) CompletionHolder(alma.ACSErr.CompletionHolder)

Aggregations

AcsJCompletion (alma.acs.exceptions.AcsJCompletion)8 CompletionHolder (alma.ACSErr.CompletionHolder)3 AcsJGenericErrorEx (alma.ACSErrTypeCommon.wrappers.AcsJGenericErrorEx)2 AcsJUnknownEx (alma.ACSErrTypeCommon.wrappers.AcsJUnknownEx)2 Completion (alma.ACSErr.Completion)1 AcsJIllegalStateEventEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalStateEventEx)1 GenericErrorAcsJCompletion (alma.ACSErrTypeCommon.wrappers.GenericErrorAcsJCompletion)1 ACSErrOKAcsJCompletion (alma.ACSErrTypeOK.wrappers.ACSErrOKAcsJCompletion)1 OrbInitException (alma.acs.commandcenter.meta.Firestarter.OrbInitException)1 PreparedString (alma.acs.commandcenter.util.PreparedString)1 AcsCorba (alma.acs.container.corba.AcsCorba)1 AcsJException (alma.acs.exceptions.AcsJException)1 AcsState (alma.acs.genfw.runtime.sm.AcsState)1 DaemonSequenceCallback (alma.acsdaemon.DaemonSequenceCallback)1 DaemonSequenceCallbackPOA (alma.acsdaemon.DaemonSequenceCallbackPOA)1 ServicesDaemon (alma.acsdaemon.ServicesDaemon)1 IOException (java.io.IOException)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 TimeUnit (java.util.concurrent.TimeUnit)1