All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bdd.reporting.services.CommonFeatureConsumer.kt Maven / Gradle / Ivy

Go to download

BDD Enterprise Reporting Server. This server provides the ability to upload reports from tools like Cucumber, SpecFlow, Pickles and the information is then aggregated into a central view across all projects.

The newest version!
package org.bdd.reporting.services

import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
import org.bdd.reporting.data.CommonFeature
import org.bdd.reporting.events.EventBus
import org.bdd.reporting.repository.elasticsearch.FeatureRepository
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Service
import javax.annotation.PostConstruct
import javax.annotation.PreDestroy

/**
 * Created by Grant Little [email protected]
 */
@Service
class CommonFeatureConsumer(@Qualifier("DbEventBus")val eventBus : EventBus,
                            val featureRepository: FeatureRepository) {

    companion object {
        private val LOG : Log = LogFactory.getLog(CommonFeatureConsumer::class.java)
    }

    @PostConstruct
    fun start()  {
        LOG.info("Starting CommonFeatureConsumer")
        eventBus.register("common-features", { onCommonFeature(it)})
    }

    @PreDestroy
    fun stop() {
        LOG.info("Stopping CommonFeatureConsumer")
    }


    fun onCommonFeature(event : CommonFeature) {
        LOG.info("Common Feature received " + event)
        featureRepository.save(event)
    }

//    fun tags(input : Set?) : Set {
//        input ?: return emptySet()
//        return input.map { CommonTag(it.name as String, it.line) }.toSet()
//    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy