示例#1
0
        /// <exception cref="Exception"></exception>
        private void populateData()
        {
            AppSensorClient appSensorClient = (AppSensorClient)contextClient.GetObject("AppSensorClient");
            AppSensorServer appSensorServer = (AppSensorServer)contextServer.GetObject("AppSensorServer");
            int             delay           = 500;

            detectionPoint1.setId("IE1");
            detectionSystems1.Add(detectionSystem1);

            ServerConfiguration updatedConfiguration = appSensorServer.getConfiguration();

            updatedConfiguration.setDetectionPoints(loadMockedDetectionPoints());
            appSensorServer.setConfiguration(updatedConfiguration);

            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
            appSensorClient.getEventManager().addEvent(new Event(bob, detectionPoint1, "localhostme"));
            Thread.Sleep(delay);
        }
        public void deleteTestFiles()
        {
            //IApplicationContext context = new XmlApplicationContext("Resources/base-context.xml", "Resources/appsensor-server-config.xml");
            IApplicationContext context         = new XmlApplicationContext("Resources/base-context.xml", "Resources/appsensor-server-config.xml");
            AppSensorServer     appSensorServer = (AppSensorServer)context.GetObject("AppSensorServer");

            FileBasedEventStore    eventStore    = (FileBasedEventStore)appSensorServer.getEventStore();
            FileBasedAttackStore   attackStore   = (FileBasedAttackStore)appSensorServer.getAttackStore();
            FileBasedResponseStore responseStore = (FileBasedResponseStore)appSensorServer.getResponseStore();

            File.Delete(eventStore.getPath());
            File.Delete(attackStore.getPath());
            File.Delete(responseStore.getPath());
        }