Package org.jasig.portal.events.aggr

Examples of org.jasig.portal.events.aggr.AggregatedIntervalConfig


    @Test
    public void testAggregatedIntervalConfig() throws Exception {
        this.execute(new CallableWithoutResult() {
            @Override
            protected void callWithoutResult() {
                final AggregatedIntervalConfig defaultAggregatedIntervalConfig = eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();
                assertNotNull(defaultAggregatedIntervalConfig);
                assertEquals(0, defaultAggregatedIntervalConfig.getExcluded().size());
                assertEquals(0, defaultAggregatedIntervalConfig.getIncluded().size());
               
                AggregatedIntervalConfig loginAggregatedIntervalConfig = eventAggregationManagementDao.getAggregatedIntervalConfig(LoginPortalEventAggregator.class);
                assertNull(loginAggregatedIntervalConfig);
                loginAggregatedIntervalConfig = eventAggregationManagementDao.createAggregatedIntervalConfig(LoginPortalEventAggregator.class);
                assertNotNull(loginAggregatedIntervalConfig);
                assertEquals(0, loginAggregatedIntervalConfig.getExcluded().size());
                assertEquals(0, loginAggregatedIntervalConfig.getIncluded().size());
               
                defaultAggregatedIntervalConfig.getIncluded().add(AggregationInterval.MINUTE);
                loginAggregatedIntervalConfig.getExcluded().add(AggregationInterval.MINUTE);

                eventAggregationManagementDao.updateAggregatedIntervalConfig(defaultAggregatedIntervalConfig);
                eventAggregationManagementDao.updateAggregatedIntervalConfig(loginAggregatedIntervalConfig);
            }
        });
       
        this.execute(new CallableWithoutResult() {
            @Override
            protected void callWithoutResult() {
                final AggregatedIntervalConfig defaultAggregatedIntervalConfig = eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();
                assertNotNull(defaultAggregatedIntervalConfig);
                assertEquals(0, defaultAggregatedIntervalConfig.getExcluded().size());
                assertEquals(1, defaultAggregatedIntervalConfig.getIncluded().size());
               
                AggregatedIntervalConfig loginAggregatedIntervalConfig = eventAggregationManagementDao.getAggregatedIntervalConfig(LoginPortalEventAggregator.class);
                assertNotNull(loginAggregatedIntervalConfig);
                assertEquals(1, loginAggregatedIntervalConfig.getExcluded().size());
                assertEquals(0, loginAggregatedIntervalConfig.getIncluded().size());
               
                eventAggregationManagementDao.deleteAggregatedIntervalConfig(defaultAggregatedIntervalConfig);
                eventAggregationManagementDao.deleteAggregatedIntervalConfig(loginAggregatedIntervalConfig);
            }
        });
       
        this.execute(new CallableWithoutResult() {
            @Override
            protected void callWithoutResult() {
                final AggregatedIntervalConfig defaultAggregatedIntervalConfig = eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();
                assertNotNull(defaultAggregatedIntervalConfig);
                assertEquals(0, defaultAggregatedIntervalConfig.getExcluded().size());
                assertEquals(0, defaultAggregatedIntervalConfig.getIncluded().size());
               
                AggregatedIntervalConfig loginAggregatedIntervalConfig = eventAggregationManagementDao.getAggregatedIntervalConfig(LoginPortalEventAggregator.class);
                assertNull(loginAggregatedIntervalConfig);
            }
        });
    }
View Full Code Here


        return new LinkedHashSet<AggregatedIntervalConfig>(results);
    }

    @Override
    public AggregatedIntervalConfig getDefaultAggregatedIntervalConfig() {
        AggregatedIntervalConfig intervalConfig = this.getAggregatedIntervalConfig(DEFAULT_AGGREGATOR_TYPE);
       
        if (intervalConfig == null) {
            intervalConfig = this.getTransactionOperations().execute(new TransactionCallback<AggregatedIntervalConfig>() {
                @Override
                public AggregatedIntervalConfig doInTransaction(TransactionStatus status) {
View Full Code Here

    }

    @Override
    @AggrEventsTransactional
    public AggregatedIntervalConfig createAggregatedIntervalConfig(Class<? extends IPortalEventAggregator> aggregatorType) {
        final AggregatedIntervalConfig aggregatedIntervalConfig = new AggregatedIntervalConfigImpl(aggregatorType);
        this.getEntityManager().persist(aggregatedIntervalConfig);
        return aggregatedIntervalConfig;
    }
View Full Code Here

      final Set<AggregatedIntervalConfig> oldAggregatedIntervalConfigs = new HashSet<AggregatedIntervalConfig>(this.aggregationManagementDao.getAggregatedIntervalConfigs());
      for (final ExternalAggregatedIntervalConfig extAggregatedIntervalConfig : data.getAggregatedIntervalConfigs()) {
          final String aggregatorTypeName = extAggregatedIntervalConfig.getAggregatorType();
         
          final Class<? extends IPortalEventAggregator> aggregatorType = getAggregatorType(aggregatorTypeName);
            AggregatedIntervalConfig aggregatedIntervalConfig = this.aggregationManagementDao.getAggregatedIntervalConfig(aggregatorType);
            if (aggregatedIntervalConfig == null) {
                aggregatedIntervalConfig = this.aggregationManagementDao.createAggregatedIntervalConfig(aggregatorType);
            }
           
            //Remove the config from the old configs set, marking it as updated
            oldAggregatedIntervalConfigs.remove(aggregatedIntervalConfig);
           
            //Copy over excludes
            final Set<AggregationInterval> excluded = aggregatedIntervalConfig.getExcluded();
            excluded.clear();
            for (final ExternalAggregationInterval extInterval : extAggregatedIntervalConfig.getExcludes()) {
                excluded.add(convert(extInterval));
            }
           
            //Copy over includes
            final Set<AggregationInterval> included = aggregatedIntervalConfig.getIncluded();
            included.clear();
            for (final ExternalAggregationInterval extInterval : extAggregatedIntervalConfig.getIncludes()) {
                included.add(convert(extInterval));
            }
           
View Full Code Here

TOP

Related Classes of org.jasig.portal.events.aggr.AggregatedIntervalConfig

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.