mil.dod.th.ose.core/test/mil/dod/th/ose/core/impl/persistence/TestPersistentDataStoreImpl.java
@Test
    public final void testComponentPropertiesSet() throws IOException, SQLException
    {
        // mock
        Connection sqlConn = mock(java.sql.Connection.class, withSettings().extraInterfaces(JDOConnection.class));
        when(m_PersistenceManager.getDataStoreConnection()).thenReturn((JDOConnection)sqlConn);
        
        Statement statement = mock(Statement.class);
        when(sqlConn.createStatement()).thenReturn(statement);
        
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("minUsableSpace", 500L);
        props.put(H2DataStoreConfig.MAX_CACHE_SIZE_KEY, 100);

        when(m_Context.getProperty(PersistentDataStoreImpl.MAX_CACHE_SIZE)).thenReturn("200");

        m_SUT.activate(Collections.unmodifiableMap(props), m_Context);
        
        // value should be set based on framework property
        verify(statement).execute("SET CACHE_SIZE 100");
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
/**
     * Test that if component properties are set, the framework property is ignored.
     */
Test that if component properties are set, the framework property is ignored.
Test that if component properties are set the framework property is ignored .
@Test
    public final void testComponentPropertiesSet() throws IOException, SQLException
    {
        Connection sqlConn = mock(java.sql.Connection.class, withSettings().extraInterfaces(JDOConnection.class));
        when(m_PersistenceManager.getDataStoreConnection()).thenReturn((JDOConnection)sqlConn);
        Statement statement = mock(Statement.class);
        when(sqlConn.createStatement()).thenReturn(statement);
        Map<String, Object> props = new HashMap<String, Object>();
        props.put("minUsableSpace", 500L);
        props.put(H2DataStoreConfig.MAX_CACHE_SIZE_KEY, 100);
        when(m_Context.getProperty(PersistentDataStoreImpl.MAX_CACHE_SIZE)).thenReturn("200");
        m_SUT.activate(Collections.unmodifiableMap(props), m_Context);
        verify(statement).execute("SET CACHE_SIZE 100");
        verify(m_WakeLock).activate();
        verify(m_WakeLock).cancel();
    }
@ Test public final void testComponentPropertiesSet ( ) throws IOException , SQLException { Connection sqlConn = mock ( java . sql . Connection . class , withSettings ( ) . extraInterfaces ( JDOConnection . class ) ) ; when ( m_PersistenceManager . getDataStoreConnection ( ) ) . thenReturn ( ( JDOConnection ) sqlConn ) ; Statement statement = mock ( Statement . class ) ; when ( sqlConn . createStatement ( ) ) . thenReturn ( statement ) ; Map < String , Object > props = new HashMap < String , Object > ( ) ; props . put ( "minUsableSpace" , 500L ) ; props . put ( H2DataStoreConfig . MAX_CACHE_SIZE_KEY , 100 ) ; when ( m_Context . getProperty ( PersistentDataStoreImpl . MAX_CACHE_SIZE ) ) . thenReturn ( "200" ) ; m_SUT . activate ( Collections . unmodifiableMap ( props ) , m_Context ) ; verify ( statement ) . execute ( "SET CACHE_SIZE 100" ) ; verify ( m_WakeLock ) . activate ( ) ; verify ( m_WakeLock ) . cancel ( ) ; }
Test that if component properties are set, the framework property is ignored.
Test that if component properties are set the framework property is ignored .
// mock // value should be set based on framework property