Package org.rhq.server.metrics.migrator.DataMigrator

Examples of org.rhq.server.metrics.migrator.DataMigrator.DataMigratorConfiguration


    @Test
    public void testEstimateTask() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Oracle;
        DataMigratorConfiguration mockConfig = mock(DataMigratorConfiguration.class);
        when(mockConfig.getDatabaseType()).thenReturn(databaseType);

        MetricsIndexMigrator mockMetricsIndexUpdateAccumulator = mock(MetricsIndexMigrator.class);
        PowerMockito.whenNew(MetricsIndexMigrator.class)
            .withArguments(eq(MigrationTable.ONE_HOUR), eq(mockConfig))
            .thenReturn(mockMetricsIndexUpdateAccumulator);

        EntityManager mockEntityManager = mock(EntityManager.class);
        when(mockConfig.getEntityManager()).thenReturn(mockEntityManager);

        org.hibernate.Session mockHibernateSession = mock(org.hibernate.Session.class);
        when(mockEntityManager.getDelegate()).thenReturn(mockHibernateSession);
        SessionFactory mockSessionFactory = mock(SessionFactory.class);
        when(mockHibernateSession.getSessionFactory()).thenReturn(mockSessionFactory);
View Full Code Here


    @Test
    public void testMigrateTask() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Oracle;
        DataMigratorConfiguration mockConfig = mock(DataMigratorConfiguration.class);
        when(mockConfig.getDatabaseType()).thenReturn(databaseType);

        Session mockCassandraSession = mock(Session.class);
        when(mockConfig.getSession()).thenReturn(mockCassandraSession);

        MetricsIndexMigrator mockMetricsIndexUpdateAccumulator = mock(MetricsIndexMigrator.class);
        PowerMockito.whenNew(MetricsIndexMigrator.class)
            .withArguments(eq(MigrationTable.ONE_HOUR), eq(mockConfig))
            .thenReturn(mockMetricsIndexUpdateAccumulator);

        EntityManager mockEntityManager = mock(EntityManager.class);
        when(mockConfig.getEntityManager()).thenReturn(mockEntityManager);

        org.hibernate.Session mockHibernateSession = mock(org.hibernate.Session.class);
        when(mockEntityManager.getDelegate()).thenReturn(mockHibernateSession);
        SessionFactory mockSessionFactory = mock(SessionFactory.class);
        when(mockHibernateSession.getSessionFactory()).thenReturn(mockSessionFactory);
View Full Code Here

    @Test
    public void testEstimateTask() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Oracle;
        DataMigratorConfiguration mockConfig = mock(DataMigratorConfiguration.class);
        when(mockConfig.getDatabaseType()).thenReturn(databaseType);

        MetricsIndexMigrator mockMetricsIndexUpdateAccumulator = mock(MetricsIndexMigrator.class);
        PowerMockito.whenNew(MetricsIndexMigrator.class).withArguments(eq(MigrationTable.RAW), eq(mockConfig))
            .thenReturn(mockMetricsIndexUpdateAccumulator);

        EntityManager mockEntityManager = mock(EntityManager.class);
        when(mockConfig.getEntityManager()).thenReturn(mockEntityManager);

        org.hibernate.Session mockHibernateSession = mock(org.hibernate.Session.class);
        when(mockEntityManager.getDelegate()).thenReturn(mockHibernateSession);
        SessionFactory mockSessionFactory = mock(SessionFactory.class);
        when(mockHibernateSession.getSessionFactory()).thenReturn(mockSessionFactory);
View Full Code Here

    @Test
    public void testMigrateTask() throws Exception {
        //tell the method story as it happens: mock or create dependencies and configure
        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Oracle;
        DataMigratorConfiguration mockConfig = mock(DataMigratorConfiguration.class);
        when(mockConfig.getDatabaseType()).thenReturn(databaseType);

        Session mockCassandraSession = mock(Session.class);
        when(mockConfig.getSession()).thenReturn(mockCassandraSession);

        MetricsIndexMigrator mockMetricsIndexUpdateAccumulator = mock(MetricsIndexMigrator.class);
        PowerMockito.whenNew(MetricsIndexMigrator.class).withArguments(eq(MigrationTable.RAW), eq(mockConfig))
            .thenReturn(mockMetricsIndexUpdateAccumulator);

        EntityManager mockEntityManager = mock(EntityManager.class);
        when(mockConfig.getEntityManager()).thenReturn(mockEntityManager);

        org.hibernate.Session mockHibernateSession = mock(org.hibernate.Session.class);
        when(mockEntityManager.getDelegate()).thenReturn(mockHibernateSession);
        SessionFactory mockSessionFactory = mock(SessionFactory.class);
        when(mockHibernateSession.getSessionFactory()).thenReturn(mockSessionFactory);
View Full Code Here

        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Postgres;
        EntityManager mockEntityManager = mock(EntityManager.class);
        Session mockCassandraSession = mock(Session.class);

        DataMigratorConfiguration mockConfig = PowerMockito.mock(DataMigratorConfiguration.class);
        PowerMockito.whenNew(DataMigratorConfiguration.class)
            .withArguments(eq(mockEntityManager), eq(mockCassandraSession), eq(databaseType), eq(false)).thenReturn(mockConfig);

        //create object to test and inject required dependencies
        DataMigrator objectUnderTest = new DataMigrator(mockEntityManager, mockCassandraSession, databaseType);
View Full Code Here

        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Postgres;

        EntityManager mockEntityManager = mock(EntityManager.class);
        Session mockCassandraSession = mock(Session.class);
        DataMigratorConfiguration mockConfig = PowerMockito.mock(DataMigratorConfiguration.class);
        PowerMockito.whenNew(DataMigratorConfiguration.class)
            .withArguments(eq(mockEntityManager), eq(mockCassandraSession), eq(databaseType), eq(false)).thenReturn(mockConfig);

        when(mockConfig.isRunRawDataMigration()).thenReturn(true);
        when(mockConfig.isRun1HAggregateDataMigration()).thenReturn(false);
        when(mockConfig.isRun6HAggregateDataMigration()).thenReturn(false);
        when(mockConfig.isRun1DAggregateDataMigration()).thenReturn(false);

        RawDataMigrator mockRawDataMigrator = mock(RawDataMigrator.class);
        PowerMockito.whenNew(RawDataMigrator.class).withArguments(eq(mockConfig)).thenReturn(mockRawDataMigrator);
        long estimateExpected = 1234L;
        when(mockRawDataMigrator.estimate()).thenReturn(estimateExpected);
View Full Code Here

        //those dependencies to get the method under test to completion
        DatabaseType databaseType = DatabaseType.Postgres;

        EntityManager mockEntityManager = mock(EntityManager.class);
        Session mockCassandraSession = mock(Session.class);
        DataMigratorConfiguration mockConfig = PowerMockito.mock(DataMigratorConfiguration.class);
        PowerMockito.whenNew(DataMigratorConfiguration.class)
            .withArguments(eq(mockEntityManager), eq(mockCassandraSession), eq(databaseType), eq(false)).thenReturn(mockConfig);

        when(mockConfig.isRunRawDataMigration()).thenReturn(false);
        when(mockConfig.isRun1HAggregateDataMigration()).thenReturn(true);
        when(mockConfig.isRun6HAggregateDataMigration()).thenReturn(true);
        when(mockConfig.isRun1DAggregateDataMigration()).thenReturn(true);

        AggregateDataMigrator mockAggregateDataMigrator = mock(AggregateDataMigrator.class);
        PowerMockito.whenNew(AggregateDataMigrator.class).withArguments(any(), eq(mockConfig))
            .thenReturn(mockAggregateDataMigrator);
View Full Code Here

TOP

Related Classes of org.rhq.server.metrics.migrator.DataMigrator.DataMigratorConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.