mil.dod.th.ose.config/test/mil/dod/th/ose/config/loading/impl/TestAssetTrackerCustomizer.java
@SuppressWarnings("unchecked")
    @Test
    public void testAddingServiceMissing() throws IllegalArgumentException, AssetException, IllegalStateException,
            FactoryException
    {
        FactoryObjectConfig objectConfig = new FactoryObjectConfig()
            .withFactoryType(FactoryTypeEnum.ASSET)
            .withProperties(m_Properties)
            .withProductType(TEST_PID)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
            .withName("Asset1");

        when(m_AssetDirService.isAssetAvailable("Asset1")).thenReturn(false);

        when(m_AssetDirService.createAsset(eq(TEST_PID), eq("Asset1"), any(Map.class))).thenReturn(m_Asset);

        AssetTrackerCustomizer sut = new AssetTrackerCustomizer(objectConfig, m_AssetDirService, m_Log, m_EventAdmin);

        sut.addingService(m_ServiceReference);

        verify(m_AssetDirService, times(1)).createAsset(eq(TEST_PID), eq("Asset1"), eq(m_ExpectedProps));
    }
/**
     * Test adding an Asset that isn't created yet.
     */
Test adding an Asset that isn't created yet.
Test adding an Asset that isn ' t created yet .
@SuppressWarnings("unchecked")
    @Test
    public void testAddingServiceMissing() throws IllegalArgumentException, AssetException, IllegalStateException,
            FactoryException
    {
        FactoryObjectConfig objectConfig = new FactoryObjectConfig()
            .withFactoryType(FactoryTypeEnum.ASSET)
            .withProperties(m_Properties)
            .withProductType(TEST_PID)
            .withCreatePolicy(CreatePolicyEnum.FIRST_RUN)
            .withName("Asset1");
        when(m_AssetDirService.isAssetAvailable("Asset1")).thenReturn(false);
        when(m_AssetDirService.createAsset(eq(TEST_PID), eq("Asset1"), any(Map.class))).thenReturn(m_Asset);
        AssetTrackerCustomizer sut = new AssetTrackerCustomizer(objectConfig, m_AssetDirService, m_Log, m_EventAdmin);
        sut.addingService(m_ServiceReference);
        verify(m_AssetDirService, times(1)).createAsset(eq(TEST_PID), eq("Asset1"), eq(m_ExpectedProps));
    }
@ SuppressWarnings ( "unchecked" ) @ Test public void testAddingServiceMissing ( ) throws IllegalArgumentException , AssetException , IllegalStateException , FactoryException { FactoryObjectConfig objectConfig = new FactoryObjectConfig ( ) . withFactoryType ( FactoryTypeEnum . ASSET ) . withProperties ( m_Properties ) . withProductType ( TEST_PID ) . withCreatePolicy ( CreatePolicyEnum . FIRST_RUN ) . withName ( "Asset1" ) ; when ( m_AssetDirService . isAssetAvailable ( "Asset1" ) ) . thenReturn ( false ) ; when ( m_AssetDirService . createAsset ( eq ( TEST_PID ) , eq ( "Asset1" ) , any ( Map . class ) ) ) . thenReturn ( m_Asset ) ; AssetTrackerCustomizer sut = new AssetTrackerCustomizer ( objectConfig , m_AssetDirService , m_Log , m_EventAdmin ) ; sut . addingService ( m_ServiceReference ) ; verify ( m_AssetDirService , times ( 1 ) ) . createAsset ( eq ( TEST_PID ) , eq ( "Asset1" ) , eq ( m_ExpectedProps ) ) ; }
Test adding an Asset that isn't created yet.
Test adding an Asset that isn ' t created yet .