Changeset 1312


Ignore:
Timestamp:
12/15/11 23:27:50 (9 years ago)
Author:
philsmart
Message:
 
Location:
raptor-mua/trunk
Files:
3 added
16 edited

Legend:

Unmodified
Added
Removed
  • raptor-mua/trunk/.settings/org.maven.ide.eclipse.prefs

    r363 r1312  
    1 #Mon Jun 28 16:17:37 BST 2010 
     1#Wed Dec 14 17:57:10 GMT 2011 
    22activeProfiles= 
    33eclipse.preferences.version=1 
  • raptor-mua/trunk/src/main/conf-default/mua-core.xml

    r1282 r1312  
    139139    </bean> 
    140140 
    141     <bean id="capabilitiesConstructor" class="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructor"> 
    142         <property name="cacheEnabled"> 
    143             <value>true</value> 
     141   <bean id="capabilitiesConstructor" class="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructor"> 
     142         <property name="statisticsHandler"> 
     143            <ref bean="statisticalUnits" /> 
     144        </property> 
     145        <property name="storageEngine"> 
     146            <ref bean="storageEngine"></ref> 
     147        </property> 
     148         <property name="metadata"> 
     149            <ref bean="MUAMetadata"></ref> 
    144150        </property> 
    145151        <property name="cacheTimeoutMs"> 
  • raptor-mua/trunk/src/main/config/database.xml

    r1282 r1312  
    1818                class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
    1919                <property name="dataSource"> 
    20                         <ref local="muac3p0DataSourceHSQLDB" /> 
     20                        <ref local="muac3p0DataSource" /> 
    2121                </property> 
    2222                <property name="hibernateProperties"> 
    2323                        <props> 
    24                                  <!--  <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop>--> 
    25                              <prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop> 
     24                                 <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect</prop> 
     25                             <!-- <prop key="hibernate.dialect"> org.hibernate.dialect.HSQLDialect</prop>--> 
    2626                <!--  <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect</prop>--> 
    2727                                <prop key="hibernate.show_sql">false</prop> 
  • raptor-mua/trunk/src/main/config/mua-core.xml

    r1249 r1312  
    140140 
    141141    <bean id="capabilitiesConstructor" class="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructor"> 
    142         <property name="cacheEnabled"> 
    143             <value>true</value> 
     142         <property name="statisticsHandler"> 
     143            <ref bean="statisticalUnits" /> 
     144        </property> 
     145        <property name="storageEngine"> 
     146            <ref bean="storageEngine"></ref> 
     147        </property> 
     148         <property name="metadata"> 
     149            <ref bean="MUAMetadata"></ref> 
    144150        </property> 
    145151        <property name="cacheTimeoutMs"> 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/BaseCapabilitiesContructor.java

    r1211 r1312  
    1717package uk.ac.cardiff.raptormua.engine; 
    1818 
    19 import uk.ac.cardiff.model.ServiceMetadata; 
    2019import uk.ac.cardiff.model.wsmodel.Capabilities; 
    21 import uk.ac.cardiff.raptor.store.EventStorageEngine; 
    22 import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
    2320 
    2421public abstract class BaseCapabilitiesContructor { 
    2522 
    26     public abstract Capabilities constructCapabilities(StatisticHandler statisticsHandler, 
    27             EventStorageEngine storageEngine, ServiceMetadata metadata); 
    28  
     23    public abstract Capabilities getCapabilities(); 
    2924 
    3025    /** If things have changed, the cache should be invalidated immediately. */ 
    3126    public abstract void invalidateCache(); 
     27 
     28    /** called to initialise this capabiliies constructor. If needed. */ 
     29    public abstract void initialiseCapabilities(); 
    3230} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/CapabilitiesConstructor.java

    r1308 r1312  
    2020package uk.ac.cardiff.raptormua.engine; 
    2121 
    22 import java.util.ArrayList; 
    23 import java.util.Collections; 
    24 import java.util.Date; 
    25 import java.util.List; 
    2622import java.util.Set; 
     23import java.util.Timer; 
     24import java.util.TimerTask; 
    2725import java.util.concurrent.ExecutorService; 
    2826import java.util.concurrent.Executors; 
    2927 
    30 import org.joda.time.DateTime; 
    3128import org.slf4j.Logger; 
    3229import org.slf4j.LoggerFactory; 
    33 import org.springframework.beans.BeansException; 
    34 import org.springframework.context.ApplicationContext; 
    35 import org.springframework.context.ApplicationContextAware; 
    3630 
    3731import uk.ac.cardiff.model.ServiceMetadata; 
    38 import uk.ac.cardiff.model.resource.ResourceMetadata; 
    3932import uk.ac.cardiff.model.wsmodel.Capabilities; 
    40 import uk.ac.cardiff.model.wsmodel.EventTypeInformation; 
    41 import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
    42 import uk.ac.cardiff.model.wsmodel.StatisticalUnitInformation; 
    43 import uk.ac.cardiff.model.wsmodel.SuggestionValues; 
    44 import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
    4533import uk.ac.cardiff.raptor.store.EventStorageEngine; 
    46 import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
    4734import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
    48 import uk.ac.cardiff.raptormua.engine.statistics.StatisticProcessorRegistry; 
    49 import uk.ac.cardiff.raptormua.engine.statistics.processor.ProcessorTemplate; 
    50 import uk.ac.cardiff.raptormua.runtimeutils.ResourceMetadataComparator; 
    5135 
    5236/** 
     
    5438 *  
    5539 */ 
    56 public class CapabilitiesConstructor extends BaseCapabilitiesContructor implements ApplicationContextAware { 
     40public class CapabilitiesConstructor extends BaseCapabilitiesContructor implements CallbackInterface<Capabilities> { 
    5741 
    5842    /** Class logger. */ 
    5943    private final Logger log = LoggerFactory.getLogger(CapabilitiesConstructor.class); 
    6044 
    61     /** Whether to cache capabilities */ 
     45    /** Whether to cache capabilities. Not used, always true. */ 
    6246    private boolean cacheEnabled; 
    6347 
     48    /** The capabilites currently constructed. Will be reconstructed on cache timeout or cache invalidation. */ 
    6449    private Capabilities cachedCapabilities; 
    6550 
     
    7055    private long cacheResetTimeMs; 
    7156 
     57    /** Timer that checks if the cache has expired */ 
     58    private Timer cacheTimer; 
     59 
    7260    /** Set containing the names of fields that should not be included in the list of possible field values */ 
    7361    private Set<String> excludeFieldNames; 
    7462 
    75     /** 
    76      * If set to true, cache timeout is ignored, and new capabilities are constructed from scratch. 
    77      */ 
    78     private boolean invalidateCache; 
    79  
    8063    /** The single thread pool responsible for queing reconstruction of the <code>cached</code> capabilities. */ 
    8164    private final ExecutorService capabilitiesConstructionService; 
    8265 
    83     /** Springs application context */ 
    84     private ApplicationContext applicationContext; 
    85  
    86     /** 
    87      * Default constructor. Creates a new single thread executor service. 
     66    /** The statiscs handler used to extract statistical units to perform. */ 
     67    private StatisticHandler statisticsHandler; 
     68 
     69    /** The storage engine used to extract information about events stored. */ 
     70    private EventStorageEngine storageEngine; 
     71 
     72    /** The service metadata used to embedded in the capabilities. */ 
     73    private ServiceMetadata metadata; 
     74 
     75    /** 
     76     * Default constructor. Does the following: 
     77     * <ol> 
     78     * <li>Creates a new single thread executor service.</li> 
     79     * <li>Sets the default timeout to 1800000ms.</li> 
     80     * <li>Starts a timer task which checks the cache every minute.</li> 
     81     * </ol> 
    8882     */ 
    8983    public CapabilitiesConstructor() { 
    9084        capabilitiesConstructionService = Executors.newSingleThreadExecutor(); 
    91     } 
    92  
    93     /** 
    94      * Constructos the capabilities of this MUA instance, by computing and storing the following: 
     85        cacheTimeoutMs = 1800000; 
     86        cacheTimer = new Timer(); 
     87        cacheTimer.schedule(new TimerTask() { 
     88            public void run() { 
     89                log.trace("Cache will timeout in {} milliseconds", cacheTimeoutMs 
     90                        - (System.currentTimeMillis() - cacheResetTimeMs)); 
     91                if ((System.currentTimeMillis() - cacheResetTimeMs) > cacheTimeoutMs) { 
     92                    log.info("Capabilities cache was cleared, timeout reached"); 
     93                    queueCapabilitiesConstruction(); 
     94                } 
     95            } 
     96        }, 60000, 60000); 
     97    } 
     98 
     99    /** 
     100     * The result of executing a {@link CapabilitiesConstructorTask} through the 
     101     * <code>capabilitiesConstructionService</code> single threaded executor is returned here once complete. 
     102     *  
     103     */ 
     104    public void returnResult(Capabilities newCapabilities) { 
     105        log.info("Capabilities have been reconstructed {}", newCapabilities); 
     106 
     107        cachedCapabilities = newCapabilities; 
     108        cacheResetTimeMs = System.currentTimeMillis(); 
     109 
     110    } 
     111 
     112    /** 
     113     * Queues to create the initial <code>cachedCapabilities</code>. 
     114     */ 
     115    public void initialiseCapabilities() { 
     116        queueCapabilitiesConstruction(); 
     117    } 
     118 
     119    private void queueCapabilitiesConstruction() { 
     120        log.info("Capabilities constructor called, adding request to thread queue"); 
     121        if (statisticsHandler != null && storageEngine != null && metadata != null) { 
     122            CapabilitiesConstructorTask constructor = 
     123                    new CapabilitiesConstructorTask(this, statisticsHandler, storageEngine, metadata); 
     124            constructor.setExcludeFieldNames(excludeFieldNames); 
     125            capabilitiesConstructionService.submit(constructor); 
     126        } else { 
     127            log.error("No capabilites constructed, one-of statisticsHandler, storageEngine or metadata not set"); 
     128        } 
     129    } 
     130 
     131    /** 
     132     * Constructors the capabilities of this MUA instance, by computing and storing the following: 
    95133     * <ul> 
    96134     * <li>Stores the metadata assoicated to this MUA. 
     
    99137     * @return the {@link Capabilities} of this MUA. 
    100138     */ 
    101     public Capabilities constructCapabilities(StatisticHandler statisticsHandler, EventStorageEngine storageEngine, 
    102             ServiceMetadata metadata) { 
    103         log.info("Capabilities constructor called"); 
    104         long startTime = System.currentTimeMillis(); 
    105  
    106         Capabilities capabilities = null; 
    107  
    108         checkCacheValidity(); 
    109  
    110         if (cacheEnabled && cachedCapabilities != null) { 
    111             log.info("Capabilities retrieved from cache, cache will timeout in {} milliseconds", cacheTimeoutMs 
    112                     - (System.currentTimeMillis() - cacheResetTimeMs)); 
    113             capabilities = cachedCapabilities; 
    114         } 
    115  
    116         if (capabilities == null) { 
    117  
    118             capabilities = new Capabilities(); 
    119             capabilities.setMetadata(metadata); 
    120  
    121             try { 
    122                 String version = 
    123                         Version.getMajorVersion() + "." + Version.getMinorVersion() + "." + Version.getMicroVersion(); 
    124                 capabilities.setMuaVersion(version); 
    125             } catch (Throwable e) { 
    126                 capabilities.setMuaVersion("Unknown"); 
    127             } 
    128  
    129             addStatisticInformation(capabilities, statisticsHandler); 
    130             addSuggestions(capabilities, storageEngine, statisticsHandler); 
    131             addEventTotals(capabilities, storageEngine); 
    132             addEventDateInformation(capabilities, storageEngine); 
    133             addResourceInformation(capabilities, storageEngine); 
    134  
    135             if (cacheEnabled) { 
    136                 cachedCapabilities = capabilities; 
    137                 cacheResetTimeMs = System.currentTimeMillis(); 
    138             } 
    139         } 
    140         long endTime = System.currentTimeMillis(); 
    141         log.info("Constructed MUA Capabilities for [{}] in {}s", capabilities.getMetadata().getEntityId(), 
    142                 ((endTime - startTime) / 1000)); 
    143  
    144         return capabilities; 
    145     } 
    146  
     139    public Capabilities getCapabilities() { 
     140 
     141        log.info("Capabilities retrieved from cache, cache will timeout in {} milliseconds", 
     142                cacheTimeoutMs - (System.currentTimeMillis() - cacheResetTimeMs)); 
     143        return cachedCapabilities; 
     144 
     145    } 
     146 
     147    /** 
     148     * If called, cache timeout is reset, and a call to construct new capabilities is placed on the queue. 
     149     */ 
    147150    public void invalidateCache() { 
    148         invalidateCache = true; 
    149     } 
    150  
    151     public void addStatisticInformation(Capabilities capabilities, StatisticHandler statisticsHandler) { 
    152         log.debug("Adding statistical information to capabilities"); 
    153         ArrayList<StatisticalUnitInformation> stats = new ArrayList<StatisticalUnitInformation>(); 
    154         List<BaseStatistic> su = statisticsHandler.getStatisticalUnits(); 
    155         for (BaseStatistic entry : su) { 
    156             log.debug("Setting statistical unit information as: " + entry.getStatisticParameters().getUnitName()); 
    157             StatisticalUnitInformation information = new StatisticalUnitInformation(); 
    158             information.setStatisticParameters(entry.getStatisticParameters()); 
    159             information.setPostprocessors(entry.getAttachProcessors()); 
    160             stats.add(information); 
    161         } 
    162         capabilities.setStatisticalServices(stats); 
    163     } 
    164  
    165     private void addSuggestions(Capabilities capabilities, EventStorageEngine storageEngine, 
    166             StatisticHandler statisticsHandler) { 
    167         log.debug("Adding suggestion information to capabilities"); 
    168         SuggestionValues suggestionValues = new SuggestionValues(); 
    169         suggestionValues.setPossibleFieldNameValues(ReflectionHelper.getFieldsFromEntrySubClasses()); 
    170         capabilities.setSuggestionValues(suggestionValues); 
    171  
    172         StatisticProcessorRegistry processorRegistry = 
    173                 statisticsHandler.getStatisticRegistry().getStatisticProcessorRegistry(); 
    174  
    175         List<ProcessorTemplate> templates = processorRegistry.getStatisticProcessorTemplates(); 
    176         List<ProcessorInformation> possiblePostProcessors = new ArrayList<ProcessorInformation>(); 
    177         for (ProcessorTemplate template : templates) { 
    178             ProcessorInformation information = new ProcessorInformation(); 
    179             information.setFriendlyName(template.getProcessorFriendlyName()); 
    180             information.setProcessorClass(template.getProcessorClass().getCanonicalName()); 
    181             information.setMethodParameters(template.getMethodParameters()); 
    182             possiblePostProcessors.add(information); 
    183  
    184         } 
    185  
    186         log.trace("Has set {} possible post processor suggestion values", possiblePostProcessors.size()); 
    187         suggestionValues.setPossiblePostProcessors(possiblePostProcessors); 
    188  
    189         // set possible values for field names 
    190         List<String> possibleFieldNames = new ArrayList<String>(); 
    191         if (excludeFieldNames == null) { 
    192             possibleFieldNames = suggestionValues.getPossibleFieldNameValuesList(); 
    193         } else { 
    194             for (String fieldname : suggestionValues.getPossibleFieldNameValuesList()) { 
    195                 if (!excludeFieldNames.contains(fieldname)) { 
    196                     possibleFieldNames.add(fieldname); 
    197                 } 
    198             } 
    199         } 
    200         log.debug("Capabilities constructor setting possible field values (can cause issues)"); 
    201         suggestionValues.setPossibleFieldValues(storageEngine.getPossibleValuesFor(possibleFieldNames)); 
    202     } 
    203  
    204     private void addEventTotals(Capabilities capabilities, EventStorageEngine storageEngine) { 
    205         log.debug("Adding event totals to capabilities"); 
    206         capabilities.setNumberOfAuthenticationsStored(storageEngine.getEventHandler().getNumberOfEvents()); 
    207         List<String> eventTypes = ReflectionHelper.getAllEventClasses(); 
    208         List<EventTypeInformation> eventsPerType = new ArrayList<EventTypeInformation>(); 
    209         for (String eventType : eventTypes) { 
    210             String query = "SELECT count(*) from " + eventType; 
    211             try { 
    212                 long count = (Long) storageEngine.getEventHandler().queryUnique(query, null); 
    213                 log.debug("EventType {} has {} events", eventType, count); 
    214                 eventsPerType.add(new EventTypeInformation(eventType, count)); 
    215             } catch (Exception e) { 
    216                 log.warn("EventType [{}] has no count (table probably does not exist yet, no problem)", eventType); 
    217             } 
    218         } 
    219         capabilities.setEventsPerType(eventsPerType); 
    220     } 
    221  
    222     private void addEventDateInformation(Capabilities capabilities, EventStorageEngine storageEngine) { 
    223         log.debug("Adding event dates to capabilities"); 
    224         DateTime latest = 
    225                 (DateTime) storageEngine.getEventHandler().queryUnique("SELECT max(eventTime) from Event", null); 
    226         DateTime earliest = 
    227                 (DateTime) storageEngine.getEventHandler().queryUnique("SELECT min(eventTime) from Event", null); 
    228         if (latest != null && earliest != null) { 
    229             capabilities.setLatestEventTime(new Date(latest.getMillis())); 
    230             capabilities.setEarliestEventTime(new Date(earliest.getMillis())); 
    231         } 
    232     } 
    233  
    234     private void addResourceInformation(Capabilities capabilities, EventStorageEngine storageEngine) { 
    235         log.debug("Adding resource metadata to capabilities"); 
    236         List<ResourceMetadata> resourceMetadata = 
    237                 (List<ResourceMetadata>) storageEngine.getEventHandler().query("from ResourceMetadata", null); 
    238         log.debug("Setting {} resource metadata(s)", resourceMetadata.size()); 
    239         Collections.sort(resourceMetadata, new ResourceMetadataComparator()); 
    240         capabilities.setResourceMetadata(resourceMetadata); 
    241     } 
    242  
    243     private void checkCacheValidity() { 
    244         if (cacheTimeoutMs == 0 || !cacheEnabled) { 
    245             return; 
    246         } 
    247         if (invalidateCache) { 
    248             log.info("Capabilities cache was forced cleared"); 
    249             cachedCapabilities = null; 
    250             invalidateCache = false; 
    251             return; 
    252         } 
    253         long currentTimeMillis = System.currentTimeMillis(); 
    254         boolean shouldReset = (currentTimeMillis - cacheResetTimeMs) > cacheTimeoutMs; 
    255         if (shouldReset) { 
    256             log.info("Capabilities cache was cleared, timeout reached"); 
    257             cachedCapabilities = null; 
    258         } 
    259     } 
    260  
    261     /** 
    262      * Sets whether the cache is enabled, and sets a default timeout of 30 minutes in case one is not specified in the 
    263      * XML 
     151        queueCapabilitiesConstruction(); 
     152        cacheResetTimeMs = System.currentTimeMillis(); 
     153    } 
     154 
     155    /** 
     156     * Deprecated, has no effect, only here not to break XML config, capabilities are always cached. 
    264157     *  
    265      * @param cacheEnabled the cacheEnabled to set 
    266      */ 
     158     * @param cacheEnabled if the cache should be used - ignored. 
     159     */ 
     160    @Deprecated 
    267161    public void setCacheEnabled(boolean cacheEnabled) { 
    268162        this.cacheEnabled = cacheEnabled; 
    269         cacheTimeoutMs = 1800000; 
     163 
    270164    } 
    271165 
     
    305199    } 
    306200 
    307     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 
    308         this.applicationContext = applicationContext; 
    309  
     201    /** 
     202     * @return the statisticsHandler 
     203     */ 
     204    public StatisticHandler getStatisticsHandler() { 
     205        return statisticsHandler; 
     206    } 
     207 
     208    /** 
     209     * @return the storageEngine 
     210     */ 
     211    public EventStorageEngine getStorageEngine() { 
     212        return storageEngine; 
     213    } 
     214 
     215    /** 
     216     * @return the metadata 
     217     */ 
     218    public ServiceMetadata getMetadata() { 
     219        return metadata; 
     220    } 
     221 
     222    /** 
     223     * @param statisticsHandler the statisticsHandler to set 
     224     */ 
     225    public void setStatisticsHandler(StatisticHandler statisticsHandler) { 
     226        this.statisticsHandler = statisticsHandler; 
     227    } 
     228 
     229    /** 
     230     * @param storageEngine the storageEngine to set 
     231     */ 
     232    public void setStorageEngine(EventStorageEngine storageEngine) { 
     233        this.storageEngine = storageEngine; 
     234    } 
     235 
     236    /** 
     237     * @param metadata the metadata to set 
     238     */ 
     239    public void setMetadata(ServiceMetadata metadata) { 
     240        this.metadata = metadata; 
    310241    } 
    311242 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/CapabilitiesConstructorTask.java

    r1308 r1312  
    22package uk.ac.cardiff.raptormua.engine; 
    33 
     4import java.util.ArrayList; 
     5import java.util.Collections; 
     6import java.util.Date; 
     7import java.util.List; 
     8import java.util.Set; 
    49import java.util.concurrent.Callable; 
    510 
     11import org.joda.time.DateTime; 
     12import org.slf4j.Logger; 
     13import org.slf4j.LoggerFactory; 
     14 
     15import uk.ac.cardiff.model.ServiceMetadata; 
     16import uk.ac.cardiff.model.resource.ResourceMetadata; 
    617import uk.ac.cardiff.model.wsmodel.Capabilities; 
     18import uk.ac.cardiff.model.wsmodel.EventTypeInformation; 
     19import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
     20import uk.ac.cardiff.model.wsmodel.StatisticalUnitInformation; 
     21import uk.ac.cardiff.model.wsmodel.SuggestionValues; 
     22import uk.ac.cardiff.raptor.runtimeutils.ReflectionHelper; 
     23import uk.ac.cardiff.raptor.store.EventStorageEngine; 
     24import uk.ac.cardiff.raptormua.engine.statistics.BaseStatistic; 
     25import uk.ac.cardiff.raptormua.engine.statistics.StatisticHandler; 
     26import uk.ac.cardiff.raptormua.engine.statistics.StatisticProcessorRegistry; 
     27import uk.ac.cardiff.raptormua.engine.statistics.processor.ProcessorTemplate; 
     28import uk.ac.cardiff.raptormua.runtimeutils.ResourceMetadataComparator; 
    729 
    830/** 
     
    1032 *  
    1133 */ 
    12 public class CapabilitiesConstructorTask implements Callable<Capabilities> { 
     34public final class CapabilitiesConstructorTask implements Callable<Boolean> { 
    1335 
    14     public Capabilities call() throws Exception { 
    15         Capabilities capabilites = doConstructCapabilities(); 
    16         return capabilites; 
     36    /** Class logger. */ 
     37    private final Logger log = LoggerFactory.getLogger(CapabilitiesConstructorTask.class); 
     38 
     39    /** What to call when the operations is complete **/ 
     40    private final CallbackInterface<Capabilities> callback; 
     41 
     42    /** The statiscs handler used to extract statistical units to perform. */ 
     43    private final StatisticHandler statisticsHandler; 
     44 
     45    /** The storage engine used to extract information about events stored. */ 
     46    private final EventStorageEngine storageEngine; 
     47 
     48    /** The service metadata used to embedded in the capabilities. */ 
     49    private final ServiceMetadata metadata; 
     50 
     51    private Capabilities capabilities; 
     52 
     53    /** Set containing the names of fields that should not be included in the list of possible field values */ 
     54    private Set<String> excludeFieldNames; 
     55 
     56    public CapabilitiesConstructorTask(CallbackInterface<Capabilities> callbackInterface, 
     57            StatisticHandler statisticsHandlerToUse, EventStorageEngine storageEngineToUse, 
     58            ServiceMetadata metadataToUse) { 
     59        callback = callbackInterface; 
     60        statisticsHandler = statisticsHandlerToUse; 
     61        storageEngine = storageEngineToUse; 
     62        metadata = metadataToUse; 
    1763    } 
    1864 
    19     private Capabilities doConstructCapabilities() { 
    20         return new Capabilities(); 
     65    public Boolean call() throws Exception { 
     66        doConstructCapabilities(); 
     67        callback.returnResult(capabilities); 
     68        return null; 
    2169    } 
     70 
     71    private void doConstructCapabilities() { 
     72        long startTime = System.currentTimeMillis(); 
     73        capabilities = new Capabilities(); 
     74        capabilities.setMetadata(metadata); 
     75        addStatisticInformation(); 
     76        addSuggestions(); 
     77        addEventTotals(); 
     78        addEventDateInformation(); 
     79        addResourceInformation(); 
     80        try { 
     81            String version = 
     82                    Version.getMajorVersion() + "." + Version.getMinorVersion() + "." + Version.getMicroVersion(); 
     83            capabilities.setMuaVersion(version); 
     84        } catch (Throwable e) { 
     85            capabilities.setMuaVersion("Unknown"); 
     86        } 
     87 
     88        long endTime = System.currentTimeMillis(); 
     89        log.info("Constructed MUA Capabilities for [{}] in {}s", metadata.getEntityId(), ((endTime - startTime) / 1000)); 
     90 
     91    } 
     92 
     93    public void addStatisticInformation() { 
     94        log.debug("Adding statistical information to capabilities"); 
     95        ArrayList<StatisticalUnitInformation> stats = new ArrayList<StatisticalUnitInformation>(); 
     96        List<BaseStatistic> su = statisticsHandler.getStatisticalUnits(); 
     97        for (BaseStatistic entry : su) { 
     98            log.debug("Setting statistical unit information as: " + entry.getStatisticParameters().getUnitName()); 
     99            StatisticalUnitInformation information = new StatisticalUnitInformation(); 
     100            information.setStatisticParameters(entry.getStatisticParameters()); 
     101            information.setPostprocessors(entry.getAttachProcessors()); 
     102            stats.add(information); 
     103        } 
     104        capabilities.setStatisticalServices(stats); 
     105    } 
     106 
     107    private void addSuggestions() { 
     108        log.debug("Adding suggestion information to capabilities"); 
     109        SuggestionValues suggestionValues = new SuggestionValues(); 
     110        suggestionValues.setPossibleFieldNameValues(ReflectionHelper.getFieldsFromEntrySubClasses()); 
     111        capabilities.setSuggestionValues(suggestionValues); 
     112 
     113        StatisticProcessorRegistry processorRegistry = 
     114                statisticsHandler.getStatisticRegistry().getStatisticProcessorRegistry(); 
     115 
     116        List<ProcessorTemplate> templates = processorRegistry.getStatisticProcessorTemplates(); 
     117        List<ProcessorInformation> possiblePostProcessors = new ArrayList<ProcessorInformation>(); 
     118        for (ProcessorTemplate template : templates) { 
     119            ProcessorInformation information = new ProcessorInformation(); 
     120            information.setFriendlyName(template.getProcessorFriendlyName()); 
     121            information.setProcessorClass(template.getProcessorClass().getCanonicalName()); 
     122            information.setMethodParameters(template.getMethodParameters()); 
     123            possiblePostProcessors.add(information); 
     124 
     125        } 
     126 
     127        log.trace("Has set {} possible post processor suggestion values", possiblePostProcessors.size()); 
     128        suggestionValues.setPossiblePostProcessors(possiblePostProcessors); 
     129 
     130        // set possible values for field names 
     131        List<String> possibleFieldNames = new ArrayList<String>(); 
     132        if (excludeFieldNames == null) { 
     133            possibleFieldNames = suggestionValues.getPossibleFieldNameValuesList(); 
     134        } else { 
     135            for (String fieldname : suggestionValues.getPossibleFieldNameValuesList()) { 
     136                if (!excludeFieldNames.contains(fieldname)) { 
     137                    possibleFieldNames.add(fieldname); 
     138                } 
     139            } 
     140        } 
     141        log.debug("Capabilities constructor setting possible field values (can cause issues)"); 
     142        suggestionValues.setPossibleFieldValues(storageEngine.getPossibleValuesFor(possibleFieldNames)); 
     143    } 
     144 
     145    private void addEventTotals() { 
     146        log.debug("Adding event totals to capabilities"); 
     147        capabilities.setNumberOfAuthenticationsStored(storageEngine.getEventHandler().getNumberOfEvents()); 
     148        List<String> eventTypes = ReflectionHelper.getAllEventClasses(); 
     149        List<EventTypeInformation> eventsPerType = new ArrayList<EventTypeInformation>(); 
     150        for (String eventType : eventTypes) { 
     151            String query = "SELECT count(*) from " + eventType; 
     152            try { 
     153                long count = (Long) storageEngine.getEventHandler().queryUnique(query, null); 
     154                log.debug("EventType {} has {} events", eventType, count); 
     155                eventsPerType.add(new EventTypeInformation(eventType, count)); 
     156            } catch (Exception e) { 
     157                log.warn("EventType [{}] has no count (table probably does not exist yet, no problem)", eventType); 
     158            } 
     159        } 
     160        capabilities.setEventsPerType(eventsPerType); 
     161    } 
     162 
     163    private void addEventDateInformation() { 
     164        log.debug("Adding event dates to capabilities"); 
     165        DateTime latest = 
     166                (DateTime) storageEngine.getEventHandler().queryUnique("SELECT max(eventTime) from Event", null); 
     167        DateTime earliest = 
     168                (DateTime) storageEngine.getEventHandler().queryUnique("SELECT min(eventTime) from Event", null); 
     169        if (latest != null && earliest != null) { 
     170            capabilities.setLatestEventTime(new Date(latest.getMillis())); 
     171            capabilities.setEarliestEventTime(new Date(earliest.getMillis())); 
     172        } 
     173    } 
     174 
     175    private void addResourceInformation() { 
     176        log.debug("Adding resource metadata to capabilities"); 
     177        List<ResourceMetadata> resourceMetadata = 
     178                (List<ResourceMetadata>) storageEngine.getEventHandler().query("from ResourceMetadata", null); 
     179        log.debug("Setting {} resource metadata(s)", resourceMetadata.size()); 
     180        Collections.sort(resourceMetadata, new ResourceMetadataComparator()); 
     181        capabilities.setResourceMetadata(resourceMetadata); 
     182    } 
     183 
     184    /** 
     185     * @param excludeFieldNames the excludeFieldNames to set 
     186     */ 
     187    public void setExcludeFieldNames(Set<String> excludeFieldNames) { 
     188        this.excludeFieldNames = excludeFieldNames; 
     189    } 
     190 
    22191} 
  • raptor-mua/trunk/src/main/java/uk/ac/cardiff/raptormua/engine/MUAEngine.java

    r1288 r1312  
    2626import org.slf4j.Logger; 
    2727import org.slf4j.LoggerFactory; 
     28import org.springframework.beans.factory.InitializingBean; 
     29import org.springframework.util.Assert; 
    2830 
    2931import uk.ac.cardiff.model.AdministrativeFunction; 
     
    5557 * @author philsmart 
    5658 */ 
    57 public final class MUAEngine { 
     59public final class MUAEngine implements InitializingBean { 
    5860 
    5961    /** Class logger. */ 
     
    101103        log.info("Setup Multi-Unit Aggregator Engine..."); 
    102104        maxReleaseEventSize = 100; 
     105 
     106    } 
     107 
     108    /** 
     109     * After properties have been set, check for required dependencies and construct an initial capabilities. 
     110     */ 
     111    public void afterPropertiesSet() { 
     112        Assert.notNull(capabilitiesConstructor, 
     113                "No Capabilities constructor found, this is a FATAL error, please add one to the engine in mua-core.xml"); 
     114        capabilitiesConstructor.initialiseCapabilities(); 
    103115        log.info("Mulit-Unit Aggregator Engine is running..."); 
     116 
    104117    } 
    105118 
     
    177190     */ 
    178191    public final Capabilities getCapabilities() { 
    179         if (capabilitiesConstructor != null) 
    180             return capabilitiesConstructor.constructCapabilities(statisticsHandler, storageEngine, muaMetadata); 
    181         else 
     192        if (capabilitiesConstructor != null) { 
     193            return capabilitiesConstructor.getCapabilities(); 
     194        } else { 
    182195            log.error("No Capabilities constructor found, this is a FATAL error, please add one to the engine in mua-core.xml"); 
     196        } 
    183197        return null; 
    184198    } 
     
    270284 
    271285    /** 
    272      * Update the statistical unit described in <code>statisticalUnitInformation</code>. Invalidate the capabilities cache, as 
    273      * statistical unit has changed. 
     286     * Update the statistical unit described in <code>statisticalUnitInformation</code>. Invalidate the capabilities 
     287     * cache, as statistical unit has changed. 
    274288     *  
    275289     * @param statisticalUnitInformation the statistical unit information 
  • raptor-mua/trunk/test-output/Default suite/Default test.html

    r1211 r1312  
    5858<td>Tests passed/Failed/Skipped:</td><td>1/0/0</td> 
    5959</tr><tr> 
    60 <td>Started on:</td><td>Mon Dec 05 18:41:40 GMT 2011</td> 
     60<td>Started on:</td><td>Wed Dec 14 22:04:13 GMT 2011</td> 
    6161</tr> 
    62 <tr><td>Total time:</td><td>6 seconds (6780 ms)</td> 
     62<tr><td>Total time:</td><td>27 seconds (27917 ms)</td> 
    6363</tr><tr> 
    6464<td>Included groups:</td><td></td> 
     
    7676</tr> 
    7777<tr> 
    78 <td title='uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest.instantiateSamlMetadataTest()'><b>instantiateSamlMetadataTest</b><br>Test class: uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest</td> 
     78<td title='uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.queueCapabilitiesTest()'><b>queueCapabilitiesTest</b><br>Test class: uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest</td> 
    7979<td></td> 
    80 <td>6</td> 
    81 <td>uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest@11a06e38</td></tr> 
     80<td>20</td> 
     81<td>uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest@627a4489</td></tr> 
    8282</table><p> 
    8383</body> 
  • raptor-mua/trunk/test-output/Default suite/Default test.xml

    r1211 r1312  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <!-- Generated by org.testng.reporters.JUnitXMLReporter --> 
    3 <testsuite hostname="ipower.insrv.cf.ac.uk" name="Default test" tests="1" failures="0" timestamp="5 Dec 2011 18:41:47 GMT" time="6.78" errors="0"> 
    4   <testcase name="instantiateSamlMetadataTest" time="6.768" classname="uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest"/> 
     2<testsuite hostname="testkwshibb1.nerc.ac.uk" name="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest" tests="1" failures="0" timestamp="14 Dec 2011 22:04:41 GMT" time="27.917" errors="0"> 
     3  <testcase name="queueCapabilitiesTest" time="20.014" classname="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest"/> 
    54</testsuite> 
  • raptor-mua/trunk/test-output/Default suite/classes.html

    r1211 r1312  
    55<th>Groups</th> 
    66</tr><tr> 
    7 <td>uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest</td> 
     7<td>uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest</td> 
    88<td>&nbsp;</td><td>&nbsp;</td></tr> 
    99<tr> 
     
    1212<tr> 
    1313<td>&nbsp;</td> 
    14 <td>instantiateSamlMetadataTest</td> 
     14<td>queueCapabilitiesTest</td> 
    1515<td>&nbsp;</td></tr> 
    1616<tr> 
     
    1818</tr> 
    1919<tr> 
     20<td>&nbsp;</td> 
     21<td>springTestContextBeforeTestClass</td> 
     22<td>&nbsp;</td></tr> 
     23<tr> 
     24<td>&nbsp;</td> 
     25<td>springTestContextPrepareTestInstance</td> 
     26<td>&nbsp;</td></tr> 
     27<tr> 
    2028<td align='center' colspan='3'>@BeforeMethod</td> 
    2129</tr> 
     30<tr> 
     31<td>&nbsp;</td> 
     32<td>springTestContextBeforeTestMethod</td> 
     33<td>&nbsp;</td></tr> 
     34<tr> 
     35<td>&nbsp;</td> 
     36<td>testInitialised</td> 
     37<td>&nbsp;</td></tr> 
    2238<tr> 
    2339<td align='center' colspan='3'>@AfterMethod</td> 
    2440</tr> 
    2541<tr> 
     42<td>&nbsp;</td> 
     43<td>springTestContextAfterTestMethod</td> 
     44<td>&nbsp;</td></tr> 
     45<tr> 
    2646<td align='center' colspan='3'>@AfterClass</td> 
    2747</tr> 
     48<tr> 
     49<td>&nbsp;</td> 
     50<td>springTestContextAfterTestClass</td> 
     51<td>&nbsp;</td></tr> 
    2852</table> 
  • raptor-mua/trunk/test-output/Default suite/methods-alphabetical.html

    r1211 r1312  
    22<table border="1"> 
    33<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr> 
    4 <tr bgcolor="9e8f77">  <td>11/12/05 18:41:40</td>   <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="SamlMetadataNameFormatterTest.instantiateSamlMetadataTest()[pri:0, instance:uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest@11a06e38]">instantiateSamlMetadataTest</td>  
    5   <td>main@1953619005</td>   <td></td> </tr> 
     4<tr bgcolor="aaf0b3">  <td>11/12/14 22:04:21</td>   <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.queueCapabilitiesTest()">queueCapabilitiesTest</td>  
     5  <td>main@1583515396</td>   <td></td> </tr> 
     6<tr bgcolor="b3919f">  <td>11/12/14 22:04:41</td>   <td>20016</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextAfterTestClass()">&lt;&lt;springTestContextAfterTestClass</td>  
     7<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     8<tr bgcolor="b3919f">  <td>11/12/14 22:04:41</td>   <td>20015</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextAfterTestMethod(java.lang.reflect.Method)">&lt;&lt;springTestContextAfterTestMethod</td>  
     9<td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     10<tr bgcolor="b3919f">  <td>11/12/14 22:04:13</td>   <td>-7885</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextBeforeTestClass()">&gt;&gt;springTestContextBeforeTestClass</td>  
     11<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     12<tr bgcolor="b3919f">  <td>11/12/14 22:04:21</td>   <td>-1</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextBeforeTestMethod(java.lang.reflect.Method)">&gt;&gt;springTestContextBeforeTestMethod</td>  
     13<td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     14<tr bgcolor="b3919f">  <td>11/12/14 22:04:13</td>   <td>-7881</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance()">&gt;&gt;springTestContextPrepareTestInstance</td>  
     15<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     16<tr bgcolor="aaf0b3">  <td>11/12/14 22:04:21</td>   <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.testInitialised()">&gt;&gt;testInitialised</td>  
     17<td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
    618</table> 
  • raptor-mua/trunk/test-output/Default suite/methods.html

    r1211 r1312  
    22<table border="1"> 
    33<tr><th>Time</th><th>Delta (ms)</th><th>Suite<br>configuration</th><th>Test<br>configuration</th><th>Class<br>configuration</th><th>Groups<br>configuration</th><th>Method<br>configuration</th><th>Test<br>method</th><th>Thread</th><th>Instances</th></tr> 
    4 <tr bgcolor="9e8f77">  <td>11/12/05 18:41:40</td>   <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="SamlMetadataNameFormatterTest.instantiateSamlMetadataTest()[pri:0, instance:uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest@11a06e38]">instantiateSamlMetadataTest</td>  
    5   <td>main@1953619005</td>   <td></td> </tr> 
     4<tr bgcolor="b3919f">  <td>11/12/14 22:04:13</td>   <td>0</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextBeforeTestClass()">&gt;&gt;springTestContextBeforeTestClass</td>  
     5<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     6<tr bgcolor="b3919f">  <td>11/12/14 22:04:13</td>   <td>4</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance()">&gt;&gt;springTestContextPrepareTestInstance</td>  
     7<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     8<tr bgcolor="b3919f">  <td>11/12/14 22:04:21</td>   <td>7884</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextBeforeTestMethod(java.lang.reflect.Method)">&gt;&gt;springTestContextBeforeTestMethod</td>  
     9<td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     10<tr bgcolor="aaf0b3">  <td>11/12/14 22:04:21</td>   <td>7885</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&gt;&gt;uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.testInitialised()">&gt;&gt;testInitialised</td>  
     11<td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     12<tr bgcolor="aaf0b3">  <td>11/12/14 22:04:21</td>   <td>7885</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.queueCapabilitiesTest()">queueCapabilitiesTest</td>  
     13  <td>main@1583515396</td>   <td></td> </tr> 
     14<tr bgcolor="b3919f">  <td>11/12/14 22:04:41</td>   <td>27900</td> <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextAfterTestMethod(java.lang.reflect.Method)">&lt;&lt;springTestContextAfterTestMethod</td>  
     15<td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
     16<tr bgcolor="b3919f">  <td>11/12/14 22:04:41</td>   <td>27901</td> <td>&nbsp;</td><td>&nbsp;</td><td title="&lt;&lt;org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextAfterTestClass()">&lt;&lt;springTestContextAfterTestClass</td>  
     17<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  <td>main@1583515396</td>   <td></td> </tr> 
    618</table> 
  • raptor-mua/trunk/test-output/Default suite/testng.xml.html

    r1211 r1312  
    1 <html><head><title>testng.xml for Default suite</title></head><body><tt>&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;<br/>&lt;!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"http://testng.org/testng-1.0.dtd"&gt;<br/>&lt;suite&nbsp;name="Default&nbsp;suite"&gt;<br/>&nbsp;&nbsp;&lt;test&nbsp;verbose="2"&nbsp;name="Default&nbsp;test"&nbsp;preserve-order="true"&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest"/&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;<br/>&nbsp;&nbsp;&lt;/test&gt;<br/>&lt;/suite&gt;<br/></tt></body></html> 
     1<html><head><title>testng.xml for Default suite</title></head><body><tt>&lt;?xml&nbsp;version="1.0"&nbsp;encoding="UTF-8"?&gt;<br/>&lt;!DOCTYPE&nbsp;suite&nbsp;SYSTEM&nbsp;"http://testng.org/testng-1.0.dtd"&gt;<br/>&lt;suite&nbsp;verbose="0"&nbsp;name="Default&nbsp;suite"&gt;<br/>&nbsp;&nbsp;&lt;test&nbsp;verbose="2"&nbsp;name="Default&nbsp;test"&nbsp;preserve-order="false"&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classes&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;class&nbsp;name="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest"/&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;/classes&gt;<br/>&nbsp;&nbsp;&lt;/test&gt;<br/>&lt;/suite&gt;<br/></tt></body></html> 
  • raptor-mua/trunk/test-output/emailable-report.html

    r1211 r1312  
    3030<table cellspacing=0 cellpadding=0 class="param"> 
    3131<tr><th>Test</th><th class="numi">Methods<br/>Passed</th><th class="numi">Scenarios<br/>Passed</th><th class="numi"># skipped</th><th class="numi"># failed</th><th class="numi">Total<br/>Time</th><th class="numi">Included<br/>Groups</th><th class="numi">Excluded<br/>Groups</th></tr> 
    32 <tr><td style="text-align:left;padding-right:2em">Default test</td><td class="numi">1</td><td class="numi">1</td><td class="numi">0</td><td class="numi">0</td><td class="numi">6.8 seconds</td><td class="numi"></td><td class="numi"></td></tr> 
     32<tr><td style="text-align:left;padding-right:2em">Default test</td><td class="numi">1</td><td class="numi">1</td><td class="numi">0</td><td class="numi">0</td><td class="numi">27.9 seconds</td><td class="numi"></td><td class="numi"></td></tr> 
    3333</table> 
    3434<a id="summary"></a> 
     
    3636<tr><th>Class</th><th>Method</th><th># of<br/>Scenarios</th><th>Time<br/>(Msecs)</th></tr> 
    3737<tr><th colspan="4">Default test &#8212; passed</th></tr> 
    38 <tr class="passedodd"><td rowspan="1">uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest<td><a href="#m1"><b>instantiateSamlMetadataTest</b>  </a></td><td class="numi">1</td><td class="numi">6768</td></tr> 
     38<tr class="passedodd"><td rowspan="1">uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest<td><a href="#m1"><b>queueCapabilitiesTest</b>  </a></td><td class="numi">1</td><td class="numi">20014</td></tr> 
    3939</table> 
    4040<h1>Default test</h1> 
    41 <a id="m1"></a><h2>uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest:instantiateSamlMetadataTest</h2> 
     41<a id="m1"></a><h2>uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest:queueCapabilitiesTest</h2> 
    4242<p class="totop"><a href="#summary">back to summary</a></p> 
    4343</body></html> 
  • raptor-mua/trunk/test-output/testng-results.xml

    r1211 r1312  
    33  <reporter-output> 
    44  </reporter-output> 
    5   <suite name="Default suite" duration-ms="6780" started-at="2011-12-05T18:41:40Z" finished-at="2011-12-05T18:41:47Z"> 
     5  <suite name="Default suite" duration-ms="27917" started-at="2011-12-14T22:04:13Z" finished-at="2011-12-14T22:04:41Z"> 
    66    <groups> 
    77    </groups> 
    8     <test name="Default test" duration-ms="6780" started-at="2011-12-05T18:41:40Z" finished-at="2011-12-05T18:41:47Z"> 
    9       <class name="uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest"> 
    10         <test-method status="PASS" signature="instantiateSamlMetadataTest()[pri:0, instance:uk.ac.cardiff.raptormua.engine.statistics.processor.SamlMetadataNameFormatterTest@11a06e38]" name="instantiateSamlMetadataTest" duration-ms="6768" started-at="2011-12-05T18:41:40Z" finished-at="2011-12-05T18:41:47Z"> 
     8    <test name="Default test" duration-ms="27917" started-at="2011-12-14T22:04:13Z" finished-at="2011-12-14T22:04:41Z"> 
     9      <class name="uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest"> 
     10        <test-method status="PASS" signature="springTestContextBeforeTestClass()" name="springTestContextBeforeTestClass" is-config="true" duration-ms="6" started-at="2011-12-14T22:04:13Z" finished-at="2011-12-14T22:04:13Z"> 
     11        </test-method> 
     12        <test-method status="PASS" signature="springTestContextPrepareTestInstance()" name="springTestContextPrepareTestInstance" is-config="true" duration-ms="7877" started-at="2011-12-14T22:04:13Z" depends-on-methods="org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextBeforeTestClass" finished-at="2011-12-14T22:04:21Z"> 
     13        </test-method> 
     14        <test-method status="PASS" signature="springTestContextBeforeTestMethod(java.lang.reflect.Method)" name="springTestContextBeforeTestMethod" is-config="true" duration-ms="0" started-at="2011-12-14T22:04:21Z" finished-at="2011-12-14T22:04:21Z"> 
     15          <params> 
     16            <param index="0"> 
     17              <value> 
     18                <![CDATA[public void uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.queueCapabilitiesTest() throws java.lang.InterruptedException]]> 
     19              </value> 
     20            </param> 
     21          </params> 
     22        </test-method> 
     23        <test-method status="PASS" signature="testInitialised()" name="testInitialised" is-config="true" duration-ms="1" started-at="2011-12-14T22:04:21Z" finished-at="2011-12-14T22:04:21Z"> 
     24        </test-method> 
     25        <test-method status="PASS" signature="queueCapabilitiesTest()" name="queueCapabilitiesTest" duration-ms="20014" started-at="2011-12-14T22:04:21Z" finished-at="2011-12-14T22:04:41Z"> 
     26        </test-method> 
     27        <test-method status="PASS" signature="springTestContextAfterTestMethod(java.lang.reflect.Method)" name="springTestContextAfterTestMethod" is-config="true" duration-ms="1" started-at="2011-12-14T22:04:41Z" finished-at="2011-12-14T22:04:41Z"> 
     28          <params> 
     29            <param index="0"> 
     30              <value> 
     31                <![CDATA[public void uk.ac.cardiff.raptormua.engine.CapabilitiesConstructorTest.queueCapabilitiesTest() throws java.lang.InterruptedException]]> 
     32              </value> 
     33            </param> 
     34          </params> 
     35        </test-method> 
     36        <test-method status="PASS" signature="springTestContextAfterTestClass()" name="springTestContextAfterTestClass" is-config="true" duration-ms="0" started-at="2011-12-14T22:04:41Z" finished-at="2011-12-14T22:04:41Z"> 
    1137        </test-method> 
    1238      </class> 
Note: See TracChangeset for help on using the changeset viewer.