// Path: perseo-main/src/test/java/com/telefonica/iot/perseo/test/EventBeanMock.java
// public class EventBeanMock implements EventBean {
// 
//     private Map<String,String> properties;
// 
//     public EventBeanMock(Map props) {
//         this.properties = props;
//     }
// 
//     EventType et = new EventType() {
// 
//         @Override
//         public Class getPropertyType(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public boolean isProperty(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyGetter getGetter(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public FragmentEventType getFragmentType(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public Class getUnderlyingType() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String[] getPropertyNames() {
//             return properties.keySet().toArray(new String[0]);
//         }
// 
//         @Override
//         public EventPropertyDescriptor[] getPropertyDescriptors() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyDescriptor getPropertyDescriptor(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventType[] getSuperTypes() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public Iterator<EventType> getDeepSuperTypes() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String getName() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyGetterMapped getGetterMapped(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyGetterIndexed getGetterIndexed(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String getStartTimestampPropertyName() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String getEndTimestampPropertyName() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventTypeMetadata getMetadata() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public java.util.Set<EventType> getDeepSuperTypesAsSet(){
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         // To be used with Esper 8.7
//         // @Override
//         // public EPTypeClass getUnderlyingEPType() {
//         //     throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         // }
// 
//         // @Override
//         // public EPType getPropertyEPType(java.lang.String string) {
//         //     throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         // }
//         };
// 
//     @Override
//     public EventType getEventType() {
//         return et;
//     }
// 
//     @Override
//     public Object get(String string) throws PropertyAccessException {
//         return properties.get(string);
//     }
// 
//     @Override
//     public Object getUnderlying() {
//         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//     }
// 
// 
// 
//     @Override
//     public Object getFragment(String string) throws PropertyAccessException {
//         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//     }
// }


import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.espertech.esper.common.client.EventBean;
import com.telefonica.iot.perseo.test.EventBeanMock;
import com.espertech.esper.runtime.client.EPStatement;
import com.espertech.esper.runtime.client.EPRuntime;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
    @After
    public void tearDown() {
    }

    /**
     * Test of update method, of class GenericListener.
     */
    @Test
    public void testUpdate() {
        logger.info("update");
        EventBean[] newEvents = new EventBean[0];
        EventBean[] oldEvents = new EventBean[0];
        GenericListener instance = new GenericListener();
        instance.update(newEvents, oldEvents, null, null);
        HashMap<String, Object> m = new HashMap();
        m.put("one", "1");
        m.put("two", 2);
        EventBean event = new EventBeanMock(m);
        newEvents = new EventBean[]{event};
        instance.update(newEvents, oldEvents, null, null);
    }

    /**
     * Test update method with timed rule.
     */
    @Test
    public void testUpdateTimerRule() {
        logger.info("update with timed rule");
        // Add RuleTest in TimeRulesStore Singleton
        TimeRulesStore tRInfoInstance = TimeRulesStore.getInstance();
// Path: perseo-main/src/test/java/com/telefonica/iot/perseo/test/EventBeanMock.java
// public class EventBeanMock implements EventBean {
// 
//     private Map<String,String> properties;
// 
//     public EventBeanMock(Map props) {
//         this.properties = props;
//     }
// 
//     EventType et = new EventType() {
// 
//         @Override
//         public Class getPropertyType(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public boolean isProperty(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyGetter getGetter(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public FragmentEventType getFragmentType(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public Class getUnderlyingType() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String[] getPropertyNames() {
//             return properties.keySet().toArray(new String[0]);
//         }
// 
//         @Override
//         public EventPropertyDescriptor[] getPropertyDescriptors() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyDescriptor getPropertyDescriptor(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventType[] getSuperTypes() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public Iterator<EventType> getDeepSuperTypes() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String getName() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyGetterMapped getGetterMapped(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventPropertyGetterIndexed getGetterIndexed(String string) {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String getStartTimestampPropertyName() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public String getEndTimestampPropertyName() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public EventTypeMetadata getMetadata() {
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         @Override
//         public java.util.Set<EventType> getDeepSuperTypesAsSet(){
//             throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         }
// 
//         // To be used with Esper 8.7
//         // @Override
//         // public EPTypeClass getUnderlyingEPType() {
//         //     throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         // }
// 
//         // @Override
//         // public EPType getPropertyEPType(java.lang.String string) {
//         //     throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//         // }
//         };
// 
//     @Override
//     public EventType getEventType() {
//         return et;
//     }
// 
//     @Override
//     public Object get(String string) throws PropertyAccessException {
//         return properties.get(string);
//     }
// 
//     @Override
//     public Object getUnderlying() {
//         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//     }
// 
// 
// 
//     @Override
//     public Object getFragment(String string) throws PropertyAccessException {
//         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
//     }
// }


// Path: perseo-main/src/test/java/com/telefonica/iot/perseo/GenericListenerTest.java
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.espertech.esper.common.client.EventBean;
import com.telefonica.iot.perseo.test.EventBeanMock;
import com.espertech.esper.runtime.client.EPStatement;
import com.espertech.esper.runtime.client.EPRuntime;
import java.util.HashMap;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;

    @After
    public void tearDown() {
    }

    /**
     * Test of update method, of class GenericListener.
     */
    @Test
    public void testUpdate() {
        logger.info("update");
        EventBean[] newEvents = new EventBean[0];
        EventBean[] oldEvents = new EventBean[0];
        GenericListener instance = new GenericListener();
        instance.update(newEvents, oldEvents, null, null);
        HashMap<String, Object> m = new HashMap();
        m.put("one", "1");
        m.put("two", 2);
        EventBean event = new EventBeanMock(m);
        newEvents = new EventBean[]{event};
        instance.update(newEvents, oldEvents, null, null);
    }

    /**
     * Test update method with timed rule.
     */
    @Test
    public void testUpdateTimerRule() {
        logger.info("update with timed rule");
        // Add RuleTest in TimeRulesStore Singleton
        TimeRulesStore tRInfoInstance = TimeRulesStore.getInstance();
        tRInfoInstance.cleanAllRules();