mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/asset/TestAssetImpl.java
@Test
    public void testDeactivateAssetFail() throws Exception
    {
        // activate asset so it can be deactivated
        EventAdminSyncer actSyncer = new EventAdminSyncer(m_EventAdmin, Asset.TOPIC_ACTIVATION_COMPLETE);
        m_SUT.activateAsync();
        actSyncer.waitFor(5, TimeUnit.SECONDS);

        doThrow(new AssetException("failed")).when(m_Proxy).onDeactivate();

        EventAdminSyncer failedActivationSync = new EventAdminSyncer(m_EventAdmin, Asset.TOPIC_DEACTIVATION_FAILED);

        m_SUT.deactivateAsync();

        failedActivationSync.waitFor(5, TimeUnit.SECONDS);
        // make sure properties are set as well
        EventAdminVerifier.assertEventByTopicAsset(m_EventAdmin, Asset.TOPIC_DEACTIVATION_FAILED, m_SUT);

        assertThat(m_SUT.getActiveStatus(), is(AssetActiveStatus.ACTIVATED));
    }
/**
     * Verify exception handled from proxy when activating. Verify event if deactivation fails.
     */
Verify exception handled from proxy when activating. Verify event if deactivation fails.
Verify exception handled from proxy when activating . Verify event if deactivation fails .
@Test
    public void testDeactivateAssetFail() throws Exception
    {
        EventAdminSyncer actSyncer = new EventAdminSyncer(m_EventAdmin, Asset.TOPIC_ACTIVATION_COMPLETE);
        m_SUT.activateAsync();
        actSyncer.waitFor(5, TimeUnit.SECONDS);
        doThrow(new AssetException("failed")).when(m_Proxy).onDeactivate();
        EventAdminSyncer failedActivationSync = new EventAdminSyncer(m_EventAdmin, Asset.TOPIC_DEACTIVATION_FAILED);
        m_SUT.deactivateAsync();
        failedActivationSync.waitFor(5, TimeUnit.SECONDS);
        EventAdminVerifier.assertEventByTopicAsset(m_EventAdmin, Asset.TOPIC_DEACTIVATION_FAILED, m_SUT);
        assertThat(m_SUT.getActiveStatus(), is(AssetActiveStatus.ACTIVATED));
    }
@ Test public void testDeactivateAssetFail ( ) throws Exception { EventAdminSyncer actSyncer = new EventAdminSyncer ( m_EventAdmin , Asset . TOPIC_ACTIVATION_COMPLETE ) ; m_SUT . activateAsync ( ) ; actSyncer . waitFor ( 5 , TimeUnit . SECONDS ) ; doThrow ( new AssetException ( "failed" ) ) . when ( m_Proxy ) . onDeactivate ( ) ; EventAdminSyncer failedActivationSync = new EventAdminSyncer ( m_EventAdmin , Asset . TOPIC_DEACTIVATION_FAILED ) ; m_SUT . deactivateAsync ( ) ; failedActivationSync . waitFor ( 5 , TimeUnit . SECONDS ) ; EventAdminVerifier . assertEventByTopicAsset ( m_EventAdmin , Asset . TOPIC_DEACTIVATION_FAILED , m_SUT ) ; assertThat ( m_SUT . getActiveStatus ( ) , is ( AssetActiveStatus . ACTIVATED ) ) ; }
Verify exception handled from proxy when activating.
Verify exception handled from proxy when activating .
// activate asset so it can be deactivated // make sure properties are set as well