mil.dod.th.ose.core/test/mil/dod/th/ose/core/factory/api/TestFactoryRegistry.java
@Test
    public void testDelete() throws Exception
    {
        UUID testUuid = UUID.randomUUID();
        FactoryObjectProxy testObjProxy = mock(FactoryObjectProxy.class);
        Configuration config = m_ConfigAdmin.createFactoryConfiguration(FACTORY_PID, null);
        String pid = config.getPid();

        ComponentInstance instance = mockComponentInstance(UUID.randomUUID(), "name", pid);
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance);

        when(m_FactoryDescriptor.create()).thenReturn(testObjProxy);

        when(m_FactoryObjectDataManager.getPid(Mockito.any(UUID.class))).thenReturn(pid);
        when(m_ConfigAdmin.getConfiguration(anyString(), anyString())).thenReturn(config);

        // replay
        m_SUT.createOrRestoreObject(m_FactoryDescriptor, testUuid);

        FactoryObjectInternal internal = (FactoryObjectInternal)instance.getInstance();
        m_SUT.delete(internal);

        verify(m_Callback).onRemovedObject(internal);
        verify(config).delete();
    }
/**
     * Verify that an object is properly deleted.
     */
Verify that an object is properly deleted.
Verify that an object is properly deleted .
@Test
    public void testDelete() throws Exception
    {
        UUID testUuid = UUID.randomUUID();
        FactoryObjectProxy testObjProxy = mock(FactoryObjectProxy.class);
        Configuration config = m_ConfigAdmin.createFactoryConfiguration(FACTORY_PID, null);
        String pid = config.getPid();
        ComponentInstance instance = mockComponentInstance(UUID.randomUUID(), "name", pid);
        when(m_ServiceProxy.createFactoryObjectInternal(m_FactoryDescriptor)).thenReturn(instance);
        when(m_FactoryDescriptor.create()).thenReturn(testObjProxy);
        when(m_FactoryObjectDataManager.getPid(Mockito.any(UUID.class))).thenReturn(pid);
        when(m_ConfigAdmin.getConfiguration(anyString(), anyString())).thenReturn(config);
        m_SUT.createOrRestoreObject(m_FactoryDescriptor, testUuid);
        FactoryObjectInternal internal = (FactoryObjectInternal)instance.getInstance();
        m_SUT.delete(internal);
        verify(m_Callback).onRemovedObject(internal);
        verify(config).delete();
    }
@ Test public void testDelete ( ) throws Exception { UUID testUuid = UUID . randomUUID ( ) ; FactoryObjectProxy testObjProxy = mock ( FactoryObjectProxy . class ) ; Configuration config = m_ConfigAdmin . createFactoryConfiguration ( FACTORY_PID , null ) ; String pid = config . getPid ( ) ; ComponentInstance instance = mockComponentInstance ( UUID . randomUUID ( ) , "name" , pid ) ; when ( m_ServiceProxy . createFactoryObjectInternal ( m_FactoryDescriptor ) ) . thenReturn ( instance ) ; when ( m_FactoryDescriptor . create ( ) ) . thenReturn ( testObjProxy ) ; when ( m_FactoryObjectDataManager . getPid ( Mockito . any ( UUID . class ) ) ) . thenReturn ( pid ) ; when ( m_ConfigAdmin . getConfiguration ( anyString ( ) , anyString ( ) ) ) . thenReturn ( config ) ; m_SUT . createOrRestoreObject ( m_FactoryDescriptor , testUuid ) ; FactoryObjectInternal internal = ( FactoryObjectInternal ) instance . getInstance ( ) ; m_SUT . delete ( internal ) ; verify ( m_Callback ) . onRemovedObject ( internal ) ; verify ( config ) . delete ( ) ; }
Verify that an object is properly deleted.
Verify that an object is properly deleted .
// replay