ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1528378 [2/2] - in /ace/trunk: org.apache.ace.agent/src/org/apache/ace/agent/impl/ org.apache.ace.agent/test/org/apache/ace/agent/impl/ org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ org.apache.ace.client.reposit...
Date Wed, 02 Oct 2013 08:54:51 GMT
Modified: ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java (original)
+++ ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java Wed
Oct  2 08:54:50 2013
@@ -137,10 +137,10 @@ public class LogIntegrationTest extends 
     private void doTestServlet() throws Exception {
         // prepare the store
         List<Event> events = new ArrayList<Event>();
-        events.add(new Event("42", 1, 1, 1, 1, new Properties()));
-        events.add(new Event("47", 1, 1, 1, 1, new Properties()));
-        events.add(new Event("47", 2, 1, 1, 1, new Properties()));
-        events.add(new Event("47", 2, 2, 1, 1, new Properties()));
+        events.add(new Event("42", 1, 1, 1, 1));
+        events.add(new Event("47", 1, 1, 1, 1));
+        events.add(new Event("47", 2, 1, 1, 1));
+        events.add(new Event("47", 2, 2, 1, 1));
         m_serverStore.put(events);
 
         List<String> result = getResponse("http://localhost:" + TestConstants.PORT
+ "/auditlog/query");

Modified: ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
(original)
+++ ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
Wed Oct  2 08:54:50 2013
@@ -20,8 +20,9 @@ package org.apache.ace.log.server.store.
 
 import java.io.IOException;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import org.amdatu.mongo.MongoDBService;
@@ -128,8 +129,8 @@ public class MongoLogStoreTest extends I
 
 			storeEvents();
 
-			Properties props = new Properties();
-			props.setProperty("myProperty", "myvalue");
+	        Map<String, String> props = new HashMap<String, String>();
+			props.put("myProperty", "myvalue");
 
 			Event event1 = new Event("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
 			Event event2 = new Event("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
@@ -162,8 +163,8 @@ public class MongoLogStoreTest extends I
 
 			storeEvents();
 
-			Properties props = new Properties();
-			props.setProperty("myProperty", "myvalue");
+            Map<String, String> props = new HashMap<String, String>();
+			props.put("myProperty", "myvalue");
 
 			Event event1 = new Event("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
 			Event event2 = new Event("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
@@ -185,8 +186,8 @@ public class MongoLogStoreTest extends I
 	}
 
 	private void storeEvents() throws IOException {
-		Properties props = new Properties();
-		props.setProperty("myProperty", "myvalue");
+        Map<String, String> props = new HashMap<String, String>();
+		props.put("myProperty", "myvalue");
 		Event event1 = new Event("mytarget1", 1, 1, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
 		Event event2 = new Event("mytarget1", 1, 2, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
 		Event event3 = new Event("mytarget2", 1, 3, System.currentTimeMillis(), LogService.LOG_ERROR,
props);

Modified: ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java
(original)
+++ ace/trunk/org.apache.ace.log.server.ui/src/org/apache/ace/log/server/ui/LogViewerExtension.java
Wed Oct  2 08:54:50 2013
@@ -24,8 +24,6 @@ import java.lang.reflect.Modifier;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
-import java.util.Dictionary;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -182,7 +180,7 @@ public class LogViewerExtension implemen
      * @return a {@link TextArea} instance, never <code>null</code>.
      */
     final TextArea getProperties(Event event) {
-        Dictionary props = event.getProperties();
+        Map<String, String> props = event.getProperties();
 
         TextArea area = new TextArea("", dumpProperties(props));
         area.setWidth(FILL_AREA);
@@ -200,17 +198,15 @@ public class LogViewerExtension implemen
     /**
      * Dumps the given dictionary to a string by placing all key,value-pairs on a separate
line.
      * 
-     * @param dict
+     * @param props
      *            the dictionary to dump, may be <code>null</code>.
      * @return a string dump of all properties in the given dictionary, never <code>null</code>.
      */
-    private String dumpProperties(Dictionary dict) {
+    private String dumpProperties(Map<String, String> props) {
         StringBuilder sb = new StringBuilder();
-        if (dict != null) {
-            Enumeration keys = dict.keys();
-            while (keys.hasMoreElements()) {
-                String key = keys.nextElement().toString();
-                String value = dict.get(key).toString();
+        if (props != null) {
+            for (String key : props.keySet()) {
+                String value = props.get(key);
 
                 if (sb.length() > 0) {
                     sb.append("\n");

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java
(original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/MongoLogStore.java
Wed Oct  2 08:54:50 2013
@@ -2,10 +2,11 @@ package org.apache.ace.log.server.store.
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 import java.util.Set;
 
 import org.amdatu.mongo.MongoDBService;
@@ -23,123 +24,123 @@ import com.mongodb.MapReduceCommand.Outp
 import com.mongodb.MapReduceOutput;
 
 public class MongoLogStore implements LogStore {
-	private final String m_logname;
-	private volatile MongoDBService m_mongoDBService;
+    private final String m_logname;
+    private volatile MongoDBService m_mongoDBService;
 
-	public MongoLogStore(String logname) {
-		this.m_logname = logname;
-	}
-
-	@Override
-	public List<Event> get(Descriptor range) throws IOException {
-		DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
-		long high = range.getRangeSet().getHigh();
-
-		BasicDBObject filter = new BasicDBObject().append("targetId",
-				range.getTargetID()).append("logId", range.getStoreID());
-		if (high > 0) {
-			filter.append("id", new BasicDBObject("$lte", high));
-		}
-
-		DBCursor cursor = collection.find(filter);
-		cursor.sort(new BasicDBObject("id", 1));
-
-		List<Event> Events = new ArrayList<Event>();
-		while (cursor.hasNext()) {
-			DBObject event = cursor.next();
-			String targetId = (String) event.get("targetId");
-			long logId = (Long) event.get("logId");
-			long id = (Long) event.get("id");
-			long time = (Long) event.get("time");
-			int type = (Integer) event.get("type");
-			Properties properties = new Properties();
-			DBObject propertiesDbObject = (DBObject) event.get("properties");
-			for (String key : propertiesDbObject.keySet()) {
-				properties.put(key, propertiesDbObject.get(key));
-			}
-
-			Events.add(new Event(targetId, logId, id, time, type,
-					properties));
-		}
-
-		return Events;
-	}
-
-	@Override
-	public Descriptor getDescriptor(String targetID, long logID)
-			throws IOException {
-
-		DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
-
-		BasicDBObject filter = new BasicDBObject().append("targetId", targetID)
-				.append("logId", logID);
-
-		DBCursor cursor = collection.find(filter);
-		cursor.sort(new BasicDBObject("id", -1));
-
-		long high = 1;
-		if (cursor.hasNext()) {
-			DBObject row = cursor.next();
-			high = (Long) row.get("id");
-			return new Descriptor(targetID, logID, new SortedRangeSet(
-					new Range(1, high).toRepresentation()));
-		} else {
-			return new Descriptor(targetID, logID, SortedRangeSet.FULL_SET);
-		}
-	}
-
-	@Override
-	public void put(List<Event> events) throws IOException {
-		DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
-
-		for (Event event : events) {
-			DBObject dbObject = new BasicDBObject()
-					.append("targetId", event.getTargetID())
-					.append("logId", event.getStoreID())
-					.append("id", event.getID())
-					.append("time", event.getTime())
-					.append("type", event.getType())
-					.append("properties", event.getProperties());
-
-			collection.save(dbObject);
-		}
-	}
-
-	@Override
-	public List<Descriptor> getDescriptors(String targetID)
-			throws IOException {
-		
-		DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
-		String m = "function() {emit(this.targetId,this.logId);}";
-		String r = "function(k, vals) {var result = {target: k, logIds: []}; vals.forEach(function(value)
{ result.logIds.push(value)}); return result;}";
-		DBObject filter = new BasicDBObject();
-		if(targetID != null) {
-			filter.put("targetId", targetID);
-		}
-		MapReduceOutput mapReduce = collection.mapReduce(m, r, null, OutputType.INLINE, filter);
-		Iterator<DBObject> iterator = mapReduce.results().iterator();
-		
-		List<Descriptor> descriptors = new ArrayList<Descriptor>();
-		while(iterator.hasNext()) {
-			DBObject row = iterator.next();
-			DBObject value = (DBObject)row.get("value");
-			String targetId = (String)value.get("target");
-			@SuppressWarnings("unchecked")
-			List<Long> logIds = (List<Long>)value.get("logIds");
-			Set<Long> logIdsFiltered = new HashSet<Long>();
-			logIdsFiltered.addAll(logIds);
-			
-			for (long logId : logIdsFiltered) {
-				descriptors.add(getDescriptor(targetId, logId));
-			}
-		}
-		
-		return descriptors;
-	}
-
-	@Override
-	public List<Descriptor> getDescriptors() throws IOException {
-		return getDescriptors(null);
-	}
+    public MongoLogStore(String logname) {
+        this.m_logname = logname;
+    }
+
+    @Override
+    public List<Event> get(Descriptor range) throws IOException {
+        DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
+        long high = range.getRangeSet().getHigh();
+
+        BasicDBObject filter = new BasicDBObject().append("targetId", range.getTargetID()).append("logId",
range.getStoreID());
+        if (high > 0) {
+            filter.append("id", new BasicDBObject("$lte", high));
+        }
+
+        DBCursor cursor = collection.find(filter);
+        cursor.sort(new BasicDBObject("id", 1));
+
+        List<Event> Events = new ArrayList<Event>();
+        while (cursor.hasNext()) {
+            DBObject event = cursor.next();
+            String targetId = (String) event.get("targetId");
+            long logId = (Long) event.get("logId");
+            long id = (Long) event.get("id");
+            long time = (Long) event.get("time");
+            int type = (Integer) event.get("type");
+            
+            Map<String, String> properties = new HashMap<String, String>();
+            DBObject propertiesDbObject = (DBObject) event.get("properties");
+            for (String key : propertiesDbObject.keySet()) {
+                properties.put(key, (String) propertiesDbObject.get(key));
+            }
+
+            Events.add(new Event(targetId, logId, id, time, type, properties));
+        }
+
+        return Events;
+    }
+
+    @Override
+    public Descriptor getDescriptor(String targetID, long logID)
+        throws IOException {
+
+        DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
+
+        BasicDBObject filter = new BasicDBObject().append("targetId", targetID)
+            .append("logId", logID);
+
+        DBCursor cursor = collection.find(filter);
+        cursor.sort(new BasicDBObject("id", -1));
+
+        long high = 1;
+        if (cursor.hasNext()) {
+            DBObject row = cursor.next();
+            high = (Long) row.get("id");
+            return new Descriptor(targetID, logID, new SortedRangeSet(
+                new Range(1, high).toRepresentation()));
+        }
+        else {
+            return new Descriptor(targetID, logID, SortedRangeSet.FULL_SET);
+        }
+    }
+
+    @Override
+    public void put(List<Event> events) throws IOException {
+        DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
+
+        for (Event event : events) {
+            DBObject dbObject = new BasicDBObject()
+                .append("targetId", event.getTargetID())
+                .append("logId", event.getStoreID())
+                .append("id", event.getID())
+                .append("time", event.getTime())
+                .append("type", event.getType())
+                .append("properties", event.getProperties());
+
+            collection.save(dbObject);
+        }
+    }
+
+    @Override
+    public List<Descriptor> getDescriptors(String targetID)
+        throws IOException {
+
+        DBCollection collection = m_mongoDBService.getDB().getCollection(m_logname);
+        String m = "function() {emit(this.targetId,this.logId);}";
+        String r = "function(k, vals) {var result = {target: k, logIds: []}; vals.forEach(function(value)
{ result.logIds.push(value)}); return result;}";
+        DBObject filter = new BasicDBObject();
+        if (targetID != null) {
+            filter.put("targetId", targetID);
+        }
+        MapReduceOutput mapReduce = collection.mapReduce(m, r, null, OutputType.INLINE, filter);
+        Iterator<DBObject> iterator = mapReduce.results().iterator();
+
+        List<Descriptor> descriptors = new ArrayList<Descriptor>();
+        while (iterator.hasNext()) {
+            DBObject row = iterator.next();
+            DBObject value = (DBObject) row.get("value");
+            String targetId = (String) value.get("target");
+            @SuppressWarnings("unchecked")
+            List<Long> logIds = (List<Long>) value.get("logIds");
+            Set<Long> logIdsFiltered = new HashSet<Long>();
+            logIdsFiltered.addAll(logIds);
+
+            for (long logId : logIdsFiltered) {
+                descriptors.add(getDescriptor(targetId, logId));
+            }
+        }
+
+        return descriptors;
+    }
+
+    @Override
+    public List<Descriptor> getDescriptors() throws IOException {
+        return getDescriptors(null);
+    }
 
 }

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java
(original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/target/store/impl/LogStoreImpl.java
Wed Oct  2 08:54:50 2013
@@ -24,10 +24,13 @@ import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.util.ArrayList;
 import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
-import org.apache.ace.identification.Identification;
 import org.apache.ace.feedback.Event;
+import org.apache.ace.identification.Identification;
 import org.apache.ace.log.target.store.LogStore;
 import org.osgi.service.log.LogService;
 
@@ -245,14 +248,21 @@ public class LogStoreImpl implements Log
      * 
      * @param type
      *            the type the event.
-     * @param props
+     * @param dict
      *            the properties of the event.
      * @return the new event.
      * @throws java.io.IOException
      *             in case of any IO error.
      */
-    public synchronized Event put(int type, Dictionary props) throws IOException {
+    public synchronized Event put(int type, Dictionary dict) throws IOException {
         try {
+            Map<String, String> props = new HashMap<String, String>();
+            Enumeration keys = dict.keys();
+            while (keys.hasMoreElements()) {
+                String key = (String) keys.nextElement();
+                props.put(key, (String) dict.get(key));
+            }
+            
             Event result = new Event(null, m_store.getId(), getNextID(), System.currentTimeMillis(),
type, props);
             m_store.append(result.getID(), result.toRepresentation().getBytes());
             return result;

Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java (original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/LogEventTest.java Wed Oct  2 08:54:50
2013
@@ -20,8 +20,8 @@ package org.apache.ace.log;
 
 import static org.apache.ace.test.utils.TestUtils.UNIT;
 
-import java.util.Dictionary;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.ace.feedback.AuditEvent;
 import org.apache.ace.feedback.Event;
@@ -30,13 +30,13 @@ import org.testng.annotations.Test;
 public class LogEventTest {
     @Test(groups = { UNIT })
     public void serializeLogEvent() {
-        Event e = new Event("gwid", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED, new Properties());
+        Event e = new Event("gwid", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
         assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
-        Properties p = new Properties();
+        Map<String, String> p = new HashMap<String, String>();
         p.put(AuditEvent.KEY_ID, "my first value");
         e = new Event("gwid", 1, 2, 3, AuditEvent.BUNDLE_INSTALLED, p);
         assert e.toRepresentation().equals("gwid,1,2,3," + AuditEvent.BUNDLE_INSTALLED +
"," + AuditEvent.KEY_ID + ",my first value");
-        e = new Event("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED, new Properties());
+        e = new Event("gwid,gwid\n\r$", 1, 2, 3, AuditEvent.FRAMEWORK_STARTED);
         assert e.toRepresentation().equals("gwid$kgwid$n$r$$,1,2,3," + AuditEvent.FRAMEWORK_STARTED);
     }
 
@@ -49,12 +49,13 @@ public class LogEventTest {
         assert e.getID() == 2 : "ID is not correctly parsed";
         assert e.getTime() == 3 : "Time is not correctly parsed";
         assert e.getType() == AuditEvent.FRAMEWORK_STARTED : "Event type is wrong";
-        Dictionary p = e.getProperties();
+        Map<String, String> p = e.getProperties();
         assert p != null : "Properties are not correctly parsed";
         assert p.get("a").equals("1") : "Property a should be 1";
         assert p.get("b").equals("2") : "Property a should be 1";
         assert p.get("c").equals("3") : "Property a should be 1";
     }
+
     @Test(groups = { UNIT })
     public void deserializeIllegalLogEvent() {
         try {

Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
(original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
Wed Oct  2 08:54:50 2013
@@ -24,14 +24,12 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Properties;
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
 
 import org.apache.ace.feedback.Descriptor;
 import org.apache.ace.feedback.Event;
-import org.apache.ace.log.server.servlet.LogServlet;
 import org.apache.ace.log.server.store.LogStore;
 import org.apache.ace.range.SortedRangeSet;
 import org.apache.ace.test.utils.TestUtils;
@@ -44,8 +42,8 @@ public class LogServletTest {
 
     private LogServlet m_logServlet;
     private Descriptor m_range = new Descriptor("tID", 123, new SortedRangeSet("1-3"));
-    private Event m_event1 = new Event("tID", 123, 1, 888888, 1, new Properties());
-    private Event m_event2 = new Event("tID", 123, 2, 888888, 2, new Properties());
+    private Event m_event1 = new Event("tID", 123, 1, 888888, 1);
+    private Event m_event2 = new Event("tID", 123, 2, 888888, 2);
     private MockLogStore m_mockStore;
 
     @BeforeMethod(alwaysRun = true)

Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
(original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
Wed Oct  2 08:54:50 2013
@@ -23,15 +23,15 @@ import static org.apache.ace.test.utils.
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Properties;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.ace.feedback.AuditEvent;
 import org.apache.ace.feedback.Descriptor;
 import org.apache.ace.feedback.Event;
-import org.apache.ace.log.server.store.impl.LogStoreImpl;
 import org.apache.ace.test.utils.TestUtils;
 import org.osgi.service.event.EventAdmin;
 import org.testng.annotations.AfterMethod;
@@ -60,17 +60,16 @@ public class ServerLogStoreTester {
     @SuppressWarnings("serial")
     @Test(groups = { UNIT })
     public void testLog() throws IOException {
+        Map<String, String> props = new HashMap<String, String>();
+        props.put("test", "bar");
+
         List<Descriptor> ranges = m_logStore.getDescriptors();
         assert ranges.isEmpty() : "New store should have no ranges.";
         List<Event> events = new ArrayList<Event>();
         for (String target : new String[] { "g1", "g2", "g3" }) {
             for (long log : new long[] { 1, 2, 3, 5 }) {
                 for (long id : new long[] { 1, 2, 3, 20 }) {
-                    events.add(new Event(target, log, id, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED,
new Properties() {
-                        {
-                            put("test", "bar");
-                        }
-                    }));
+                    events.add(new Event(target, log, id, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED,
props));
                 }
             }
         }
@@ -84,7 +83,7 @@ public class ServerLogStoreTester {
         }
 
         Set<String> in = new HashSet<String>();
-        for (Event event : events)  {
+        for (Event event : events) {
             in.add(event.toRepresentation());
         }
         Set<String> out = new HashSet<String>();
@@ -94,10 +93,10 @@ public class ServerLogStoreTester {
         assert in.equals(out) : "Stored events differ from the added.";
     }
 
-    @Test( groups = { TestUtils.UNIT } )
+    @Test(groups = { TestUtils.UNIT })
     public void testLogWithSpecialCharacters() throws IOException {
         String targetID = "myta\0rget";
-        Event event = new Event(targetID, 1, 1, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED,
new Properties());
+        Event event = new Event(targetID, 1, 1, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED);
         List<Event> events = new ArrayList<Event>();
         events.add(event);
         m_logStore.put(events);

Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java?rev=1528378&r1=1528377&r2=1528378&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java
(original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/target/task/LogSyncTaskTest.java
Wed Oct  2 08:54:50 2013
@@ -28,14 +28,12 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.List;
-import java.util.Properties;
 
 import org.apache.ace.discovery.Discovery;
 import org.apache.ace.feedback.Descriptor;
 import org.apache.ace.feedback.Event;
 import org.apache.ace.identification.Identification;
 import org.apache.ace.log.target.store.LogStore;
-import org.apache.ace.log.target.task.LogSyncTask;
 import org.apache.ace.range.SortedRangeSet;
 import org.apache.ace.test.utils.TestUtils;
 import org.osgi.service.log.LogService;
@@ -82,7 +80,7 @@ public class LogSyncTaskTest {
     @Test(groups = { UNIT })
     public synchronized void synchronizeLog() throws Exception {
         final Descriptor range = new Descriptor(TARGET_ID, 1, new SortedRangeSet(new long[]
{0}));
-        final Event event = new Event(TARGET_ID, 1, 1, 1, 1, new Properties());
+        final Event event = new Event(TARGET_ID, 1, 1, 1, 1);
         final List<Event> events = new ArrayList<Event>();
         events.add(event);
 



Mime
View raw message