SLING-4756 - ServiceListener notifications are not filtered

Service registration now sets the mandatory objectClass
property

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1682011 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java b/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
index c9c13dd..fafc13b 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/MockServiceRegistration.java
@@ -53,6 +53,7 @@
         this.service = service;
         this.properties = properties != null ? properties : new Hashtable<String,Object>();
         this.properties.put(Constants.SERVICE_ID, this.serviceId);
+        this.properties.put(Constants.OBJECTCLASS, clazzes);
         this.serviceReference = new MockServiceReference(bundle, this);
         this.bundleContext = bundleContext;
         readOsgiMetadata();
diff --git a/src/test/java/org/apache/sling/testing/mock/osgi/MockServiceReferenceTest.java b/src/test/java/org/apache/sling/testing/mock/osgi/MockServiceReferenceTest.java
index c525575..2eb7cc3 100644
--- a/src/test/java/org/apache/sling/testing/mock/osgi/MockServiceReferenceTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/osgi/MockServiceReferenceTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.testing.mock.osgi;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
@@ -63,8 +64,11 @@
 
     @Test
     public void testProperties() {
-        assertEquals(2, this.serviceReference.getPropertyKeys().length);
+        assertEquals(3, this.serviceReference.getPropertyKeys().length);
         assertEquals("value1", this.serviceReference.getProperty("customProp1"));
+        // mandatory properties set by the container
+        assertNotNull(this.serviceReference.getProperty(Constants.SERVICE_ID));
+        assertArrayEquals((String[]) this.serviceReference.getProperty(Constants.OBJECTCLASS), new String[] { String.class.getName() });
     }
 
     @Test