You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2016/12/02 16:55:22 UTC
svn commit: r1772374 - in /sling/branches/testing/mocks:
osgi-mock-1.x/src/main/java/org/apache/sling/testing/mock/osgi/context/
osgi-mock-1.x/src/test/java/org/apache/sling/testing/mock/osgi/context/
sling-mock-1.x/
Author: sseifert
Date: Fri Dec 2 16:55:22 2016
New Revision: 1772374
URL: http://svn.apache.org/viewvc?rev=1772374&view=rev
Log:
SLING-6358 osgi-mock: OsgiContext.getServices should return correctly typed array when empty
Modified:
sling/branches/testing/mocks/osgi-mock-1.x/src/main/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImpl.java
sling/branches/testing/mocks/osgi-mock-1.x/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
sling/branches/testing/mocks/sling-mock-1.x/pom.xml
Modified: sling/branches/testing/mocks/osgi-mock-1.x/src/main/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImpl.java
URL: http://svn.apache.org/viewvc/sling/branches/testing/mocks/osgi-mock-1.x/src/main/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImpl.java?rev=1772374&r1=1772373&r2=1772374&view=diff
==============================================================================
--- sling/branches/testing/mocks/osgi-mock-1.x/src/main/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImpl.java (original)
+++ sling/branches/testing/mocks/osgi-mock-1.x/src/main/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImpl.java Fri Dec 2 16:55:22 2016
@@ -23,7 +23,6 @@ import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Map;
-import org.apache.commons.lang3.ArrayUtils;
import org.apache.sling.testing.mock.osgi.MapUtil;
import org.apache.sling.testing.mock.osgi.MockEventAdmin;
import org.apache.sling.testing.mock.osgi.MockOsgi;
@@ -209,7 +208,7 @@ public class OsgiContextImpl {
}
return services;
} else {
- return (ServiceType[])ArrayUtils.EMPTY_OBJECT_ARRAY;
+ return (ServiceType[])Array.newInstance(serviceType, 0);
}
} catch (InvalidSyntaxException ex) {
throw new RuntimeException("Invalid filter syntax: " + filter, ex);
Modified: sling/branches/testing/mocks/osgi-mock-1.x/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java
URL: http://svn.apache.org/viewvc/sling/branches/testing/mocks/osgi-mock-1.x/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java?rev=1772374&r1=1772373&r2=1772374&view=diff
==============================================================================
--- sling/branches/testing/mocks/osgi-mock-1.x/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java (original)
+++ sling/branches/testing/mocks/osgi-mock-1.x/src/test/java/org/apache/sling/testing/mock/osgi/context/OsgiContextImplTest.java Fri Dec 2 16:55:22 2016
@@ -94,13 +94,17 @@ public class OsgiContextImplTest {
@Test
public void testRegisterMultipleServices() {
+ Set[] serviceResults = context.getServices(Set.class, null);
+ assertEquals(0, serviceResults.length);
+
Set<String> myService1 = new HashSet<String>();
context.registerService(Set.class, myService1);
Set<String> myService2 = new HashSet<String>();
context.registerService(Set.class, myService2);
// expected: descending order because ordering descending by service id
- Set[] serviceResults = context.getServices(Set.class, null);
+ serviceResults = context.getServices(Set.class, null);
+ assertEquals(2, serviceResults.length);
assertSame(myService1, serviceResults[1]);
assertSame(myService2, serviceResults[0]);
}
Modified: sling/branches/testing/mocks/sling-mock-1.x/pom.xml
URL: http://svn.apache.org/viewvc/sling/branches/testing/mocks/sling-mock-1.x/pom.xml?rev=1772374&r1=1772373&r2=1772374&view=diff
==============================================================================
--- sling/branches/testing/mocks/sling-mock-1.x/pom.xml (original)
+++ sling/branches/testing/mocks/sling-mock-1.x/pom.xml Fri Dec 2 16:55:22 2016
@@ -45,7 +45,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.osgi-mock</artifactId>
- <version>1.8.0</version>
+ <version>1.8.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>