glimmerveen commented on code in PR #419: URL: https://github.com/apache/felix-dev/pull/419#discussion_r2096415080
########## scr/src/test/java/org/apache/felix/scr/integration/Felix6778Test.java: ########## @@ -0,0 +1,115 @@ +/* + * 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.felix.scr.integration; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.junit.PaxExam; +import org.osgi.framework.BundleException; +import org.osgi.framework.Constants; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceEvent; +import org.osgi.framework.ServiceListener; +import org.osgi.service.component.runtime.ServiceComponentRuntime; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + +@RunWith(PaxExam.class) +public class Felix6778Test extends ComponentTestBase implements ServiceListener +{ + + static + { + descriptorFile = "/integration_test_simple_components.xml"; + DS_SERVICE_CHANGECOUNT_TIMEOUT = 1000; Review Comment: My assumption/concern in my previous comments was incorrect. I was concerned that Pax Exam's reflection could discover both the static configuration method from the ComponentTestBase *and* the Felix6778Test. This however is not the case, as Class.getMethods(), when traversing the class hierarchy looking for public methods, merges methods with the same name/signature, always favouring the more specialised version (Felix6778Test) over the more generic (ComponentTestBase). In other words, my concern that sometimes this test would/could run using just the configuration from ComponentTestBase is not correct. It is however important that Felix6778Test uses the same method name for its overruling of the configuration from the ComponentTestBase. Suppose I would have Felix6778Test use another name for its `@Configuration` method, the PaxExamRunner will create two "executions" of the same test, using the two different sets of configurations. As the test can only succeed with the lower timeout, only one of the executions would succeed. TL;DR I think this is a reliable way to have this test determine its own set of options to use, whilst still being able to extend from the ComponentTestBase for all its other features, *and* allowing the ComponentTestBase to offer a default set of Pax Exam options to use. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@felix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org