SLING-7788: restructured MockServiceRegistration

To add the services in the osgi metadata to the properties of the
service registration as well, the osgi metadata are nowread before
the properties map is assembled. This will add any passed service
classes and those in the metadata to the objectClass service property
 and so will make them available to ServiceListeners which the
ServiceTracker is using to track services.
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 cd93b0b..94c3cec 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
@@ -61,14 +61,14 @@
         else {
             this.service = service;
         }
-        
+
+        readOsgiMetadata();
+
         this.properties = properties != null ? properties : new Hashtable<String,Object>();
         this.properties.put(Constants.SERVICE_ID, this.serviceId);
-        this.properties.put(Constants.OBJECTCLASS, clazzes);
+        this.properties.put(Constants.OBJECTCLASS, this.clazzes.toArray(new String[0]));
         this.serviceReference = new MockServiceReference<T>(bundle, this);
         this.bundleContext = bundleContext;
-        
-        readOsgiMetadata();
     }
 
     @Override
diff --git a/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java b/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
index 20bd94b..174c6a1 100644
--- a/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
@@ -166,7 +166,6 @@
     }
 
     @Test
-    @Ignore("SLING-7788")
     public void testServiceTracker() {
         BundleContext bundleContext = context.bundleContext();
         ServiceTracker<MyService, MyService> tracker = new ServiceTracker<>(bundleContext, MyService.class, null);