ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1465973 - in /ace/trunk: org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ org.apache.ace.client.rest.itest/src/org/apache/ace/client/res...
Date Tue, 09 Apr 2013 11:22:42 GMT
Author: marrs
Date: Tue Apr  9 11:22:41 2013
New Revision: 1465973

URL: http://svn.apache.org/r1465973
Log:
ACE-333 Renamed some PIDs to match the new package names. Removed an obsolete class.

Added:
    ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/
    ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/
    ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/
    ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/
    ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
Removed:
    ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/server/log/store/tests/
    ace/trunk/org.apache.ace.test/src/org/apache/ace/it/Options.java
Modified:
    ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
    ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
    ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
    ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
    ace/trunk/org.apache.ace.log.server.store.itest/bnd.bnd
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/Activator.java
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/Activator.java
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/Activator.java

Modified: ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
(original)
+++ ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
Tue Apr  9 11:22:41 2013
@@ -184,11 +184,11 @@ public class LogAuthenticationTest exten
             "name", "auditlog");
         configureFactory("org.apache.ace.target.log.sync.factory",
             "name", "auditlog");
-        configureFactory("org.apache.ace.server.log.servlet.factory",
+        configureFactory("org.apache.ace.log.server.servlet.factory",
             "name", "auditlog",
             HttpConstants.ENDPOINT, AUDITLOG_ENDPOINT,
             "authentication.enabled", "true");
-        configureFactory("org.apache.ace.server.log.store.factory",
+        configureFactory("org.apache.ace.log.server.store.factory",
             "name", "auditlog");
     }
 

Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
(original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
Tue Apr  9 11:22:41 2013
@@ -195,7 +195,7 @@ public abstract class BaseRepositoryAdmi
         m_endpoint = new URL(HOST + ENDPOINT_NAME);
 
         getService(SessionFactory.class).createSession("test-session-ID");
-        configureFactory("org.apache.ace.server.log.store.factory",
+        configureFactory("org.apache.ace.log.server.store.factory",
             "name", "auditlog", "authentication.enabled", "false");
     }
 

Modified: ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
(original)
+++ ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
Tue Apr  9 11:22:41 2013
@@ -470,12 +470,12 @@ public class RESTClientTest extends Inte
         configure("org.apache.ace.identification.property",
             "targetID", "target-test");
         
-        configureFactory("org.apache.ace.server.log.servlet.factory",
+        configureFactory("org.apache.ace.log.server.servlet.factory",
             "name", "auditlog",
             HttpConstants.ENDPOINT, "/auditlog",
             "authentication.enabled", "false");
     
-        configureFactory("org.apache.ace.server.log.store.factory",
+        configureFactory("org.apache.ace.log.server.store.factory",
             "name", "auditlog");
         
         configureFactory("org.apache.ace.server.repository.factory",

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=1465973&r1=1465972&r2=1465973&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 Tue
Apr  9 11:22:41 2013
@@ -80,10 +80,10 @@ public class LogIntegrationTest extends 
         configure("org.apache.ace.deployment.servlet",
                 HttpConstants.ENDPOINT, DEPLOYMENT, "authentication.enabled", "false");
 
-        configureFactory("org.apache.ace.server.log.servlet.factory",
+        configureFactory("org.apache.ace.log.server.servlet.factory",
                 "name", "auditlog",
                 HttpConstants.ENDPOINT, AUDITLOG, "authentication.enabled", "false");
-        configureFactory("org.apache.ace.server.log.store.factory",
+        configureFactory("org.apache.ace.log.server.store.factory",
                 "name", "auditlog");
     }
 

Modified: ace/trunk/org.apache.ace.log.server.store.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.server.store.itest/bnd.bnd?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.server.store.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log.server.store.itest/bnd.bnd Tue Apr  9 11:22:41 2013
@@ -16,7 +16,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.log.server.store.mongo;version=latest,\
 	org.apache.ace.range.api;version=latest,\
 	org.apache.ace.test;version=latest
-Private-Package: org.apache.ace.server.log.store.tests
+Private-Package: org.apache.ace.log.server.store.tests
 -runvm: -ea
 -runfw: org.apache.felix.framework;version='[4,5)'
 -buildpath: \

Added: 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=1465973&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
(added)
+++ ace/trunk/org.apache.ace.log.server.store.itest/src/org/apache/ace/log/server/store/tests/MongoLogStoreTest.java
Tue Apr  9 11:22:41 2013
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ace.log.server.store.tests;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.amdatu.mongo.MongoDBService;
+import org.apache.ace.it.IntegrationTestBase;
+import org.apache.ace.log.LogDescriptor;
+import org.apache.ace.log.LogEvent;
+import org.apache.ace.log.server.store.LogStore;
+import org.apache.felix.dm.Component;
+import org.osgi.service.log.LogService;
+
+import com.mongodb.BasicDBObject;
+import com.mongodb.DBCollection;
+import com.mongodb.MongoException;
+
+public class MongoLogStoreTest extends IntegrationTestBase {
+	private volatile LogStore m_logStore;
+	private volatile MongoDBService m_mongodbService;
+
+	@Override
+	protected void before() throws Exception {
+		configureFactory("org.amdatu.mongo", "dbName", "ace");
+		configureFactory("org.apache.ace.log.server.store.factory", "name", "serverlog");
+		super.before();
+	}
+
+	protected org.apache.felix.dm.Component[] getDependencies() {
+		return new Component[] { createComponent().setImplementation(this)
+				.add(createServiceDependency().setService(LogStore.class).setRequired(true))
+				.add(createServiceDependency().setService(MongoDBService.class).setRequired(true)) };
+	}
+
+	public void testPutEvents() throws Exception {
+
+		try {
+			DBCollection collection = m_mongodbService.getDB().getCollection("serverlog");
+			collection.remove(new BasicDBObject());
+			TimeUnit.SECONDS.sleep(2);
+
+			storeEvents();
+			collection = m_mongodbService.getDB().getCollection("serverlog");
+			assertEquals(5, collection.count());
+		} catch (MongoException ex) {
+			System.err.println("Mongodb not available on localhost, skipping test");
+		}
+	}
+
+	public void testGetEvents() throws Exception {
+		try {
+			DBCollection collection = m_mongodbService.getDB().getCollection("serverlog");
+			collection.remove(new BasicDBObject());
+			TimeUnit.SECONDS.sleep(2);
+
+			storeEvents();
+
+			List<LogEvent> events = m_logStore.get(new LogDescriptor("mytarget1,1,0"));
+			assertEquals(3, events.size());
+		} catch (MongoException ex) {
+			System.err.println("Mongodb not available on localhost, skipping test");
+		}
+	}
+
+	public void testGetEventsWithRange() throws Exception {
+		try {
+			DBCollection collection = m_mongodbService.getDB().getCollection("serverlog");
+			collection.remove(new BasicDBObject());
+			TimeUnit.SECONDS.sleep(2);
+
+			storeEvents();
+
+			List<LogEvent> events = m_logStore.get(new LogDescriptor("mytarget1,1,2"));
+			assertEquals(2, events.size());
+		} catch (Exception ex) {
+			System.err.println("Mongodb not available on localhost, skipping test");
+		}
+	}
+
+	public void testGetDescriptorsSingleLogId() throws Exception {
+		try {
+			DBCollection collection = m_mongodbService.getDB().getCollection("serverlog");
+			collection.remove(new BasicDBObject());
+			TimeUnit.SECONDS.sleep(2);
+
+			storeEvents();
+
+			List<LogDescriptor> descriptors = m_logStore.getDescriptors();
+			assertEquals(2, descriptors.size());
+			assertEquals("mytarget1", descriptors.get(0).getTargetID());
+			assertEquals(1, descriptors.get(0).getLogID());
+			assertEquals(4, descriptors.get(0).getRangeSet().getHigh());
+			assertEquals("mytarget2", descriptors.get(1).getTargetID());
+			assertEquals(1, descriptors.get(1).getLogID());
+			assertEquals(5, descriptors.get(1).getRangeSet().getHigh());
+		} catch (MongoException ex) {
+			System.err.println("Mongodb not available on localhost, skipping test");
+		}
+
+	}
+
+	public void testGetDescriptorsMultipleLogIds() throws Exception {
+		try {
+			DBCollection collection = m_mongodbService.getDB().getCollection("serverlog");
+			collection.remove(new BasicDBObject());
+			TimeUnit.SECONDS.sleep(2);
+
+			storeEvents();
+
+			Properties props = new Properties();
+			props.setProperty("myProperty", "myvalue");
+
+			LogEvent event1 = new LogEvent("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+			LogEvent event2 = new LogEvent("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+
+			m_logStore.put(Arrays.asList(event1, event2));
+
+			List<LogDescriptor> descriptors = m_logStore.getDescriptors();
+			assertEquals(3, descriptors.size());
+			assertEquals("mytarget1", descriptors.get(0).getTargetID());
+			assertEquals(1, descriptors.get(0).getLogID());
+			assertEquals(4, descriptors.get(0).getRangeSet().getHigh());
+
+			assertEquals("mytarget1", descriptors.get(1).getTargetID());
+			assertEquals(2, descriptors.get(1).getLogID());
+			assertEquals(2, descriptors.get(1).getRangeSet().getHigh());
+
+			assertEquals("mytarget2", descriptors.get(2).getTargetID());
+			assertEquals(1, descriptors.get(2).getLogID());
+			assertEquals(5, descriptors.get(2).getRangeSet().getHigh());
+		} catch (MongoException ex) {
+			System.err.println("Mongodb not available on localhost, skipping test");
+		}
+	}
+
+	public void testGetDescriptorsForTarget() throws Exception {
+		try {
+			DBCollection collection = m_mongodbService.getDB().getCollection("serverlog");
+			collection.remove(new BasicDBObject());
+			TimeUnit.SECONDS.sleep(2);
+
+			storeEvents();
+
+			Properties props = new Properties();
+			props.setProperty("myProperty", "myvalue");
+
+			LogEvent event1 = new LogEvent("mytarget1", 2, 1, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+			LogEvent event2 = new LogEvent("mytarget1", 2, 2, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+
+			m_logStore.put(Arrays.asList(event1, event2));
+
+			List<LogDescriptor> descriptors = m_logStore.getDescriptors("mytarget1");
+			assertEquals(2, descriptors.size());
+			assertEquals("mytarget1", descriptors.get(0).getTargetID());
+			assertEquals(1, descriptors.get(0).getLogID());
+			assertEquals(4, descriptors.get(0).getRangeSet().getHigh());
+
+			assertEquals("mytarget1", descriptors.get(1).getTargetID());
+			assertEquals(2, descriptors.get(1).getLogID());
+			assertEquals(2, descriptors.get(1).getRangeSet().getHigh());
+		} catch (MongoException ex) {
+			System.err.println("Mongodb not available on localhost, skipping test");
+		}
+	}
+
+	private void storeEvents() throws IOException {
+		Properties props = new Properties();
+		props.setProperty("myProperty", "myvalue");
+		LogEvent event1 = new LogEvent("mytarget1", 1, 1, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+		LogEvent event2 = new LogEvent("mytarget1", 1, 2, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+		LogEvent event3 = new LogEvent("mytarget2", 1, 3, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+		LogEvent event4 = new LogEvent("mytarget2", 1, 5, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+		LogEvent event5 = new LogEvent("mytarget1", 1, 4, System.currentTimeMillis(), LogService.LOG_ERROR,
props);
+
+		m_logStore.put(Arrays.asList(event1, event2, event3, event4, event5));
+	}
+
+}

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java Tue
Apr  9 11:22:41 2013
@@ -51,7 +51,7 @@ public class Activator extends Dependenc
     public void init(BundleContext context, DependencyManager manager) throws Exception {
         m_manager = manager;
         Properties props = new Properties();
-        props.put(Constants.SERVICE_PID, "org.apache.ace.server.log.servlet.factory");
+        props.put(Constants.SERVICE_PID, "org.apache.ace.log.server.servlet.factory");
         manager.add(createComponent()
             .setInterface(ManagedServiceFactory.class.getName(), props)
             .setImplementation(this)

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/Activator.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/Activator.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/Activator.java Tue
Apr  9 11:22:41 2013
@@ -48,7 +48,7 @@ public class Activator extends Dependenc
         m_context = context;
         m_manager = manager;
         Properties props = new Properties();
-        props.put(Constants.SERVICE_PID, "org.apache.ace.server.log.store.factory");
+        props.put(Constants.SERVICE_PID, "org.apache.ace.log.server.store.factory");
         manager.add(createComponent()
             .setInterface(ManagedServiceFactory.class.getName(), props)
             .setImplementation(this)

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/Activator.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/Activator.java
(original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/mongo/Activator.java
Tue Apr  9 11:22:41 2013
@@ -48,7 +48,7 @@ public class Activator extends Dependenc
         m_context = context;
         m_manager = manager;
         Properties props = new Properties();
-        props.put(Constants.SERVICE_PID, "org.apache.ace.server.log.store.factory");
+        props.put(Constants.SERVICE_PID, "org.apache.ace.log.server.store.factory");
         manager.add(createComponent()
             .setInterface(ManagedServiceFactory.class.getName(), props)
             .setImplementation(this)

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/Activator.java?rev=1465973&r1=1465972&r2=1465973&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/Activator.java (original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/task/Activator.java Tue Apr
 9 11:22:41 2013
@@ -48,7 +48,7 @@ public class Activator extends Dependenc
     public void init(BundleContext context, DependencyManager manager) throws Exception {
         m_manager = manager;
         Properties props = new Properties();
-        props.put(Constants.SERVICE_PID, "org.apache.ace.server.log.task.factory");
+        props.put(Constants.SERVICE_PID, "org.apache.ace.log.server.task.factory");
         manager.add(createComponent()
             .setInterface(ManagedServiceFactory.class.getName(), props)
             .setImplementation(this)



Mime
View raw message