Skip to content

Commit

Permalink
[MAINTENANCE] Refactor tests in BMP
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/aries/trunk@1810275 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
alien11689 committed Oct 1, 2017
1 parent 9ba6af3 commit 64c6c0b
Show file tree
Hide file tree
Showing 31 changed files with 45 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import org.apache.aries.blueprint.plugin.model.TransactionalDef;
import org.apache.aries.blueprint.plugin.test.MyBean1;
import org.apache.aries.blueprint.plugin.test.MyProduced;
import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.ServiceB;
import org.apache.aries.blueprint.plugin.test.ServiceD;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceD;
import org.apache.aries.blueprint.plugin.test.bean.BasicBean;
import org.apache.aries.blueprint.plugin.test.bean.BeanWithCallbackMethods;
import org.apache.aries.blueprint.plugin.test.bean.NamedBean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import javax.persistence.EntityManager;
import javax.persistence.PersistenceUnit;

import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.ops4j.pax.cdi.api.OsgiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.AnnotatedService;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceC;
import org.ops4j.pax.cdi.api.OsgiService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.DependsOn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.springframework.context.annotation.DependsOn;

import javax.inject.Named;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceD;
import org.ops4j.pax.cdi.api.OsgiService;

import javax.inject.Singleton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceC;
import org.ops4j.pax.cdi.api.OsgiService;
import org.springframework.beans.factory.annotation.Value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.springframework.context.annotation.Lazy;

import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.ops4j.pax.cdi.api.OsgiService;

import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import javax.persistence.PersistenceUnit;
import javax.transaction.Transactional;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.springframework.beans.factory.annotation.Autowired;

public class ParentBean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import javax.inject.Singleton;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;

@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;

import javax.inject.Named;

@Named("my1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.inject.Named;
import javax.inject.Singleton;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;
import org.springframework.beans.factory.annotation.Value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import javax.inject.Singleton;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;

@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.aries.blueprint.plugin.test;

import org.apache.aries.blueprint.plugin.AnnotatedService;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;

import javax.inject.Singleton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
import org.ops4j.pax.cdi.api.OsgiService;

public class ServiceReferencesParent
{
@Inject @OsgiService(filter="(type=B1)") ServiceB serviceB;
@Inject @OsgiService(filter="(type=B1)")
ServiceB serviceB;

@Named("serviceB2Id") @Inject @OsgiService(filter="(type=B2)") ServiceB serviceB2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* 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
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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
Expand All @@ -19,28 +19,16 @@
package org.apache.aries.blueprint.plugin.test.cditransactional;

import org.apache.aries.blueprint.plugin.test.ParentBean;
import org.springframework.context.annotation.Lazy;

import javax.annotation.PostConstruct;
import javax.inject.Singleton;
import javax.transaction.cdi.Transactional;
import javax.transaction.cdi.Transactional.TxType;

@Singleton
@Transactional(value=TxType.REQUIRES_NEW)
@Lazy
@Transactional(value = TxType.REQUIRES_NEW)
public class CdiTransactionalAnnotatedBean extends ParentBean {

public void overridenInit() {
// By overriding the method and removing the annotation, this method has lost its
// @PostConstruct method because it isn't @Inherited
}

@PostConstruct
public void init() {

}

@Transactional(TxType.NOT_SUPPORTED)
public void txNotSupported() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import org.apache.aries.blueprint.annotation.config.ConfigProperties;
import org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor;
import org.ops4j.pax.cdi.api.OsgiService;

import javax.enterprise.inject.Produces;
import javax.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test;
package org.apache.aries.blueprint.plugin.test.interfaces;

public interface ServiceA {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test;
package org.apache.aries.blueprint.plugin.test.interfaces;

public interface ServiceB {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test;
package org.apache.aries.blueprint.plugin.test.interfaces;

public interface ServiceC {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test;
package org.apache.aries.blueprint.plugin.test.interfaces;

public interface ServiceD {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.aries.blueprint.plugin.test.osgiserviceprovider;

import org.apache.aries.blueprint.plugin.test.MyProduced;
import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;
import org.ops4j.pax.cdi.api.Properties;
import org.ops4j.pax.cdi.api.Property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.aries.blueprint.plugin.test.osgiserviceprovider;

import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;
import org.ops4j.pax.cdi.api.Properties;
import org.ops4j.pax.cdi.api.Property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.google.inject.Singleton;
import org.apache.aries.blueprint.annotation.referencelistener.Cardinality;
import org.apache.aries.blueprint.annotation.referencelistener.ReferenceListener;
import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;

import javax.inject.Named;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@

import org.apache.aries.blueprint.annotation.referencelistener.Cardinality;
import org.apache.aries.blueprint.annotation.referencelistener.ReferenceListener;
import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;

import javax.inject.Named;
import javax.inject.Singleton;

@ReferenceListener(referenceInterface = ServiceA.class, cardinality = Cardinality.MULTIPLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.aries.blueprint.annotation.referencelistener.Bind;
import org.apache.aries.blueprint.annotation.referencelistener.ReferenceListener;
import org.apache.aries.blueprint.annotation.referencelistener.Unbind;
import org.apache.aries.blueprint.plugin.test.ServiceA;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;

import javax.inject.Singleton;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.aries.blueprint.annotation.referencelistener.Availability;
import org.apache.aries.blueprint.annotation.referencelistener.Cardinality;
import org.apache.aries.blueprint.annotation.referencelistener.ReferenceListener;
import org.apache.aries.blueprint.plugin.test.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;

import javax.enterprise.inject.Produces;
import javax.inject.Named;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.apache.aries.blueprint.annotation.referencelistener.Bind;
import org.apache.aries.blueprint.annotation.referencelistener.Unbind;
import org.apache.aries.blueprint.plugin.test.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;

public class ReferenceListenerToProduce {
@Bind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.aries.blueprint.plugin.test.referencelistener;

import org.apache.aries.blueprint.plugin.test.ServiceB;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;

public class ReferenceListenerToProduceWithoutAnnotation {
public void addMe(ServiceB serviceB) {
Expand Down

0 comments on commit 64c6c0b

Please sign in to comment.