index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/bean/package-info.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@org.osgi.annotation.bundle.Export
@org.osgi.annotation.versioning.Version("1.0.0")
package org.apache.aries.blueprint.annotation.bean;
| 9,200 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Cardinality.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.referencelistener;
public enum Cardinality {
SINGLE,
MULTIPLE
}
| 9,201 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Bind.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.referencelistener;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Method annotated with this annotation is bind method of reference listener
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Bind {
}
| 9,202 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Availability.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.referencelistener;
public enum Availability {
MANDATORY,
OPTIONAL
}
| 9,203 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/ReferenceListener.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.referencelistener;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotating any class with this will create a
* reference or reference-list element in blueprint
* with annotated bean as reference-listener.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ReferenceListener {
/**
* @return interface class of referenced service
*/
Class<?> referenceInterface();
/**
* @return filter on reference or reference-list
*/
String filter() default "";
/**
* @return component-name on reference or reference-list
*/
String componentName() default "";
/**
* @return if existence of at least one service is necessary
*/
Availability availability() default Availability.OPTIONAL;
/**
* @return id of reference or reference-list
*/
String referenceName() default "";
/**
* @return should generate reference or reference-list
*/
Cardinality cardinality() default Cardinality.MULTIPLE;
/**
* @return bind method of reference-listener
* if not provided then method annotated with {{@link Bind}}
* will be found and used
*/
String bindMethod() default "";
/**
* @return unbind method of reference-listener
* if not provided then method annotated with {{@link Unbind}}
* will be found and used
*/
String unbindMethod() default "";
}
| 9,204 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/Unbind.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.referencelistener;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Method annotated with this annotation is unbind method of reference listener
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Unbind {
}
| 9,205 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/referencelistener/package-info.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@org.osgi.annotation.bundle.Export
@org.osgi.annotation.versioning.Version("1.0.0")
package org.apache.aries.blueprint.annotation.referencelistener;
| 9,206 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/Availability.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.service;
public enum Availability {
MANDATORY,
OPTIONAL
}
| 9,207 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/Reference.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.service;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotate dependency to inject a service.
*/
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Reference {
/**
* @return filter on reference
*/
String filter() default "";
/**
* @return component-name on reference
*/
String componentName() default "";
/**
* @return if existence of at least one service is necessary
*/
Availability availability() default Availability.MANDATORY;
/**
* @return timeout on reference - negative value means blueprint default
*/
long timeout() default Long.MIN_VALUE;
}
| 9,208 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/Service.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.service;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotate bean which should be registered as a service
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Service {
/**
* @return the list of classes or interfaces with which the service will be registered
* When the list is empty than the service will be registered according to {@link #autoExport()}
*/
Class<?>[] classes() default {};
/**
* @return auto export policy (used when {@link #classes()} are not provided)
*/
AutoExport autoExport() default AutoExport.INTERFACES;
/**
* @return service.ranking property of service
* this parameter override service.ranking property (in {@link #properties()}) if it has value not equal to 0
*/
int ranking() default 0;
/**
* @return the list of service properties
*/
ServiceProperty[] properties() default {};
}
| 9,209 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/MemberType.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.service;
public enum MemberType {
SERVICE_OBJECT,
SERVICE_REFERENCE
}
| 9,210 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/AutoExport.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.service;
public enum AutoExport {
DISABLED,
INTERFACES,
CLASS_HIERARCHY,
ALL_CLASSES
}
| 9,211 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/ServiceProperty.java | /**
* 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.aries.blueprint.annotation.service;
/**
* Service property for service registration
*/
public @interface ServiceProperty {
/**
* @return name of property
*/
String name();
/**
* @return array of property values
*/
String[] values();
/**
* @return type of value or type of each value in values array
*/
Class<?> type() default String.class;
}
| 9,212 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/ReferenceList.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.annotation.service;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotate dependency to inject a list of services.
*/
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ReferenceList {
/**
* @return service interface class to inject
*/
Class<?> referenceInterface();
/**
* @return filter on reference-list
*/
String filter() default "";
/**
* @return component-name on reference-list
*/
String componentName() default "";
/**
* @return if existence of at least one service is necessary
*/
Availability availability() default Availability.MANDATORY;
/**
* @return should proxy or service reference be injected
*/
MemberType memberType() default MemberType.SERVICE_OBJECT;
}
| 9,213 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-annotation/src/main/java/org/apache/aries/blueprint/annotation/service/package-info.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@org.osgi.annotation.bundle.Export
@org.osgi.annotation.versioning.Version("1.0.0")
package org.apache.aries.blueprint.annotation.service;
| 9,214 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/ComponentAsNamed.java | /**
* 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.aries.blueprint.plugin.handlers.spring;
import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
import org.springframework.stereotype.Component;
import java.lang.reflect.AnnotatedElement;
public class ComponentAsNamed implements NamedLikeHandler {
@Override
public Class getAnnotation() {
return Component.class;
}
@Override
public String getName(Class clazz, AnnotatedElement annotatedElement) {
Component annotation = annotatedElement.getAnnotation(Component.class);
if (annotation != null && annotation.value() != null && !"".equals(annotation.value())) {
return annotation.value();
}
return null;
}
@Override
public String getName(Object annotation) {
Component component = Component.class.cast(annotation);
if (component != null && component.value() != null && !"".equals(component.value())) {
return component.value();
}
return null;
}
}
| 9,215 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/AutowiredAsInject.java | /**
* 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.aries.blueprint.plugin.handlers.spring;
import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
import org.springframework.beans.factory.annotation.Autowired;
public class AutowiredAsInject implements InjectLikeHandler<Autowired> {
@Override
public Class<Autowired> getAnnotation() {
return Autowired.class;
}
}
| 9,216 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/DependsOnAttributeResolver.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.handlers.spring;
import org.apache.aries.blueprint.plugin.spi.BeanAnnotationHandler;
import org.apache.aries.blueprint.plugin.spi.BeanEnricher;
import org.apache.aries.blueprint.plugin.spi.ContextEnricher;
import org.apache.commons.lang.StringUtils;
import org.springframework.context.annotation.DependsOn;
import java.lang.reflect.AnnotatedElement;
public class DependsOnAttributeResolver implements BeanAnnotationHandler<DependsOn> {
@Override
public Class<DependsOn> getAnnotation() {
return DependsOn.class;
}
@Override
public void handleBeanAnnotation(AnnotatedElement annotatedElement, String id, ContextEnricher contextEnricher, BeanEnricher beanEnricher) {
DependsOn annotation = annotatedElement.getAnnotation(DependsOn.class);
String[] value = annotation.value();
if (value.length == 0) {
return;
}
String dependsOnValue = StringUtils.join(value, " ");
beanEnricher.addAttribute("depends-on", dependsOnValue);
}
}
| 9,217 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/SpringTransactionalFactory.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.handlers.spring;
import com.google.common.base.CaseFormat;
import org.apache.aries.blueprint.plugin.spi.BeanAnnotationHandler;
import org.apache.aries.blueprint.plugin.spi.BeanEnricher;
import org.apache.aries.blueprint.plugin.spi.BlueprintConfiguration;
import org.apache.aries.blueprint.plugin.spi.ContextEnricher;
import org.apache.aries.blueprint.plugin.spi.MethodAnnotationHandler;
import org.apache.aries.blueprint.plugin.spi.XmlWriter;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;
public class SpringTransactionalFactory implements BeanAnnotationHandler<Transactional>, MethodAnnotationHandler<Transactional> {
private static final String PATTERN_NS_TX1 = "http\\:\\/\\/aries\\.apache\\.org\\/xmlns\\/transactions\\/v1\\.(.)\\.(.)";
private static final String PATTERN_NS_TX2 = "http\\:\\/\\/aries\\.apache\\.org\\/xmlns\\/transactions\\/v2\\.(.)\\.(.)";
private static final String NS_TX_1_2_0 = "http://aries.apache.org/xmlns/transactions/v1.2.0";
private static final String ENABLE_ANNOTATION = "transaction.enableAnnotation";
private String getTransactionTypeName(Transactional transactional) {
Propagation propagation = transactional.propagation();
if (propagation == Propagation.NESTED) {
throw new UnsupportedOperationException("Nested transactions not supported");
}
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, propagation.name());
}
@Override
public Class<Transactional> getAnnotation() {
return Transactional.class;
}
@Override
public void handleMethodAnnotation(Class<?> clazz, List<Method> methods, ContextEnricher contextEnricher, BeanEnricher beanEnricher) {
final String nsTx1 = getNamespaceByPattern(contextEnricher.getBlueprintConfiguration().getNamespaces(), PATTERN_NS_TX1);
if (nsTx1 != null) {
enableAnnotationTx1(contextEnricher, nsTx1);
for (final Method method : methods) {
final Transactional transactional = method.getAnnotation(Transactional.class);
final String transactionTypeName = getTransactionTypeName(transactional);
final String name = method.getName();
beanEnricher.addBeanContentWriter("javax.transactional.method/" + clazz.getName() + "/" + name + "/" + transactionTypeName, new XmlWriter() {
@Override
public void write(XMLStreamWriter writer) throws XMLStreamException {
writer.writeEmptyElement("transaction");
writer.writeDefaultNamespace(nsTx1);
writer.writeAttribute("method", name);
writer.writeAttribute("value", transactionTypeName);
}
});
}
}
final String nsTx2 = getNamespaceByPattern(contextEnricher.getBlueprintConfiguration().getNamespaces(), PATTERN_NS_TX2);
if (nsTx2 != null) {
insertEnableAnnotationTx2(contextEnricher, nsTx2);
}
}
@Override
public void handleBeanAnnotation(AnnotatedElement annotatedElement, String id, ContextEnricher contextEnricher, BeanEnricher beanEnricher) {
final String nsTx1 = getNamespaceByPattern(contextEnricher.getBlueprintConfiguration().getNamespaces(), PATTERN_NS_TX1);
if (nsTx1 != null) {
enableAnnotationTx1(contextEnricher, nsTx1);
final Transactional transactional = annotatedElement.getAnnotation(Transactional.class);
final String transactionTypeName = getTransactionTypeName(transactional);
beanEnricher.addBeanContentWriter("javax.transactional.method/" + annotatedElement + "/*/" + transactionTypeName, new XmlWriter() {
@Override
public void write(XMLStreamWriter writer) throws XMLStreamException {
writer.writeEmptyElement("transaction");
writer.writeDefaultNamespace(nsTx1);
writer.writeAttribute("method", "*");
writer.writeAttribute("value", transactionTypeName);
}
});
}
final String nsTx2 = getNamespaceByPattern(contextEnricher.getBlueprintConfiguration().getNamespaces(), PATTERN_NS_TX1);
if (nsTx2 != null) {
insertEnableAnnotationTx2(contextEnricher, nsTx2);
}
}
private String getNamespaceByPattern(Set<String> namespaces, String pattern) {
for (String namespace : namespaces) {
if (namespace.matches(pattern)) {
return namespace;
}
}
return null;
}
private void enableAnnotationTx1(ContextEnricher contextEnricher, final String nsTx1) {
// TX1 enable-annotation are valid only in 1.2.0 schema
if (NS_TX_1_2_0.equals(nsTx1) && getEnableAnnotationConfig(contextEnricher.getBlueprintConfiguration())) {
insertEnableAnnotationTx1(contextEnricher, nsTx1);
}
}
private boolean getEnableAnnotationConfig(BlueprintConfiguration blueprintConfig) {
String enableAnnotation = blueprintConfig.getCustomParameters().get(ENABLE_ANNOTATION);
return enableAnnotation == null || Boolean.parseBoolean(enableAnnotation);
}
private void insertEnableAnnotationTx1(ContextEnricher contextEnricher, final String namespace) {
contextEnricher.addBlueprintContentWriter("transaction/ennable-annotation", new XmlWriter() {
@Override
public void write(XMLStreamWriter writer) throws XMLStreamException {
writer.writeEmptyElement("enable-annotations");
writer.writeDefaultNamespace(namespace);
}
});
}
private void insertEnableAnnotationTx2(ContextEnricher contextEnricher, final String namespace) {
contextEnricher.addBlueprintContentWriter("transaction/ennable-annotation", new XmlWriter() {
@Override
public void write(XMLStreamWriter writer) throws XMLStreamException {
writer.writeEmptyElement("enable");
writer.writeDefaultNamespace(namespace);
}
});
}
}
| 9,218 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/LazyAttributeResolver.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.handlers.spring;
import org.apache.aries.blueprint.plugin.spi.BeanAnnotationHandler;
import org.apache.aries.blueprint.plugin.spi.BeanEnricher;
import org.apache.aries.blueprint.plugin.spi.ContextEnricher;
import org.springframework.context.annotation.Lazy;
import java.lang.reflect.AnnotatedElement;
public class LazyAttributeResolver implements BeanAnnotationHandler<Lazy> {
@Override
public Class<Lazy> getAnnotation() {
return Lazy.class;
}
@Override
public void handleBeanAnnotation(AnnotatedElement annotatedElement, String id, ContextEnricher contextEnricher, BeanEnricher beanEnricher) {
Lazy lazy = annotatedElement.getAnnotation(Lazy.class);
beanEnricher.addAttribute("activation", lazy.value() ? "lazy" : "eager");
}
}
| 9,219 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/QualifierAsNamed.java | /**
* 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.aries.blueprint.plugin.handlers.spring;
import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
import org.springframework.beans.factory.annotation.Qualifier;
import java.lang.reflect.AnnotatedElement;
public class QualifierAsNamed implements NamedLikeHandler {
@Override
public Class getAnnotation() {
return Qualifier.class;
}
@Override
public String getName(Class clazz, AnnotatedElement annotatedElement) {
Qualifier annotation = annotatedElement.getAnnotation(Qualifier.class);
if (annotation != null && annotation.value() != null && !"".equals(annotation.value())) {
return annotation.value();
}
return null;
}
@Override
public String getName(Object annotation) {
Qualifier qualifier = Qualifier.class.cast(annotation);
if (qualifier != null && qualifier.value() != null && !"".equals(qualifier.value())) {
return qualifier.value();
}
return null;
}
}
| 9,220 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/ComponentBeanFinder.java | /**
* 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.aries.blueprint.plugin.handlers.spring;
import org.apache.aries.blueprint.plugin.spi.BeanFinder;
import org.springframework.stereotype.Component;
public class ComponentBeanFinder implements BeanFinder<Component> {
@Override
public Class<Component> getAnnotation() {
return Component.class;
}
@Override
public boolean isSingleton() {
return true;
}
}
| 9,221 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-spring-handlers/src/main/java/org/apache/aries/blueprint/plugin/handlers/spring/ValueInjectionHandler.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.handlers.spring;
import org.springframework.beans.factory.annotation.Value;
public class ValueInjectionHandler implements org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler<Value> {
@Override
public Class<Value> getAnnotation() {
return Value.class;
}
@Override
public String getValue(Object annotation) {
Value value = Value.class.cast(annotation);
return value.value().replaceAll("\\:.*\\}", "}");
}
}
| 9,222 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/custom-destination/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/custom-destination/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.inject.Singleton;
@Singleton
public class T1 {
} | 9,223 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/simple-project/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/simple-project/src/main/java/p1/T2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
public class T2 {
}
| 9,224 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/simple-project/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/simple-project/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.inject.Singleton;
@Singleton
public class T1 {
} | 9,225 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/transaction-annotation/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/transaction-annotation/src/main/java/p3/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p3;
import javax.inject.Singleton;
import javax.transaction.Transactional;
@Singleton
@Transactional
public class T1 {
} | 9,226 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/transaction-annotation/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/transaction-annotation/src/main/java/p2/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p2;
import javax.inject.Singleton;
import javax.transaction.Transactional;
@Singleton
@Transactional
public class T1 {
} | 9,227 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/transaction-annotation/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/transaction-annotation/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.inject.Singleton;
import javax.transaction.Transactional;
@Singleton
@Transactional
public class T1 {
} | 9,228 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/multiple-invocation/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/multiple-invocation/src/main/java/p2/T2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p2;
import javax.inject.Singleton;
@Singleton
public class T2 {
} | 9,229 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/multiple-invocation/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/multiple-invocation/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.inject.Singleton;
@Singleton
public class T1 {
} | 9,230 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/with-provide/a/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/with-provide/a/src/main/java/a/A.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package a;
import javax.inject.Singleton;
import b.B;
@Singleton
public class A {
private final B b;
public A(B b) {
this.b = b;
}
} | 9,231 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/with-provide/c/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/with-provide/c/src/main/java/c/Api.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package c;
public interface Api {
} | 9,232 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/with-provide/b/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/with-provide/b/src/main/java/b/B.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package b;
import c.Api;
public class B implements Api {
} | 9,233 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/fail-on-conflict/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/fail-on-conflict/src/main/java/p2/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p2;
import javax.inject.Singleton;
@Singleton
public class T1 {
} | 9,234 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/fail-on-conflict/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/fail-on-conflict/src/main/java/p1/T2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
public class T2 {
}
| 9,235 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/fail-on-conflict/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/fail-on-conflict/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.inject.Singleton;
@Singleton
public class T1 {
} | 9,236 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
public interface I2 {} | 9,237 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import org.ops4j.pax.cdi.api.OsgiService;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;
import org.ops4j.pax.cdi.api.Properties;
import org.ops4j.pax.cdi.api.Property;
import javax.inject.Singleton;
@Singleton
@OsgiServiceProvider
@Properties({
@Property(name = "test1", value = "test"),
})
public class T1 implements I1 {
public T1(@OsgiService(filter="(a=1234)") I2 dependency) {
}
} | 9,238 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/pax-cdi/src/main/java/p1/I1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
public interface I1 {} | 9,239 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/produced-bean-by-method-name/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/produced-bean-by-method-name/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;
@Singleton
public class T1 {
@Produces
public String bla1() {
return null;
}
@Produces
public String bla2() {
return null;
}
} | 9,240 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/scanpath-restrict/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/scanpath-restrict/src/main/java/p2/T2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p2;
import javax.inject.Singleton;
@Singleton
public class T2 {
} | 9,241 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/scanpath-restrict/src/main/java/p2 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/scanpath-restrict/src/main/java/p2/inner/T3.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p2.inner;
import javax.inject.Singleton;
import javax.inject.Named;
@Singleton
@Named("test3")
public class T3 {
} | 9,242 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/scanpath-restrict/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/scanpath-restrict/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import javax.inject.Singleton;
@Singleton
public class T1 {
} | 9,243 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/spring/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/spring/src/main/java/p1/T2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class T2 {
@Autowired
private T2(T1 t1, @Value("test") String t){
}
} | 9,244 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/spring/src/main/java | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin-itest/src/it/spring/src/main/java/p1/T1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package p1;
import org.springframework.stereotype.Component;
@Component
public class T1 {
} | 9,245 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/AnnotatedService.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin;
import javax.inject.Named;
import javax.inject.Qualifier;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
@Named("annotatedService")
public @interface AnnotatedService {
}
| 9,246 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin;
import com.google.common.collect.Sets;
import org.apache.aries.blueprint.plugin.model.Blueprint;
import org.apache.aries.blueprint.plugin.model.TransactionalDef;
import org.apache.aries.blueprint.plugin.test.MyBean1;
import org.apache.aries.blueprint.plugin.test.MyBean5;
import org.apache.aries.blueprint.plugin.test.MyProduced;
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;
import org.apache.aries.blueprint.plugin.test.bean.SimpleProducedBean;
import org.apache.aries.blueprint.plugin.test.reference.BeanWithReferences;
import org.apache.aries.blueprint.plugin.test.reference.Ref1;
import org.apache.aries.blueprint.plugin.test.reference.Ref2;
import org.apache.aries.blueprint.plugin.test.reference.Ref3;
import org.apache.aries.blueprint.plugin.test.reference.Ref4;
import org.apache.aries.blueprint.plugin.test.referencelistener.ReferenceListenerToProduceWithoutAnnotation;
import org.apache.aries.blueprint.plugin.test.service.Service1;
import org.apache.aries.blueprint.plugin.test.service.Service2;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.xbean.finder.ClassFinder;
import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static org.apache.aries.blueprint.plugin.FilteredClassFinder.findClasses;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class BlueprintFileWriterTest {
private static final String NS_JPA = "http://aries.apache.org/xmlns/jpa/v1.1.0";
private static final String NS_TX1 = "http://aries.apache.org/xmlns/transactions/v1.2.0";
private static XPath xpath;
private static Document document;
private static byte[] xmlAsBytes;
@BeforeClass
public static void setUp() throws Exception {
ClassFinder classFinder = new ClassFinder(BlueprintFileWriterTest.class.getClassLoader());
long start = System.currentTimeMillis();
Set<Class<?>> beanClasses = findClasses(classFinder, Arrays.asList(
MyBean1.class.getPackage().getName(),
ReferenceListenerToProduceWithoutAnnotation.class.getPackage().getName(),
BeanWithReferences.class.getPackage().getName()
));
Set<String> namespaces = new HashSet<>(Arrays.asList(NS_JPA, NS_TX1));
Map<String, String> customParameters = new HashMap<>();
customParameters.put("ex.t", "1");
customParameters.put("example.p1", "v1");
customParameters.put("example.p2", "v2");
BlueprintConfigurationImpl blueprintConfiguration = new BlueprintConfigurationImpl(namespaces, null, customParameters, null, null);
Blueprint blueprint = new Blueprint(blueprintConfiguration, beanClasses);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new BlueprintFileWriter(os).write(blueprint);
xmlAsBytes = os.toByteArray();
System.out.println("Generation took " + (System.currentTimeMillis() - start) + " millis");
System.out.println(new String(xmlAsBytes, "UTF-8"));
document = readToDocument(xmlAsBytes, false);
xpath = XPathFactory.newInstance().newXPath();
}
@Test
public void testGenerateBeanWithInitDestroyAndfieldInjection() throws Exception {
Node bean1 = getBeanById("myBean1");
assertXpathEquals(bean1, "@class", MyBean1.class.getName());
assertXpathEquals(bean1, "@init-method", "init");
assertXpathEquals(bean1, "@destroy-method", "destroy");
assertXpathEquals(bean1, "@field-injection", "true");
assertXpathDoesNotExist(bean1, "@scope");
}
@Test
public void testGenerateTransactional() throws Exception {
Node bean1 = getBeanById("myBean1");
NodeList txs = (NodeList) xpath.evaluate("transaction", bean1, XPathConstants.NODESET);
Set<TransactionalDef> defs = new HashSet<TransactionalDef>();
for (int i = 0; i < txs.getLength(); ++i) {
Node tx = txs.item(i);
defs.add(new TransactionalDef(xpath.evaluate("@method", tx), xpath.evaluate("@value", tx)));
}
Set<TransactionalDef> expectedDefs = Sets.newHashSet(new TransactionalDef("*", "RequiresNew"),
new TransactionalDef("txNotSupported", "NotSupported"),
new TransactionalDef("txMandatory", "Mandatory"),
new TransactionalDef("txNever", "Never"),
new TransactionalDef("txRequired", "Required"),
new TransactionalDef("txOverridenWithRequiresNew", "RequiresNew"),
new TransactionalDef("txSupports", "Supports"));
assertEquals(expectedDefs, defs);
}
@Test
public void testGenerateCDITransactional() throws Exception {
Node bean1 = getBeanById("cdiTransactionalAnnotatedBean");
NodeList txs = (NodeList) xpath.evaluate("transaction", bean1, XPathConstants.NODESET);
Set<TransactionalDef> defs = new HashSet<TransactionalDef>();
for (int i = 0; i < txs.getLength(); ++i) {
Node tx = txs.item(i);
defs.add(new TransactionalDef(xpath.evaluate("@method", tx), xpath.evaluate("@value", tx)));
}
Set<TransactionalDef> expectedDefs = Sets.newHashSet(new TransactionalDef("*", "RequiresNew"),
new TransactionalDef("txNotSupported", "NotSupported"),
new TransactionalDef("txMandatory", "Mandatory"),
new TransactionalDef("txNever", "Never"),
new TransactionalDef("txRequired", "Required"),
new TransactionalDef("txOverridenWithRequiresNew", "RequiresNew"),
new TransactionalDef("txSupports", "Supports"));
assertEquals(expectedDefs, defs);
}
@Test
public void testGeneratePersistenceContext() throws Exception {
Node bean1 = getBeanById("myBean1");
assertXpathEquals(bean1, "context/@unitname", "person");
assertXpathEquals(bean1, "context/@property", "em");
}
@Test
public void testGeneratePersistenceUnit() throws Exception {
Node bean1 = getBeanById("myBean1");
assertXpathEquals(bean1, "unit/@unitname", "person");
assertXpathEquals(bean1, "unit/@property", "emf");
}
@Test
public void testGenerateAutowiredBean() throws Exception {
Node bean1 = getBeanById("myBean1");
assertXpathEquals(bean1, "property[@name='bean2']/@ref", "my1");
}
@Test
public void testGenerateServiceWithOneInterface() throws Exception {
Node serviceAImpl2 = getServiceByRef("my2");
assertXpathEquals(serviceAImpl2, "@interface", ServiceA.class.getName());
assertXpathDoesNotExist(serviceAImpl2, "@auto-export");
assertXpathDoesNotExist(serviceAImpl2, "interfaces");
}
@Test
public void testGenerateServiceWithAutoExport() throws Exception {
Node serviceAImpl3 = getServiceByRef("serviceAImpl3");
assertXpathDoesNotExist(serviceAImpl3, "@interface");
assertXpathEquals(serviceAImpl3, "@auto-export", "interfaces");
assertXpathDoesNotExist(serviceAImpl3, "interfaces");
}
@Test
public void testGenerateServiceWith2Interfaces() throws Exception {
Node serviceABImpl = getServiceByRef("serviceABImpl");
assertXpathDoesNotExist(serviceABImpl, "@interface");
assertXpathDoesNotExist(serviceABImpl, "@auto-export");
NodeList interfaceValues = (NodeList) xpath.evaluate("interfaces/value", serviceABImpl, XPathConstants.NODESET);
Set<String> interfaceNames = new HashSet<String>();
for (int i = 0; i < interfaceValues.getLength(); ++i) {
Node interfaceValue = interfaceValues.item(i);
interfaceNames.add(interfaceValue.getTextContent());
}
assertEquals(Sets.newHashSet(ServiceA.class.getName(), ServiceB.class.getName()),
interfaceNames);
}
@Test
public void testGenerateServiceWithRanking() throws Exception {
Node serviceWithRanking = getServiceByRef("serviceWithRanking");
assertXpathDoesNotExist(serviceWithRanking, "@interface");
assertXpathEquals(serviceWithRanking, "@auto-export", "interfaces");
assertXpathDoesNotExist(serviceWithRanking, "interfaces");
assertXpathEquals(serviceWithRanking, "@ranking", "100");
assertXpathEquals(serviceWithRanking, "count(service-properties/entry)", "0");
assertXpathDoesNotExist(serviceWithRanking, "service-properties/entry[@key='service.ranking']");
}
@Test
public void testGenerateBeanWithConstructorInjection() throws Exception {
Node myBean5 = getBeanById("myBean5");
assertXpathEquals(myBean5, "@class", MyBean5.class.getName());
assertXpathDoesNotExist(myBean5, "@field-injection");
assertXpathDoesNotExist(myBean5, "property");
assertXpathEquals(myBean5, "count(argument)", "8");
assertXpathEquals(myBean5, "argument[1]/@ref", "my2");
assertXpathEquals(myBean5, "argument[2]/@ref", "my1");
assertXpathEquals(myBean5, "argument[3]/@ref", "serviceABImpl");
assertXpathEquals(myBean5, "argument[4]/@value", "100");
assertXpathEquals(myBean5, "argument[5]/@ref", "ser1");
assertXpathEquals(myBean5, "argument[6]/@ref", "ser2");
assertXpathEquals(myBean5, "argument[7]/@ref", "serviceAImplQualified");
assertXpathEquals(myBean5, "argument[8]/@ref", "produced2");
}
@Test
public void testGenerateBeanWithConstructorInjectionWithoutInjectAnnotation() throws Exception {
// Bean with constructor injection
Node myBean6 = getBeanById("myBean6");
assertXpathEquals(myBean6, "argument[1]/@ref", "my2");
}
@Test
public void testGenerateReferenceWithComponentName() throws Exception {
Node ser1 = getReferenceById("ser1");
assertXpathEquals(ser1, "@component-name", "myRef");
assertXpathDoesNotExist(ser1, "@filter");
}
@Test
public void testGenerateReferenceWithFilter() throws Exception {
Node ser2 = getReferenceById("ser2");
assertXpathDoesNotExist(ser2, "@component-name");
assertXpathEquals(ser2, "@filter", "(mode=123)");
}
@Test
public void testProducesNamedBeans() throws Exception {
Node bean1 = getBeanById("produced1");
assertXpathEquals(bean1, "@class", "org.apache.aries.blueprint.plugin.test.MyProduced");
assertXpathEquals(bean1, "@factory-ref", "myFactoryNamedBean");
assertXpathEquals(bean1, "@factory-method", "createBean1");
assertXpathEquals(bean1, "@scope", "prototype");
Node bean2 = getBeanById("produced2");
assertXpathEquals(bean1, "@class", "org.apache.aries.blueprint.plugin.test.MyProduced");
assertXpathEquals(bean2, "@factory-ref", "myFactoryNamedBean");
assertXpathEquals(bean2, "@factory-method", "createBean2");
assertXpathDoesNotExist(bean2, "@scope");
Node myBean5 = getBeanById("myBean5");
assertXpathEquals(myBean5, "argument[8]/@ref", "produced2");
}
@Test
public void testProducesBeanUsingParametersNotConstructor() throws Exception {
Node bean1 = getBeanById("myProducedWithConstructor");
assertXpathEquals(bean1, "@class", "org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
assertXpathEquals(bean1, "@factory-ref", "myFactoryBean");
assertXpathEquals(bean1, "@factory-method", "createBeanWithParameters");
assertXpathEquals(bean1, "argument[1]/@ref", "myBean1");
assertXpathEquals(bean1, "argument[2]/@value", "100");
assertXpathEquals(bean1, "argument[3]/@ref", "ser1");
}
@Test
public void testExposeProducedBeanAsServiceWithAutoExport() throws Exception {
Node service = getServiceByRef("producedForService");
assertXpathEquals(service, "@auto-export", "interfaces");
assertXpathDoesNotExist(service, "@interface");
assertXpathDoesNotExist(service, "interfaces");
assertXpathDoesNotExist(service, "service-properties");
}
@Test
public void testExposeProducedBeanAsServiceWithOneInterface() throws Exception {
Node service = getServiceByRef("producedForServiceWithOneInterface");
assertXpathDoesNotExist(service, "@auto-export");
assertXpathEquals(service, "@interface", MyProduced.class.getName());
assertXpathDoesNotExist(service, "interfaces");
assertXpathDoesNotExist(service, "service-properties");
}
@Test
public void testExposeProducedBeanAsServiceWithTwoInterfaces() throws Exception {
Node service = getServiceByRef("producedForServiceWithTwoInterfaces");
assertXpathDoesNotExist(service, "@auto-export");
assertXpathDoesNotExist(service, "@interface");
assertXpathEquals(service, "count(interfaces/value)", "2");
assertXpathEquals(service, "interfaces/value[1]", MyProduced.class.getName());
assertXpathEquals(service, "interfaces/value[2]", ServiceA.class.getName());
assertXpathDoesNotExist(service, "service-properties");
}
@Test
public void testExposeProducedBeanAsServiceWithServiceProperties() throws Exception {
Node service = getServiceByRef("producedForServiceWithProperties");
assertXpathEquals(service, "@auto-export", "interfaces");
assertXpathDoesNotExist(service, "@interface");
assertXpathDoesNotExist(service, "interfaces");
assertXpathEquals(service, "@ranking", "100");
assertXpathEquals(service, "count(service-properties/entry)", "2");
assertXpathEquals(service, "service-properties/entry[@key='n1']/@value", "v1");
assertXpathEquals(service, "service-properties/entry[@key='n2']/@value", "v2");
assertXpathDoesNotExist(service, "service-properties/entry[@key='service.ranking']");
}
@Test
public void testSetterInjection() throws Exception {
Node bean1 = getBeanById("beanWithSetters");
assertXpathDoesNotExist(bean1, "@field-injection");
assertXpathDoesNotExist(bean1, "property[@name='useless']");
assertXpathDoesNotExist(bean1, "property[@name='iOnlyHaveSetPrefix']");
assertXpathDoesNotExist(bean1, "property[@name='ihaveMoreThenOneParameter']");
assertXpathDoesNotExist(bean1, "property[@name='iOnlyHaveSetPrefixValue']");
assertXpathDoesNotExist(bean1, "property[@name='ihaveMoreThenOneParameterValue']");
assertXpathEquals(bean1, "property[@name='myValue']/@value", "test");
assertXpathEquals(bean1, "property[@name='serviceA1']/@ref", "my1");
assertXpathEquals(bean1, "property[@name='serviceA2']/@ref", "my2");
assertXpathEquals(bean1, "property[@name='serviceB']/@ref", "serviceABImpl");
assertXpathEquals(bean1, "property[@name='serviceB2']/@ref", "serviceB2Id");
assertXpathEquals(bean1, "property[@name='serviceBRef']/@ref", "serviceB-typeB1Ref");
assertXpathEquals(bean1, "property[@name='serviceB2Ref']/@ref", "serviceB2IdRef");
assertXpathEquals(bean1, "property[@name='serviceB3Ref']/@ref", "serviceB-B3Ref");
Node reference1 = getReferenceById("serviceB-typeB1Ref");
assertXpathEquals(reference1, "@interface", ServiceB.class.getName());
assertXpathEquals(reference1, "@filter", "(type=B1Ref)");
Node reference2 = getReferenceById("serviceB2IdRef");
assertXpathEquals(reference2, "@interface", ServiceB.class.getName());
assertXpathEquals(reference2, "@filter", "(type=B2Ref)");
Node reference3 = getReferenceById("serviceB-B3Ref");
assertXpathEquals(reference3, "@interface", ServiceB.class.getName());
assertXpathEquals(reference3, "@component-name", "B3Ref");
}
@Test
public void testGenerateReferenceWithoutFilterAndComponentName() throws Exception {
Node reference = getReferenceById("serviceD");
assertXpathEquals(reference, "@interface", ServiceD.class.getName());
assertXpathDoesNotExist(reference, "@filter");
assertXpathDoesNotExist(reference, "@component-name");
}
@Test
public void testLazyWithTrueBeanHasActivationEager() throws Exception {
Node bean = getBeanById("beanWithSetters");
assertXpathEquals(bean, "@activation", "eager");
}
@Test
public void testLazyBeanHasActivationLazy() throws Exception {
Node bean = getBeanById("myBean1");
assertXpathEquals(bean, "@activation", "lazy");
}
@Test
public void testBeanWithoutLazyAnnotationHasNotActivationAttribute() throws Exception {
Node bean1 = getBeanById("myBean3");
assertXpathDoesNotExist(bean1, "@activation");
}
@Test
public void testLazyProducedBeanOverriddenByFactoryMethodAnnotation() throws Exception {
Node bean = getBeanById("producedEager");
assertXpathEquals(bean, "@activation", "eager");
}
@Test
public void testBeanWithoutDependsOnHasNotDependsOnAttribute() throws Exception {
Node bean = getBeanById("beanWithSetters");
assertXpathDoesNotExist(bean, "@depends-on");
}
@Test
public void testBeanWithEmptyDependsOnHasNotDependsOnAttribute() throws Exception {
Node bean = getBeanById("myBean6");
assertXpathDoesNotExist(bean, "@depends-on");
}
@Test
public void testBeanWithOneIdInDependsOnHasDependsOnAttribute() throws Exception {
Node bean = getBeanById("myBean5");
assertXpathEquals(bean, "@depends-on", "myBean6");
}
@Test
public void testBeanWithTwoIdInDependsOnHasDependsOnAttribute() throws Exception {
Node bean = getBeanById("myBean4");
assertXpathEquals(bean, "@depends-on", "myBean5 myBean6");
}
@Test
public void testProducedBeanMetohodWithoutDependsOnHasNotDependsOnAttribute() throws Exception {
Node bean = getBeanById("produced1");
assertXpathDoesNotExist(bean, "@depends-on");
}
@Test
public void testProducedBeanMethodWithDependsOnHasDependsOnAttribute() throws Exception {
Node bean = getBeanById("produced2");
assertXpathEquals(bean, "@depends-on", "produced1");
}
@Test
public void testInitContextHandler() throws Exception {
Node example1 = (Node) xpath.evaluate("/blueprint/example[@id='p1']", document, XPathConstants.NODE);
Node example2 = (Node) xpath.evaluate("/blueprint/example[@id='p2']", document, XPathConstants.NODE);
assertXpathEquals(example1, "@value", "v1");
assertXpathEquals(example2, "@value", "v2");
}
@Test
public void testProducesWithConfigProperty() throws Exception {
Node bean = getBeanById("producedWithConfigProperty");
assertXpathEquals(bean, "@class", "org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
assertXpathEquals(bean, "@factory-ref", "beanWithConfig");
assertXpathEquals(bean, "@factory-method", "createBean");
assertXpathEquals(bean, "@scope", "prototype");
assertXpathEquals(bean, "argument/@value", "1000");
}
@Test
public void testConfigPropertiesInjection() throws Exception {
Node bean = getBeanById("beanWithConfigurationProperties");
assertXpathEquals(bean, "@class", "org.apache.aries.blueprint.plugin.test.configuration.BeanWithConfigurationProperties");
assertXpathEquals(bean, "argument[1]/@ref", "testProps5");
assertXpathEquals(bean, "argument[2]/@ref", "properties-aries-test6-false");
assertXpathEquals(bean, "property[@name='prop1']/@ref", "properties-aries-test1-true");
assertXpathEquals(bean, "property[@name='prop2']/@ref", "testProps2");
assertXpathEquals(bean, "property[@name='prop3']/@ref", "properties-aries-test3-true");
assertXpathEquals(bean, "property[@name='prop4']/@ref", "testProps4");
assertXpathEquals(bean, "property[@name='prop7']/@ref", "properties-aries-test7-false");
}
@Test
public void testConfigPropertyInjection() throws Exception {
Node bean = getBeanById("beanWithConfig");
assertXpathEquals(bean, "@class", "org.apache.aries.blueprint.plugin.test.configuration.BeanWithConfig");
assertXpathDoesNotExist(bean, "argument");
assertXpathEquals(bean, "count(property)", "1");
assertXpathEquals(bean, "property[@name='title']/@value", "$[title]");
}
@Test
public void testGenerateCmConfigProperties() throws Exception {
Node testProps5 = getCmPropertiesById("testProps5");
assertXpathEquals(testProps5, "@persistent-id", "aries.test5");
assertXpathEquals(testProps5, "@update", "true");
Node testProps6 = getCmPropertiesById("properties-aries-test6-false");
assertXpathEquals(testProps6, "@persistent-id", "aries.test6");
assertXpathEquals(testProps6, "@update", "false");
Node testProps1 = getCmPropertiesById("properties-aries-test1-true");
assertXpathEquals(testProps1, "@persistent-id", "aries.test1");
assertXpathEquals(testProps1, "@update", "true");
Node testProps2 = getCmPropertiesById("testProps2");
assertXpathEquals(testProps2, "@persistent-id", "aries.test2");
assertXpathEquals(testProps2, "@update", "false");
Node testProps3 = getCmPropertiesById("properties-aries-test3-true");
assertXpathEquals(testProps3, "@persistent-id", "aries.test3");
assertXpathEquals(testProps3, "@update", "true");
Node testProps4 = getCmPropertiesById("testProps4");
assertXpathEquals(testProps4, "@persistent-id", "aries.test4");
assertXpathEquals(testProps4, "@update", "false");
Node testProps7 = getCmPropertiesById("properties-aries-test7-false");
assertXpathEquals(testProps7, "@persistent-id", "aries.test7");
assertXpathEquals(testProps7, "@update", "false");
}
@Test
public void testProducesWithConfigProperties() throws Exception {
Node withProperties8 = getBeanById("withProperties8");
assertXpathEquals(withProperties8, "@class", "org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
assertXpathEquals(withProperties8, "argument/@ref", "properties-aries-test8-false");
Node testProps8 = getCmPropertiesById("properties-aries-test8-false");
assertXpathEquals(testProps8, "@persistent-id", "aries.test8");
assertXpathEquals(testProps8, "@update", "false");
Node withProperties9 = getBeanById("withProperties9");
assertXpathEquals(withProperties9, "@class", "org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor");
assertXpathEquals(withProperties9, "argument/@ref", "testProps9");
Node testProps9 = getCmPropertiesById("testProps9");
assertXpathEquals(testProps9, "@persistent-id", "aries.test9");
assertXpathEquals(testProps9, "@update", "true");
}
@Test
public void referenceListnerForReferenceList() throws Exception {
assertNotNull(getBeanById("referenceListenerListBean"));
Node referenceList = getReferenceListById("serviceAList-a-bc");
assertXpathEquals(referenceList, "@filter", "(b=c)");
assertXpathEquals(referenceList, "@component-name", "a");
assertXpathEquals(referenceList, "@availability", "mandatory");
assertXpathEquals(referenceList, "@interface", ServiceA.class.getName());
assertXpathEquals(referenceList, "reference-listener/@ref", "referenceListenerListBean");
assertXpathEquals(referenceList, "reference-listener/@bind-method", "add");
assertXpathEquals(referenceList, "reference-listener/@unbind-method", "remove");
}
@Test
public void referenceListnerForReference() throws Exception {
assertNotNull(getBeanById("referenceListenerBeanWithNameWithoutMethods"));
Node reference = getReferenceById("serviceAReferenceWithoutMethods");
assertXpathDoesNotExist(reference, "@filter");
assertXpathDoesNotExist(reference, "@component-name");
assertXpathEquals(reference, "@availability", "optional");
assertXpathEquals(reference, "@interface", ServiceA.class.getName());
assertXpathEquals(reference, "reference-listener/@ref", "referenceListenerBeanWithNameWithoutMethods");
assertXpathDoesNotExist(reference, "reference-listener/@bind-method");
assertXpathDoesNotExist(reference, "reference-listener/@unbind-method");
}
@Test
public void referenceListnerForReferenceWithouMethodAnnotations() throws Exception {
assertNotNull(getBeanById("referenceListenerBeanWithoutMethodsAnnotation"));
Node reference = getReferenceListById("serviceAReference");
assertXpathDoesNotExist(reference, "@filter");
assertXpathDoesNotExist(reference, "@component-name");
assertXpathEquals(reference, "@availability", "optional");
assertXpathEquals(reference, "@interface", ServiceA.class.getName());
assertXpathEquals(reference, "reference-listener/@ref", "referenceListenerBeanWithoutMethodsAnnotation");
assertXpathEquals(reference, "reference-listener/@bind-method", "addMe");
assertXpathEquals(reference, "reference-listener/@unbind-method", "removeMe");
}
@Test
public void produceReferenceListnerForReference() throws Exception {
assertNotNull(getBeanById("referenceListenerProducer"));
Node referenceListenerToProduceForSingle = getBeanById("referenceListenerToProduceForSingle");
assertXpathEquals(referenceListenerToProduceForSingle, "@factory-ref", "referenceListenerProducer");
assertXpathEquals(referenceListenerToProduceForSingle, "@factory-method", "single");
Node reference = getReferenceById("serviceB-producer123-b123");
assertXpathEquals(reference, "@filter", "(b=123)");
assertXpathEquals(reference, "@component-name", "producer123");
assertXpathEquals(reference, "@availability", "optional");
assertXpathEquals(reference, "@interface", ServiceB.class.getName());
assertXpathEquals(reference, "reference-listener/@ref", "referenceListenerToProduceForSingle");
assertXpathEquals(reference, "reference-listener/@bind-method", "register");
assertXpathEquals(reference, "reference-listener/@unbind-method", "unregister");
}
@Test
public void produceReferenceListnerForReferenceList() throws Exception {
assertNotNull(getBeanById("referenceListenerProducer"));
Node referenceListenerToProduceForList = getBeanById("referenceListenerToProduceForList");
assertXpathEquals(referenceListenerToProduceForList, "@factory-ref", "referenceListenerProducer");
assertXpathEquals(referenceListenerToProduceForList, "@factory-method", "list");
Node referenceList = getReferenceListById("referenceListForProducer");
assertXpathEquals(referenceList, "@filter", "(b=456)");
assertXpathEquals(referenceList, "@component-name", "producer456");
assertXpathEquals(referenceList, "@availability", "optional");
assertXpathEquals(referenceList, "@interface", ServiceB.class.getName());
assertXpathEquals(referenceList, "reference-listener/@ref", "referenceListenerToProduceForList");
assertXpathEquals(referenceList, "reference-listener/@bind-method", "addMe");
assertXpathEquals(referenceList, "reference-listener/@unbind-method", "removeMe");
}
@Test
public void produceReferenceListnerForReferenceListWithOverrideAnnotatedMethods() throws Exception {
assertNotNull(getBeanById("referenceListenerProducer"));
Node referenceListenerToProduceWithBindingMethodsByName = getBeanById("referenceListenerToProduceWithBindingMethodsByName");
assertXpathEquals(referenceListenerToProduceWithBindingMethodsByName, "@factory-ref", "referenceListenerProducer");
assertXpathEquals(referenceListenerToProduceWithBindingMethodsByName, "@factory-method", "listWithDefinedMethods");
Node referenceList = getReferenceListById("serviceBList");
assertXpathDoesNotExist(referenceList, "@filter");
assertXpathDoesNotExist(referenceList, "@component-name");
assertXpathEquals(referenceList, "@availability", "mandatory");
assertXpathEquals(referenceList, "@interface", ServiceB.class.getName());
assertXpathEquals(referenceList, "reference-listener/@ref", "referenceListenerToProduceWithBindingMethodsByName");
assertXpathEquals(referenceList, "reference-listener/@bind-method", "addMe");
assertXpathEquals(referenceList, "reference-listener/@unbind-method", "removeMe");
}
@Test
public void generatedXmlIsValid() throws Exception {
Document document = readToDocument(xmlAsBytes, true);
List<String> sources = Arrays.asList(
"/schema/example.xsd",
"/schema/org/apache/aries/blueprint/blueprint.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.1.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.2.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.3.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.4.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.5.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.0.0.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.1.0.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.2.0.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.3.0.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.4.0.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.5.0.xsd",
"/schema/org/apache/aries/blueprint/ext/impl/blueprint-ext-1.6.0.xsd",
"/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.0.0.xsd",
"/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.1.0.xsd",
"/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.2.0.xsd",
"/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.3.0.xsd",
"/schema/org/apache/aries/blueprint/compendium/cm/blueprint-cm-1.4.0.xsd",
"/schema/org/apache/aries/transaction/parsing/transactionv12.xsd",
"/schema/org/apache/aries/jpa/blueprint/namespace/jpa_110.xsd"
);
List<Source> schemas = new ArrayList<>();
for (String source : sources) {
InputStream is = BlueprintFileWriterTest.class.getResourceAsStream(source);
if (is != null) {
schemas.add(new StreamSource(is));
}
}
Source xmlFile = new DOMSource(document);
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(schemas.toArray(new Source[schemas.size()]));
Validator validator = schema.newValidator();
validator.validate(xmlFile);
}
@Test
public void beanAnnotationCreatesBasicBean() throws Exception {
Node bean = getBeanById("basicBean");
assertXpathEquals(bean, "@class", BasicBean.class.getName());
assertXpathDoesNotExist(bean, "@scope");
assertXpathDoesNotExist(bean, "@activation");
assertXpathDoesNotExist(bean, "@depends-on");
assertXpathDoesNotExist(bean, "@init-method");
assertXpathDoesNotExist(bean, "@destroy-method");
assertXpathDoesNotExist(bean, "@factory-ref");
assertXpathDoesNotExist(bean, "@factory-method");
}
@Test
public void beanAnnotationCreatesNamedBean() throws Exception {
Node bean = getBeanById("namedBean1");
assertXpathEquals(bean, "@class", NamedBean.class.getName());
assertXpathEquals(bean, "@activation", "eager");
assertXpathEquals(bean, "@scope", "prototype");
assertXpathDoesNotExist(bean, "@depends-on");
assertXpathDoesNotExist(bean, "@init-method");
assertXpathDoesNotExist(bean, "@destroy-method");
assertXpathDoesNotExist(bean, "@factory-ref");
assertXpathDoesNotExist(bean, "@factory-method");
}
@Test
public void beanAnnotationCreatesBeanWithCallbackMethods() throws Exception {
Node bean = getBeanById("beanWithCallbackMethods");
assertXpathEquals(bean, "@class", BeanWithCallbackMethods.class.getName());
assertXpathEquals(bean, "@scope", "prototype");
assertXpathEquals(bean, "@activation", "lazy");
assertXpathEquals(bean, "@depends-on", "basicBean namedBean1");
assertXpathEquals(bean, "@init-method", "init");
assertXpathEquals(bean, "@destroy-method", "destroy");
assertXpathDoesNotExist(bean, "@factory-ref");
assertXpathDoesNotExist(bean, "@factory-method");
}
@Test
public void beanAnnotationProducesSimpleBean() throws Exception {
Node bean = getBeanById("simpleProducedBean1");
assertXpathEquals(bean, "@class", SimpleProducedBean.class.getName());
assertXpathDoesNotExist(bean, "@scope");
assertXpathDoesNotExist(bean, "@activation");
assertXpathDoesNotExist(bean, "@depends-on");
assertXpathDoesNotExist(bean, "@init-method");
assertXpathDoesNotExist(bean, "@destroy-method");
assertXpathEquals(bean, "@factory-ref", "basicBean");
assertXpathEquals(bean, "@factory-method", "getBean1");
}
@Test
public void beanAnnotationProducesPrototypeBean() throws Exception {
Node bean = getBeanById("simpleProducedBean2");
assertXpathEquals(bean, "@class", SimpleProducedBean.class.getName());
assertXpathEquals(bean, "@activation", "eager");
assertXpathEquals(bean, "@scope", "prototype");
assertXpathDoesNotExist(bean, "@depends-on");
assertXpathDoesNotExist(bean, "@init-method");
assertXpathDoesNotExist(bean, "@destroy-method");
assertXpathEquals(bean, "@factory-ref", "basicBean");
assertXpathEquals(bean, "@factory-method", "getBean2");
}
@Test
public void beanAnnotationProducesMethodWithCallbacks() throws Exception {
Node bean = getBeanById("simpleProducedBean3");
assertXpathEquals(bean, "@class", SimpleProducedBean.class.getName());
assertXpathEquals(bean, "@scope", "prototype");
assertXpathEquals(bean, "@activation", "lazy");
assertXpathEquals(bean, "@depends-on", "simpleProducedBean1 simpleProducedBean2");
assertXpathEquals(bean, "@init-method", "init1");
assertXpathEquals(bean, "@destroy-method", "destroy1");
assertXpathEquals(bean, "@factory-ref", "basicBean");
assertXpathEquals(bean, "@factory-method", "getBean3");
}
@Test
public void typedProperties() throws Exception {
Node service = getServiceByRef("serviceWithTypedParameters");
assertXpathEquals(service, "count(service-properties/entry)", "6");
assertXpathEquals(service, "service-properties/entry[@key='test1']/@value", "test");
assertXpathDoesNotExist(service, "service-properties/entry[@key='test2']/@value");
assertXpathEquals(service, "service-properties/entry[@key='test2']/value", "15");
assertXpathEquals(service, "service-properties/entry[@key='test2']/value/@type", "java.lang.Integer");
assertXpathDoesNotExist(service, "service-properties/entry[@key='test3']/@value");
assertXpathEquals(service, "service-properties/entry[@key='test3']/value", "true");
assertXpathEquals(service, "service-properties/entry[@key='test3']/value/@type", "java.lang.Boolean");
assertXpathDoesNotExist(service, "service-properties/entry[@key='test4']/@value");
assertXpathEquals(service, "service-properties/entry[@key='test4']/array/value[1]", "val1");
assertXpathEquals(service, "service-properties/entry[@key='test4']/array/value[2]", "val2");
assertXpathDoesNotExist(service, "service-properties/entry[@key='test4']/array/@value-type");
assertXpathDoesNotExist(service, "service-properties/entry[@key='test5']/@value");
assertXpathEquals(service, "service-properties/entry[@key='test5']/array/value[1]", "1");
assertXpathEquals(service, "service-properties/entry[@key='test5']/array/value[2]", "2");
assertXpathEquals(service, "service-properties/entry[@key='test5']/array/value[3]", "3");
assertXpathEquals(service, "service-properties/entry[@key='test5']/array/@value-type", "java.lang.Short");
assertXpathDoesNotExist(service, "service-properties/entry[@key='test6']/@value");
assertXpathEquals(service, "service-properties/entry[@key='test6']/array/value[1]", "1.5");
assertXpathEquals(service, "service-properties/entry[@key='test6']/array/value[2]", "0.8");
assertXpathEquals(service, "service-properties/entry[@key='test6']/array/value[3]", "-7.1");
assertXpathEquals(service, "service-properties/entry[@key='test6']/array/@value-type", "java.lang.Double");
}
@Test
public void shouldInjectDependencyByQualifierFromFactory() throws Exception {
Node bean1 = getBeanById("testBean1");
assertXpathEquals(bean1, "@factory-method", "create1");
Node bean2 = getBeanById("testBean2");
assertXpathEquals(bean2, "@factory-method", "create2");
Node consumer = getBeanById("testConsumer");
assertXpathEquals(consumer, "argument[1]/@ref", "testBean1");
assertXpathEquals(consumer, "argument[2]/@ref", "testBean2");
}
@Test
public void shouldGeneratePropertyPlaceholder() throws Exception {
Node propertyPlaceholder = getPropertyPlaceholderByPersistentId("org.apache.aries.my");
assertXpathEquals(propertyPlaceholder, "@placeholder-prefix", "$[");
assertXpathEquals(propertyPlaceholder, "@placeholder-suffix", "]");
assertXpathEquals(propertyPlaceholder, "@update-strategy", "reload");
assertXpathEquals(propertyPlaceholder, "count(default-properties/property)", "2");
assertXpathEquals(propertyPlaceholder, "default-properties/property[@name='title']/@value", "My Title");
assertXpathEquals(propertyPlaceholder, "default-properties/property[@name='test2']/@value", "v2");
}
@Test
public void shouldInjectListViaField() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='listFieldInject']/list/ref)", "4");
assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[1]/@component-id", "i1Impl1");
assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[2]/@component-id", "i1Impl2");
assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[3]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "property[@name='listFieldInject']/list/ref[4]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectSetViaField() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='setFieldInject']/set/ref)", "4");
assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[1]/@component-id", "i1Impl1");
assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[2]/@component-id", "i1Impl2");
assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[3]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "property[@name='setFieldInject']/set/ref[4]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectArrayViaField() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='arrayFieldInject']/array/ref)", "3");
assertXpathEquals(bean, "property[@name='arrayFieldInject']/array/ref[1]/@component-id", "i2Impl1");
assertXpathEquals(bean, "property[@name='arrayFieldInject']/array/ref[2]/@component-id", "i2Impl2Annotated");
assertXpathEquals(bean, "property[@name='arrayFieldInject']/array/ref[3]/@component-id", "i2Impl3Annotated");
}
@Test
public void shouldInjectAnnotatedSetViaField() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='annotatedSetFieldInject']/set/ref)", "2");
assertXpathEquals(bean, "property[@name='annotatedSetFieldInject']/set/ref[1]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "property[@name='annotatedSetFieldInject']/set/ref[2]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectListViaSetter() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='listSetterInject']/list/ref)", "4");
assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[1]/@component-id", "i1Impl1");
assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[2]/@component-id", "i1Impl2");
assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[3]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "property[@name='listSetterInject']/list/ref[4]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectSetViaSetter() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='setSetterInject']/set/ref)", "3");
assertXpathEquals(bean, "property[@name='setSetterInject']/set/ref[1]/@component-id", "i2Impl1");
assertXpathEquals(bean, "property[@name='setSetterInject']/set/ref[2]/@component-id", "i2Impl2Annotated");
assertXpathEquals(bean, "property[@name='setSetterInject']/set/ref[3]/@component-id", "i2Impl3Annotated");
}
@Test
public void shouldInjectArrayViaSetter() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='arraySetterInject']/array/ref)", "4");
assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[1]/@component-id", "i1Impl1");
assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[2]/@component-id", "i1Impl2");
assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[3]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "property[@name='arraySetterInject']/array/ref[4]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectAnnotatedArrayViaSetter() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(property[@name='annotatedArraySetterInject']/array/ref)", "2");
assertXpathEquals(bean, "property[@name='annotatedArraySetterInject']/array/ref[1]/@component-id", "i2Impl2Annotated");
assertXpathEquals(bean, "property[@name='annotatedArraySetterInject']/array/ref[2]/@component-id", "i2Impl3Annotated");
}
@Test
public void shouldInjectListViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[1]/list/ref)", "4");
assertXpathEquals(bean, "argument[1]/list/ref[1]/@component-id", "i1Impl1");
assertXpathEquals(bean, "argument[1]/list/ref[2]/@component-id", "i1Impl2");
assertXpathEquals(bean, "argument[1]/list/ref[3]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "argument[1]/list/ref[4]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectSetViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[2]/set/ref)", "4");
assertXpathEquals(bean, "argument[2]/set/ref[1]/@component-id", "i1Impl1");
assertXpathEquals(bean, "argument[2]/set/ref[2]/@component-id", "i1Impl2");
assertXpathEquals(bean, "argument[2]/set/ref[3]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "argument[2]/set/ref[4]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectArrayViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[3]/array/ref)", "3");
assertXpathEquals(bean, "argument[3]/array/ref[1]/@component-id", "i2Impl1");
assertXpathEquals(bean, "argument[3]/array/ref[2]/@component-id", "i2Impl2Annotated");
assertXpathEquals(bean, "argument[3]/array/ref[3]/@component-id", "i2Impl3Annotated");
}
@Test
public void shouldInjectAnnotatedListViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[4]/list/ref)", "2");
assertXpathEquals(bean, "argument[4]/list/ref[1]/@component-id", "i1Impl3Annotated");
assertXpathEquals(bean, "argument[4]/list/ref[2]/@component-id", "i1Impl4Annotated");
}
@Test
public void shouldInjectEmptyListViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[5]/list)", "1");
assertXpathEquals(bean, "count(argument[5]/list/ref)", "0");
}
@Test
public void shouldInjectEmptySetViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[6]/set)", "1");
assertXpathEquals(bean, "count(argument[6]/set/ref)", "0");
}
@Test
public void shouldInjectEmptyArrayViaConstructor() throws Exception {
Node bean = getBeanById("beanWithCollections");
assertXpathEquals(bean, "count(argument[7]/array)", "1");
assertXpathEquals(bean, "count(argument[7]/array/ref)", "0");
}
@Test
public void shouldFindTypeConverters() throws Exception {
Node typeConverters = getTypeConverters();
assertXpathEquals(typeConverters, "count(*)", "2");
assertXpathEquals(typeConverters, "ref[1]/@component-id", "converter1");
assertXpathEquals(typeConverters, "ref[2]/@component-id", "converter2");
}
@Test
public void shouldInjectReferenceViaField() throws Exception {
Node bean = getBeanById("beanWithReferences");
assertXpathEquals(bean, "property[@name='ref1Field']/@ref", "ref1");
assertXpathEquals(bean, "property[@name='myRef1Field']/@ref", "myRef1");
assertXpathEquals(bean, "property[@name='myRef1FieldAllProps']/@ref", "ref1-a453-r1-optional-2000");
assertXpathEquals(bean, "property[@name='myRef1FieldFilter']/@ref", "ref1-x1");
}
@Test
public void shouldGenerateReferenceFromBeanField() throws Exception {
Node ref1 = getReferenceById("ref1");
assertXpathEquals(ref1, "@interface", Ref1.class.getName());
Node myRef1 = getReferenceById("myRef1");
assertXpathEquals(myRef1, "@interface", Ref1.class.getName());
Node ref1a453r1 = getReferenceById("ref1-a453-r1-optional-2000");
assertXpathEquals(ref1a453r1, "@interface", Ref1.class.getName());
assertXpathEquals(ref1a453r1, "@component-name", "r1");
assertXpathEquals(ref1a453r1, "@filter", "(a=453)");
assertXpathEquals(ref1a453r1, "@timeout", "2000");
assertXpathEquals(ref1a453r1, "@availability", "optional");
Node ref1x1 = getReferenceById("ref1-x1");
assertXpathEquals(ref1x1, "@interface", Ref1.class.getName());
assertXpathEquals(ref1x1, "@filter", "(x=1)");
assertXpathEquals(ref1x1, "count(@component-name)", "0");
}
@Test
public void shouldInjectReferenceViaSetter() throws Exception {
Node bean = getBeanById("beanWithReferences");
assertXpathEquals(bean, "property[@name='ref2Setter']/@ref", "ref2");
assertXpathEquals(bean, "property[@name='ref2SetterNamed']/@ref", "myRef2");
assertXpathEquals(bean, "property[@name='ref2SetterFull']/@ref", "ref2-b453-r2-optional-1000");
assertXpathEquals(bean, "property[@name='ref2SetterComponent']/@ref", "ref2--blablabla");
}
@Test
public void shouldGenerateReferenceFromBeanSetter() throws Exception {
Node ref2 = getReferenceById("ref2");
assertXpathEquals(ref2, "@interface", Ref2.class.getName());
Node myRef2 = getReferenceById("myRef2");
assertXpathEquals(myRef2, "@interface", Ref2.class.getName());
Node ref1b453r2 = getReferenceById("ref2-b453-r2-optional-1000");
assertXpathEquals(ref1b453r2, "@interface", Ref2.class.getName());
assertXpathEquals(ref1b453r2, "@component-name", "r2");
assertXpathEquals(ref1b453r2, "@filter", "(b=453)");
assertXpathEquals(ref1b453r2, "@timeout", "1000");
assertXpathEquals(ref1b453r2, "@availability", "optional");
Node ref2blablabla = getReferenceById("ref2--blablabla");
assertXpathEquals(ref2blablabla, "@interface", Ref2.class.getName());
assertXpathEquals(ref2blablabla, "@component-name", "blablabla");
assertXpathEquals(ref2blablabla, "count(@filter)", "0");
}
@Test
public void shouldInjectReferenceViaConstructor() throws Exception {
Node bean = getBeanById("beanWithReferences");
assertXpathEquals(bean, "argument[1]/@ref", "ref1");
assertXpathEquals(bean, "argument[2]/@ref", "ref2---optional-20000");
assertXpathEquals(bean, "argument[3]/@ref", "ref1-y3");
assertXpathEquals(bean, "argument[4]/@ref", "ref1--compForConstr");
assertXpathEquals(bean, "argument[5]/@ref", "ref1-y3-compForConstr");
assertXpathEquals(bean, "argument[6]/@ref", "ref1ForCons");
}
@Test
public void shouldGenerateReferenceFromBeanConstructor() throws Exception {
Node ref1 = getReferenceById("ref1");
assertXpathEquals(ref1, "@interface", Ref1.class.getName());
Node ref2optional20000 = getReferenceById("ref2---optional-20000");
assertXpathEquals(ref2optional20000, "@interface", Ref2.class.getName());
assertXpathEquals(ref2optional20000, "@timeout", "20000");
assertXpathEquals(ref2optional20000, "@availability", "optional");
Node ref1y3 = getReferenceById("ref1-y3");
assertXpathEquals(ref1y3, "@interface", Ref1.class.getName());
assertXpathEquals(ref1y3, "count(@component-name)", "0");
assertXpathEquals(ref1y3, "@filter", "(y=3)");
Node ref1compForConstr = getReferenceById("ref1--compForConstr");
assertXpathEquals(ref1compForConstr, "@interface", Ref1.class.getName());
assertXpathEquals(ref1compForConstr, "@component-name", "compForConstr");
assertXpathEquals(ref1compForConstr, "count(@filter)", "0");
Node ref1y3compForConstr = getReferenceById("ref1-y3-compForConstr");
assertXpathEquals(ref1y3compForConstr, "@interface", Ref1.class.getName());
assertXpathEquals(ref1y3compForConstr, "@component-name", "compForConstr");
assertXpathEquals(ref1y3compForConstr, "@filter", "(y=3)");
Node ref1ForCons = getReferenceById("ref1ForCons");
assertXpathEquals(ref1ForCons, "@interface", Ref1.class.getName());
assertXpathEquals(ref1ForCons, "@availability", "optional");
}
@Test
public void shouldInjectReferenceToProducedBean() throws Exception {
Node bean = getBeanById("producedWithReferences");
assertXpathEquals(bean, "argument[1]/@ref", "ref3");
assertXpathEquals(bean, "argument[2]/@ref", "ref4----20000");
assertXpathEquals(bean, "argument[3]/@ref", "ref4---optional");
assertXpathEquals(bean, "argument[4]/@ref", "ref3-y3");
assertXpathEquals(bean, "argument[5]/@ref", "ref3--compForProduces");
assertXpathEquals(bean, "argument[6]/@ref", "ref3-y3-compForProduces");
assertXpathEquals(bean, "argument[7]/@ref", "ref3ForProduces");
}
@Test
public void shouldGenerateReferenceFromProducedBean() throws Exception {
Node ref3 = getReferenceById("ref3");
assertXpathEquals(ref3, "@interface", Ref3.class.getName());
Node ref420000 = getReferenceById("ref4----20000");
assertXpathEquals(ref420000, "@interface", Ref4.class.getName());
assertXpathEquals(ref420000, "@timeout", "20000");
Node ref4optional = getReferenceById("ref4---optional");
assertXpathEquals(ref4optional, "@interface", Ref4.class.getName());
assertXpathEquals(ref4optional, "@availability", "optional");
Node ref3y3 = getReferenceById("ref3-y3");
assertXpathEquals(ref3y3, "@interface", Ref3.class.getName());
assertXpathEquals(ref3y3, "count(@component-name)", "0");
assertXpathEquals(ref3y3, "@filter", "(y=3)");
Node ref3compForProduces = getReferenceById("ref3--compForProduces");
assertXpathEquals(ref3compForProduces, "@interface", Ref3.class.getName());
assertXpathEquals(ref3compForProduces, "@component-name", "compForProduces");
assertXpathEquals(ref3compForProduces, "count(@filter)", "0");
Node ref3y3compForProduces = getReferenceById("ref3-y3-compForProduces");
assertXpathEquals(ref3y3compForProduces, "@interface", Ref3.class.getName());
assertXpathEquals(ref3y3compForProduces, "@component-name", "compForProduces");
assertXpathEquals(ref3y3compForProduces, "@filter", "(y=3)");
Node ref1ForCons = getReferenceById("ref3ForProduces");
assertXpathEquals(ref1ForCons, "@interface", Ref3.class.getName());
assertXpathEquals(ref1ForCons, "@timeout", "1000");
}
@Test
public void shouldGenerateSimplestServiceFromBean() throws XPathExpressionException {
Node service = getServiceByRef("simplestService");
assertXpathEquals(service, "@auto-export", "interfaces");
assertXpathDoesNotExist(service, "service-properties");
}
@Test
public void shouldGenerateServiceWithAllClassesFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithAllClasses");
assertXpathEquals(service, "@auto-export", "all-classes");
}
@Test
public void shouldGenerateServiceWithClassHierarchyFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithClassHierarchy");
assertXpathEquals(service, "@auto-export", "class-hierarchy");
}
@Test
public void shouldGenerateServiceWithOneInterfaceFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithOneInterface");
assertXpathEquals(service, "count(@auto-export)", "0");
assertXpathEquals(service, "count(interfaces)", "0");
assertXpathEquals(service, "@interface", Service1.class.getName());
}
@Test
public void shouldGenerateServiceWithManyInterfacesFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithManyInterfaces");
assertXpathEquals(service, "count(@auto-export)", "0");
assertXpathEquals(service, "count(@interface)", "0");
assertXpathEquals(service, "count(interfaces/value)", "2");
assertXpathEquals(service, "interfaces/value[1]", Service1.class.getName());
assertXpathEquals(service, "interfaces/value[2]", Service2.class.getName());
}
@Test
public void shouldGenerateServiceWithRankingFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithRankingParameter");
assertXpathEquals(service, "@ranking", "1000");
}
@Test
public void shouldGenerateServiceWithRankingAndPropertyFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithRankingAndProperty");
assertXpathEquals(service, "@ranking", "2");
assertXpathDoesNotExist(service, "service-properties");
}
@Test
public void shouldGenerateServiceWithPropertiesFromBean() throws XPathExpressionException {
Node service = getServiceByRef("serviceWithProperties");
assertXpathEquals(service, "count(service-properties/entry)", "4");
assertXpathEquals(service, "service-properties/entry[@key='oneValue']/@value", "test");
assertXpathEquals(service, "count(service-properties/entry[@key='oneValue']/value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='intValue']/@value)", "0");
assertXpathEquals(service, "service-properties/entry[@key='intValue']/value/@type", Integer.class.getName());
assertXpathEquals(service, "service-properties/entry[@key='intValue']/value/text()", "1");
assertXpathEquals(service, "count(service-properties/entry[@key='longArray']/@value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='longArray']/value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='longArray']/array/value)", "3");
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/@value-type", Long.class.getName());
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/value[1]", "1");
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/value[2]", "2");
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/value[3]", "3");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/@value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/array/value)", "2");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/array/@value-type)", "0");
assertXpathEquals(service, "service-properties/entry[@key='stringArray']/array/value[1]", "a");
assertXpathEquals(service, "service-properties/entry[@key='stringArray']/array/value[2]", "b");
}
@Test
public void shouldGenerateSimplestServiceFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedSimplestService");
assertXpathEquals(service, "@auto-export", "interfaces");
assertXpathDoesNotExist(service, "service-properties");
}
@Test
public void shouldGenerateServiceWithAllClassesFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithAllClasses");
assertXpathEquals(service, "@auto-export", "all-classes");
}
@Test
public void shouldGenerateServiceWithClassHierarchyFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithClassHierarchy");
assertXpathEquals(service, "@auto-export", "class-hierarchy");
}
@Test
public void shouldGenerateServiceWithOneInterfaceFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithOneInterface");
assertXpathEquals(service, "count(@auto-export)", "0");
assertXpathEquals(service, "count(interfaces)", "0");
assertXpathEquals(service, "@interface", Service2.class.getName());
}
@Test
public void shouldGenerateServiceWithManyInterfacesFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithManyInterfaces");
assertXpathEquals(service, "count(@auto-export)", "0");
assertXpathEquals(service, "count(@interface)", "0");
assertXpathEquals(service, "count(interfaces/value)", "2");
assertXpathEquals(service, "interfaces/value[1]", Service1.class.getName());
assertXpathEquals(service, "interfaces/value[2]", Service2.class.getName());
}
@Test
public void shouldGenerateServiceWithRankingFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithRanking");
assertXpathEquals(service, "@ranking", "200");
}
@Test
public void shouldGenerateServiceWithRankingAndPropertyFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithRankingAndProperies");
assertXpathEquals(service, "@ranking", "-9");
assertXpathEquals(service, "count(service-properties/entry)", "1");
assertXpathEquals(service, "service-properties/entry[@key='a']/@value", "1");
}
@Test
public void shouldGenerateServiceWithPropertiesFromFactory() throws XPathExpressionException {
Node service = getServiceByRef("producedServiceWithProperies");
assertXpathEquals(service, "count(service-properties/entry)", "5");
assertXpathEquals(service, "service-properties/entry[@key='oneValue']/@value", "test");
assertXpathEquals(service, "count(service-properties/entry[@key='oneValue']/value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='intValue']/@value)", "0");
assertXpathEquals(service, "service-properties/entry[@key='intValue']/value/@type", Integer.class.getName());
assertXpathEquals(service, "service-properties/entry[@key='intValue']/value/text()", "1");
assertXpathEquals(service, "count(service-properties/entry[@key='longArray']/@value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='longArray']/value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='longArray']/array/value)", "3");
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/@value-type", Long.class.getName());
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/value[1]", "1");
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/value[2]", "2");
assertXpathEquals(service, "service-properties/entry[@key='longArray']/array/value[3]", "3");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/@value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/value)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/array/value)", "2");
assertXpathEquals(service, "count(service-properties/entry[@key='stringArray']/array/@value-type)", "0");
assertXpathEquals(service, "service-properties/entry[@key='stringArray']/array/value[1]", "a");
assertXpathEquals(service, "service-properties/entry[@key='stringArray']/array/value[2]", "b");
assertXpathEquals(service, "count(@ranking)", "0");
assertXpathEquals(service, "count(service-properties/entry[@key='service.ranking']/@value)", "0");
assertXpathEquals(service, "service-properties/entry[@key='service.ranking']/value/@type", Integer.class.getName());
assertXpathEquals(service, "service-properties/entry[@key='service.ranking']/value/text()", "5");
}
@Test
public void shouldInjectReferenceListViaField() throws Exception {
Node bean = getBeanById("beanWithReferenceLists");
assertXpathEquals(bean, "property[@name='ref1Field']/@ref", "listOf-ref1");
assertXpathEquals(bean, "property[@name='myRef1Field']/@ref", "myRef1List");
assertXpathEquals(bean, "property[@name='myRef1FieldAllProps']/@ref", "listOf-ref1-a453-r1-optional");
assertXpathEquals(bean, "property[@name='myRef1FieldFilter']/@ref", "listOf-ref1-x1---reference");
}
@Test
public void shouldGenerateReferenceListFromBeanField() throws Exception {
Node ref1 = getReferenceListById("listOf-ref1");
assertXpathEquals(ref1, "@interface", Ref1.class.getName());
assertXpathEquals(ref1, "count(@member-type)", "0");
Node myRef1 = getReferenceListById("myRef1List");
assertXpathEquals(myRef1, "@interface", Ref1.class.getName());
Node ref1a453r1 = getReferenceListById("listOf-ref1-a453-r1-optional");
assertXpathEquals(ref1a453r1, "@interface", Ref1.class.getName());
assertXpathEquals(ref1a453r1, "@component-name", "r1");
assertXpathEquals(ref1a453r1, "@filter", "(a=453)");
assertXpathEquals(ref1a453r1, "@availability", "optional");
Node ref1x1 = getReferenceListById("listOf-ref1-x1---reference");
assertXpathEquals(ref1x1, "@interface", Ref1.class.getName());
assertXpathEquals(ref1x1, "@filter", "(x=1)");
assertXpathEquals(ref1x1, "count(@component-name)", "0");
assertXpathEquals(ref1x1, "@member-type", "service-reference");
}
@Test
public void shouldInjectReferenceListViaSetter() throws Exception {
Node bean = getBeanById("beanWithReferenceLists");
assertXpathEquals(bean, "property[@name='ref2Setter']/@ref", "listOf-ref2");
assertXpathEquals(bean, "property[@name='ref2SetterNamed']/@ref", "myRef2List");
assertXpathEquals(bean, "property[@name='ref2SetterFull']/@ref", "listOf-ref2-b453-r2-optional");
assertXpathEquals(bean, "property[@name='ref2SetterComponent']/@ref", "listOf-ref2--blablabla--reference");
}
@Test
public void shouldGenerateReferenceListFromBeanSetter() throws Exception {
Node ref2 = getReferenceListById("listOf-ref2");
assertXpathEquals(ref2, "@interface", Ref2.class.getName());
assertXpathEquals(ref2, "count(@member-type)", "0");
Node myRef2 = getReferenceListById("myRef2List");
assertXpathEquals(myRef2, "@interface", Ref2.class.getName());
Node ref1b453r2 = getReferenceListById("listOf-ref2-b453-r2-optional");
assertXpathEquals(ref1b453r2, "@interface", Ref2.class.getName());
assertXpathEquals(ref1b453r2, "@component-name", "r2");
assertXpathEquals(ref1b453r2, "@filter", "(b=453)");
assertXpathEquals(ref1b453r2, "@availability", "optional");
Node ref2blablabla = getReferenceListById("listOf-ref2--blablabla--reference");
assertXpathEquals(ref2blablabla, "@interface", Ref2.class.getName());
assertXpathEquals(ref2blablabla, "@component-name", "blablabla");
assertXpathEquals(ref2blablabla, "count(@filter)", "0");
assertXpathEquals(ref2blablabla, "@member-type", "service-reference");
}
@Test
public void shouldInjectReferenceListViaConstructor() throws Exception {
Node bean = getBeanById("beanWithReferenceLists");
assertXpathEquals(bean, "argument[1]/@ref", "listOf-ref1");
assertXpathEquals(bean, "argument[2]/@ref", "listOf-ref2---optional-reference");
assertXpathEquals(bean, "argument[3]/@ref", "listOf-ref1-y3");
assertXpathEquals(bean, "argument[4]/@ref", "listOf-ref1--compForConstr");
assertXpathEquals(bean, "argument[5]/@ref", "listOf-ref1-y3-compForConstr");
assertXpathEquals(bean, "argument[6]/@ref", "ref1ListForCons");
}
@Test
public void shouldGenerateReferenceListFromBeanConstructor() throws Exception {
Node ref1 = getReferenceListById("listOf-ref1");
assertXpathEquals(ref1, "@interface", Ref1.class.getName());
assertXpathEquals(ref1, "count(@member-type)", "0");
Node ref2optional20000 = getReferenceListById("listOf-ref2---optional-reference");
assertXpathEquals(ref2optional20000, "@interface", Ref2.class.getName());
assertXpathEquals(ref2optional20000, "@availability", "optional");
assertXpathEquals(ref2optional20000, "@member-type", "service-reference");
Node ref1y3 = getReferenceListById("listOf-ref1-y3");
assertXpathEquals(ref1y3, "@interface", Ref1.class.getName());
assertXpathEquals(ref1y3, "count(@component-name)", "0");
assertXpathEquals(ref1y3, "@filter", "(y=3)");
Node ref1compForConstr = getReferenceListById("listOf-ref1--compForConstr");
assertXpathEquals(ref1compForConstr, "@interface", Ref1.class.getName());
assertXpathEquals(ref1compForConstr, "@component-name", "compForConstr");
assertXpathEquals(ref1compForConstr, "count(@filter)", "0");
Node ref1y3compForConstr = getReferenceListById("listOf-ref1-y3-compForConstr");
assertXpathEquals(ref1y3compForConstr, "@interface", Ref1.class.getName());
assertXpathEquals(ref1y3compForConstr, "@component-name", "compForConstr");
assertXpathEquals(ref1y3compForConstr, "@filter", "(y=3)");
Node ref1ForCons = getReferenceListById("ref1ListForCons");
assertXpathEquals(ref1ForCons, "@interface", Ref1.class.getName());
assertXpathEquals(ref1ForCons, "@availability", "optional");
}
@Test
public void shouldInjectReferenceListToProducedBean() throws Exception {
Node bean = getBeanById("producedWithReferenceLists");
assertXpathEquals(bean, "argument[1]/@ref", "listOf-ref3");
assertXpathEquals(bean, "argument[2]/@ref", "listOf-ref4---optional");
assertXpathEquals(bean, "argument[3]/@ref", "listOf-ref3-y3");
assertXpathEquals(bean, "argument[4]/@ref", "listOf-ref3--compForProduces");
assertXpathEquals(bean, "argument[5]/@ref", "listOf-ref3-y3-compForProduces--reference");
assertXpathEquals(bean, "argument[6]/@ref", "ref3ListForProduces");
}
@Test
public void shouldGenerateReferenceListFromProducedBean() throws Exception {
Node ref3 = getReferenceListById("listOf-ref3");
assertXpathEquals(ref3, "@interface", Ref3.class.getName());
assertXpathEquals(ref3, "count(@member-type)", "0");
Node ref4optional = getReferenceListById("listOf-ref4---optional");
assertXpathEquals(ref4optional, "@interface", Ref4.class.getName());
assertXpathEquals(ref4optional, "@availability", "optional");
Node ref3y3 = getReferenceListById("listOf-ref3-y3");
assertXpathEquals(ref3y3, "@interface", Ref3.class.getName());
assertXpathEquals(ref3y3, "count(@component-name)", "0");
assertXpathEquals(ref3y3, "@filter", "(y=3)");
Node ref3compForProduces = getReferenceListById("listOf-ref3--compForProduces");
assertXpathEquals(ref3compForProduces, "@interface", Ref3.class.getName());
assertXpathEquals(ref3compForProduces, "@component-name", "compForProduces");
assertXpathEquals(ref3compForProduces, "count(@filter)", "0");
Node ref3y3compForProduces = getReferenceListById("listOf-ref3-y3-compForProduces--reference");
assertXpathEquals(ref3y3compForProduces, "@interface", Ref3.class.getName());
assertXpathEquals(ref3y3compForProduces, "@component-name", "compForProduces");
assertXpathEquals(ref3y3compForProduces, "@filter", "(y=3)");
assertXpathEquals(ref3y3compForProduces, "@member-type", "service-reference");
Node ref1ForCons = getReferenceListById("ref3ListForProduces");
assertXpathEquals(ref1ForCons, "@interface", Ref3.class.getName());
}
private void assertXpathDoesNotExist(Node node, String xpathExpression) throws XPathExpressionException {
assertXpathEquals(node, "count(" + xpathExpression + ")", "0");
}
private void assertXpathEquals(Node node, String xpathExpression, String expected) throws XPathExpressionException {
assertEquals(expected, xpath.evaluate(xpathExpression, node));
}
private static Document readToDocument(byte[] xmlAsBytes, boolean nameSpaceAware) throws ParserConfigurationException,
SAXException, IOException {
InputStream is = new ByteArrayInputStream(xmlAsBytes);
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(nameSpaceAware);
DocumentBuilder builder = builderFactory.newDocumentBuilder();
return builder.parse(is);
}
private static Node getBeanById(String id) throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/bean[@id='" + id + "']", document, XPathConstants.NODE);
}
private static Node getTypeConverters() throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/type-converters", document, XPathConstants.NODE);
}
private static Node getCmPropertiesById(String id) throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/cm-properties[@id='" + id + "']", document, XPathConstants.NODE);
}
private static Node getServiceByRef(String id) throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/service[@ref='" + id + "']", document, XPathConstants.NODE);
}
private static Node getReferenceById(String id) throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/reference[@id='" + id + "']", document, XPathConstants.NODE);
}
private static Node getReferenceListById(String id) throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/reference-list[@id='" + id + "']", document, XPathConstants.NODE);
}
private static Node getPropertyPlaceholderByPersistentId(String id) throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/property-placeholder[@persistent-id='" + id + "']", document, XPathConstants.NODE);
}
}
| 9,247 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/Namespaces.java | /**
* 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.aries.blueprint.plugin;
import java.util.Iterator;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import org.w3c.dom.Document;
public class Namespaces implements NamespaceContext {
private Document doc;
public Namespaces(Document doc) {
this.doc = doc;
}
@Override
public String getNamespaceURI(String prefix) {
if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
return doc.lookupNamespaceURI(null);
} else {
return doc.lookupNamespaceURI(prefix);
}
}
@Override
public String getPrefix(String namespaceURI) {
return doc.lookupPrefix(namespaceURI);
}
@Override
public Iterator<String> getPrefixes(String namespaceURI) {
return null;
}
} | 9,248 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/EnableAnnotationTest.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin;
import org.apache.aries.blueprint.plugin.model.Blueprint;
import org.apache.aries.blueprint.plugin.test.transactionenable.TxBean;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.xbean.finder.ClassFinder;
import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static org.apache.aries.blueprint.plugin.FilteredClassFinder.findClasses;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
public class EnableAnnotationTest {
private static final String NS_JPA = "http://aries.apache.org/xmlns/jpa/v1.1.0";
private static final String NS_TX1_0 = "http://aries.apache.org/xmlns/transactions/v1.0.0";
private static final String NS_TX1_1 = "http://aries.apache.org/xmlns/transactions/v1.1.0";
private static final String NS_TX1_2 = "http://aries.apache.org/xmlns/transactions/v1.2.0";
private static Set<Class<?>> beanClasses;
private XPath xpath;
private Document document;
private byte[] xmlAsBytes;
@BeforeClass
public static void setUp() throws Exception {
ClassFinder classFinder = new ClassFinder(EnableAnnotationTest.class.getClassLoader());
beanClasses = findClasses(classFinder, Arrays.asList(
TxBean.class.getPackage().getName()));
}
private void writeXML(String namespace, String enableAnnotations) throws XMLStreamException,
UnsupportedEncodingException, ParserConfigurationException, SAXException, IOException {
Set<String> namespaces = new HashSet<>(Arrays.asList(NS_JPA, namespace));
Map<String, String> customParameters = new HashMap<>();
customParameters.put("transaction.enableAnnotation", enableAnnotations);
BlueprintConfigurationImpl blueprintConfiguration = new BlueprintConfigurationImpl(namespaces, null, customParameters, null, null);
Blueprint blueprint = new Blueprint(blueprintConfiguration, beanClasses);
ByteArrayOutputStream os = new ByteArrayOutputStream();
new BlueprintFileWriter(os).write(blueprint);
xmlAsBytes = os.toByteArray();
System.out.println(new String(xmlAsBytes, "UTF-8"));
document = readToDocument(xmlAsBytes, false);
xpath = XPathFactory.newInstance().newXPath();
}
@Test
public void testNS1_0() throws Exception {
writeXML(NS_TX1_0, "true");
assertNull(getEnableAnnotationTx1());
}
@Test
public void testNS1_1() throws Exception {
writeXML(NS_TX1_1, "true");
assertNull(getEnableAnnotationTx1());
}
@Test
public void testNS1_2_enabled() throws Exception {
writeXML(NS_TX1_2, "true");
assertNotNull(getEnableAnnotationTx1());
}
@Test
public void testNS1_2_disabled() throws Exception {
writeXML(NS_TX1_2, "false");
assertNull(getEnableAnnotationTx1());
}
@Test
public void testNS1_2_default() throws Exception {
writeXML(NS_TX1_2, null);
assertNotNull(getEnableAnnotationTx1());
}
private Document readToDocument(byte[] xmlAsBytes, boolean nameSpaceAware)
throws ParserConfigurationException,
SAXException, IOException {
InputStream is = new ByteArrayInputStream(xmlAsBytes);
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(nameSpaceAware);
DocumentBuilder builder = builderFactory.newDocumentBuilder();
return builder.parse(is);
}
private Node getEnableAnnotationTx1() throws XPathExpressionException {
return (Node) xpath.evaluate("/blueprint/enable-annotations", document, XPathConstants.NODE);
}
}
| 9,249 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/extension/InitContextExample.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.extension;
import org.apache.aries.blueprint.plugin.spi.ContextEnricher;
import org.apache.aries.blueprint.plugin.spi.ContextInitializationHandler;
import org.apache.aries.blueprint.plugin.spi.XmlWriter;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.util.Map;
public class InitContextExample implements ContextInitializationHandler {
@Override
public void initContext(ContextEnricher contextEnricher) {
final Map<String, String> customParameters = contextEnricher.getBlueprintConfiguration().getCustomParameters();
for (final String param : customParameters.keySet()) {
if (param.startsWith("example.")) {
final String key = param.split("\\.")[1];
contextEnricher.addBlueprintContentWriter("enrichContextWithExample-" + key, new XmlWriter() {
@Override
public void write(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
xmlStreamWriter.writeEmptyElement("example");
xmlStreamWriter.writeDefaultNamespace("http://exampleNamespace");
xmlStreamWriter.writeAttribute("id", key);
xmlStreamWriter.writeAttribute("value", customParameters.get(param));
}
});
}
}
}
}
| 9,250 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean6.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
import javax.inject.Singleton;
@Singleton
@DependsOn
public class MyBean6 {
public MyBean6(@Named("my2") ServiceA serviceA1) {
}
}
| 9,251 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl3.java | /**
* 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.aries.blueprint.plugin.test;
import javax.inject.Singleton;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import org.ops4j.pax.cdi.api.OsgiServiceProvider;
@Singleton
@OsgiServiceProvider
public class ServiceAImpl3 implements ServiceA
{
}
| 9,252 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyFactoryNamedBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Lazy;
import javax.enterprise.inject.Produces;
import javax.inject.Named;
import javax.inject.Singleton;
@Singleton
public class MyFactoryNamedBean {
@Produces
@Named("produced1")
public MyProduced createBean1() {
return new MyProduced("My message");
}
@Produces
@Named("produced2")
@Singleton
@DependsOn("produced1")
public MyProduced createBean2() {
return new MyProduced("My message");
}
@Produces
@Named("producedEager")
@Singleton
@Lazy(false)
public MyProduced createBean2AsEager() {
return new MyProduced("My message");
}
}
| 9,253 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferencesParent.java | /**
* 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.aries.blueprint.plugin.test;
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;
@Named("serviceB2Id") @Inject @OsgiService(filter="(type=B2)") ServiceB serviceB2;
@Inject @OsgiService(filter="(type=B3)") ServiceB serviceB3;
}
| 9,254 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyProducedWithConstructor.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
import javax.inject.Named;
public class MyProducedWithConstructor {
@Inject
public MyProducedWithConstructor(@OsgiService @Named("unknown") ServiceA serviceA) {
}
}
| 9,255 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl2.java | /**
* 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.aries.blueprint.plugin.test;
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;
@Singleton
@Named("my2")
@OsgiServiceProvider(classes={ServiceA.class})
public class ServiceAImpl2 implements ServiceA {
@Value("${url:http://default}")
String url;
}
| 9,256 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean7.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
@Singleton
public class MyBean7 {
public MyBean7(@OsgiService ServiceD serviceD) {
}
}
| 9,257 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/BeanWithSetters.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
@Singleton
@Lazy(false)
public class BeanWithSetters {
@Inject
@Named("my1")
public void setServiceA1(ServiceA serviceA1) {
}
@Inject
@Qualifier("my2")
public void setServiceA2(ServiceA serviceA2) {
}
@Autowired
public void setServiceB(ServiceB serviceB) {
}
@Inject
@Named("serviceB2Id")
public void setServiceB2(ServiceB serviceB2) {
}
public void setUseless(MyProduced myProduced) {
}
@Inject
public void setIOnlyHaveSetPrefix() {
}
@Inject
public void setIhaveMoreThenOneParameter(String a, String b) {
}
@Value("test")
public void setIOnlyHaveSetPrefixValue() {
}
@Value("test")
public void setIhaveMoreThenOneParameterValue(String a, String b) {
}
@Value("test")
public void setMyValue(String v) {
}
@Inject
public void setServiceBRef(@OsgiService(filter = "(type=B1Ref)") ServiceB serviceBRef) {
}
@Inject
@Named("serviceB2IdRef")
@OsgiService(filter = "(type=B2Ref)")
public void setServiceB2Ref(ServiceB serviceB2Ref) {
}
@Inject
@OsgiService(filter = "B3Ref")
public void setServiceB3Ref(ServiceB serviceB3Ref) {
}
}
| 9,258 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ParentBean.java | /**
* 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.aries.blueprint.plugin.test;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
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 {
@Autowired
ServiceA bean2;
@PersistenceContext(unitName="person")
EntityManager em;
@PersistenceUnit(unitName="person")
EntityManager emf;
@PostConstruct
public void overridenInit() {
}
@PreDestroy
public void destroy() {
}
@Transactional(Transactional.TxType.REQUIRES_NEW)
public void txOverridenWithoutTransactional() {
}
@Transactional(Transactional.TxType.SUPPORTS)
public void txSupports() {
}
@Transactional(Transactional.TxType.NEVER)
public void txOverridenWithRequiresNew() {
}
}
| 9,259 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java | /**
* 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.aries.blueprint.plugin.test;
import org.springframework.context.annotation.Lazy;
import javax.annotation.PostConstruct;
import javax.inject.Singleton;
import javax.transaction.Transactional;
import javax.transaction.Transactional.TxType;
@Singleton
@Transactional(value=TxType.REQUIRES_NEW)
@Lazy
public class MyBean1 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() {
}
@Transactional(TxType.MANDATORY)
public void txMandatory() {
}
@Transactional(TxType.NEVER)
public void txNever() {
}
@Transactional(TxType.REQUIRED)
public void txRequired() {
}
@Override
public void txOverridenWithoutTransactional() {
}
@Transactional(TxType.REQUIRES_NEW)
public void txOverridenWithRequiresNew() {
}
}
| 9,260 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyProduced.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
@Lazy
public class MyProduced {
private String message;
@Inject
ServiceA serviceA;
public MyProduced(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
}
| 9,261 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyFactoryBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
@Singleton
public class MyFactoryBean {
@Inject
ServiceB serviceB;
@Produces
public MyProduced create() {
return new MyProduced("My message");
}
@Produces
public MyProducedWithConstructor createBeanWithParameters(MyBean1 myBean1, @Value("100") int bla, @OsgiService(filter = "myRef") @Named("ser1") ServiceC myReference) {
return new MyProducedWithConstructor(null);
}
}
| 9,262 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferences.java | /**
* 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.aries.blueprint.plugin.test;
import org.springframework.stereotype.Component;
@Component
public class ServiceReferences extends ServiceReferencesParent {
}
| 9,263 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java | /**
* 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.aries.blueprint.plugin.test;
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;
@Named
@Transactional(propagation=Propagation.REQUIRES_NEW)
public class MyBean3 {
@Inject
@Named("my1")
ServiceA serviceA1;
@Inject
@Qualifier("my2")
ServiceA serviceA2;
@Inject
ServiceB serviceB;
@Inject
@Named("serviceB2Id")
ServiceB serviceB2;
@Inject
MyProduced myProduced;
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void txNotSupported() {
}
@Transactional(propagation = Propagation.MANDATORY)
public void txMandatory() {
}
@Transactional(propagation = Propagation.NEVER)
public void txNever() {
}
@Transactional(propagation = Propagation.REQUIRED)
public void txRequired() {
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void txRequiresNew() {
}
@Transactional(propagation = Propagation.SUPPORTS)
public void txSupports() {
}
}
| 9,264 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean4.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test;
import org.osgi.framework.BundleContext;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.inject.Inject;
@Component
@DependsOn({"myBean5", "myBean6"})
public class MyBean4 {
@Inject
BundleContext bundleContext;
@Transactional(propagation = Propagation.SUPPORTS)
public void txWithoutClassAnnotation() {
}
}
| 9,265 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImplQualified.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
@Singleton
@AnnotatedService
public class ServiceAImplQualified implements ServiceA {
}
| 9,266 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl1.java | /**
* 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.aries.blueprint.plugin.test;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import javax.inject.Named;
@Named("my1")
public class ServiceAImpl1 implements ServiceA {
}
| 9,267 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceABImpl.java | /**
* 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.aries.blueprint.plugin.test;
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
@OsgiServiceProvider(classes = {ServiceA.class, ServiceB.class})
public class ServiceABImpl implements ServiceA, ServiceB
{
}
| 9,268 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean5.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
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;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
@Singleton
@DependsOn("myBean6")
public class MyBean5 {
@Inject
public MyBean5(@Named("my2") ServiceA serviceA1,
ServiceA serviceA2,
ServiceB serviceB,
@Value("100") int bla,
@OsgiService(filter = "myRef") @Named("ser1") ServiceC myReference,
@OsgiService(filter = "(mode=123)") @Named("ser2") ServiceC myReference2,
@AnnotatedService ServiceA serviceAAnnotated,
@Named("produced2") MyProduced myProduced) {
}
public MyBean5() {
}
}
| 9,269 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/cditransactional/CdiTransactionalAnnotatedBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.cditransactional;
import org.apache.aries.blueprint.plugin.test.ParentBean;
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)
public class CdiTransactionalAnnotatedBean extends ParentBean {
@Transactional(TxType.NOT_SUPPORTED)
public void txNotSupported() {
}
@Transactional(TxType.MANDATORY)
public void txMandatory() {
}
@Transactional(TxType.NEVER)
public void txNever() {
}
@Transactional(TxType.REQUIRED)
public void txRequired() {
}
@Override
public void txOverridenWithoutTransactional() {
}
@Transactional(TxType.REQUIRES_NEW)
public void txOverridenWithRequiresNew() {
}
} | 9,270 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/configuration/BeanWithConfig.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.configuration;
import org.apache.aries.blueprint.annotation.config.Config;
import org.apache.aries.blueprint.annotation.config.ConfigProperty;
import org.apache.aries.blueprint.annotation.config.DefaultProperty;
import org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor;
import javax.enterprise.inject.Produces;
import javax.inject.Named;
import javax.inject.Singleton;
@Config(
pid = "org.apache.aries.my",
placeholderPrefix = "$[",
placeholderSuffix = "]",
defaults = {
@DefaultProperty(key = "title", value = "My Title"),
@DefaultProperty(key = "test2", value = "v2")
}
)
@Singleton
public class BeanWithConfig {
@ConfigProperty("$[title]")
String title;
@Produces
@Named("producedWithConfigProperty")
public MyProducedWithConstructor createBean(@ConfigProperty("1000") long test) {
return null;
}
}
| 9,271 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/configuration/BeanWithConfigurationProperties.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.configuration;
import org.apache.aries.blueprint.annotation.config.ConfigProperties;
import org.apache.aries.blueprint.plugin.test.MyProducedWithConstructor;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.util.Properties;
@Singleton
public class BeanWithConfigurationProperties {
@Inject
@ConfigProperties(pid = "aries.test1", update = true)
private Properties prop1;
@Inject
@ConfigProperties(pid = "aries.test2")
@Named("testProps2")
private Properties prop2;
public BeanWithConfigurationProperties(
@ConfigProperties(pid = "aries.test5", update = true) @Named("testProps5") Properties prop5,
@ConfigProperties(pid = "aries.test6") Properties prop6) {
}
@ConfigProperties(pid = "aries.test3", update = true)
@Inject
public void setProp3(Properties prop3) {
}
@ConfigProperties(pid = "aries.test4")
@Named("testProps4")
@Inject
public void setProp4(Properties prop4) {
}
@Inject
public void setProp7(@ConfigProperties(pid = "aries.test7", update = false) Properties prop7) {
}
@Produces
@Named("withProperties8")
public MyProducedWithConstructor createBeanWithProperties8(@ConfigProperties(pid = "aries.test8") Properties prop8) {
return null;
}
@Produces
@Named("withProperties9")
public MyProducedWithConstructor createBeanWithProperties9(@ConfigProperties(pid = "aries.test9", update = true) @Named("testProps9") Properties prop9) {
return null;
}
}
| 9,272 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
public interface I2 {
}
| 9,273 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/BeanWithCollections.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import org.apache.aries.blueprint.annotation.bean.Bean;
import org.apache.aries.blueprint.annotation.collection.CollectionInject;
import org.apache.aries.blueprint.plugin.AnnotatedService;
import java.util.List;
import java.util.Set;
@Bean
public class BeanWithCollections {
@CollectionInject(I1.class)
List<I1> listFieldInject;
@CollectionInject(I1.class)
Set<I1> setFieldInject;
@CollectionInject(I2.class)
I2[] arrayFieldInject;
@AnnotatedService
@CollectionInject(I1.class)
Set<I1> annotatedSetFieldInject;
@CollectionInject(I1.class)
public void setListSetterInject(List<I1> l) {
}
@CollectionInject(I2.class)
public void setSetSetterInject(Set<I1> l) {
}
@CollectionInject(I1.class)
public void setArraySetterInject(I1[] l) {
}
@AnnotatedService
@CollectionInject(I2.class)
public void setAnnotatedArraySetterInject(I2[] l) {
}
public BeanWithCollections(
@CollectionInject(I1.class) List<I1> listOfI1,
@CollectionInject(I1.class) Set<I1> setOfI1,
@CollectionInject(I2.class) I2[] arrayOfI2,
@CollectionInject(I1.class) @AnnotatedService List<I1> listOfAnnotatedI1,
@CollectionInject(I3.class) List<I3> listOfNotExistingI3,
@CollectionInject(I3.class) Set<I3> setOfNotExistingI3,
@CollectionInject(I3.class) I3[] arrayOfNotExistingI3
) {
}
}
| 9,274 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I3.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
public interface I3 {
}
| 9,275 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl2Annotated.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import org.apache.aries.blueprint.plugin.AnnotatedService;
import javax.inject.Singleton;
@Singleton
@AnnotatedService
public class I2Impl2Annotated implements I2 {
}
| 9,276 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import javax.inject.Singleton;
@Singleton
public class I1Impl1 implements I1 {
}
| 9,277 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import javax.inject.Singleton;
@Singleton
public class I1Impl2 implements I1 {
}
| 9,278 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl3Annotated.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import org.apache.aries.blueprint.plugin.AnnotatedService;
import javax.inject.Singleton;
@Singleton
@AnnotatedService
public class I1Impl3Annotated implements I1 {
}
| 9,279 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl3Annotated.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import org.apache.aries.blueprint.plugin.AnnotatedService;
import javax.inject.Singleton;
@Singleton
@AnnotatedService
public class I2Impl3Annotated implements I2 {
}
| 9,280 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1Impl4Annotated.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import org.apache.aries.blueprint.plugin.AnnotatedService;
import javax.inject.Singleton;
@Singleton
@AnnotatedService
public class I1Impl4Annotated implements I1 {
}
| 9,281 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I2Impl1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
import javax.inject.Singleton;
@Singleton
public class I2Impl1 implements I2 {
}
| 9,282 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/collection/I1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.collection;
public interface I1 {
}
| 9,283 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/A1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.qualifiers;
import javax.inject.Qualifier;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
public @interface A1 {
}
| 9,284 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/TestBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.qualifiers;
public class TestBean {
}
| 9,285 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/TestConsumer.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.qualifiers;
import org.apache.aries.blueprint.annotation.bean.Bean;
@Bean
public class TestConsumer {
public TestConsumer(@A1 TestBean t1, @A2 TestBean t2) {
}
}
| 9,286 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/MyFactory.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.qualifiers;
import org.apache.aries.blueprint.annotation.bean.Bean;
import javax.inject.Named;
@Bean
public class MyFactory {
@Bean
@Named("testBean1")
@A1
public TestBean create1() {
return null;
}
@Bean
@Named("testBean2")
@A2
public TestBean create2() {
return null;
}
}
| 9,287 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/qualifiers/A2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.qualifiers;
import javax.inject.Qualifier;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
public @interface A2 {
}
| 9,288 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/bean/BasicBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.bean;
import org.apache.aries.blueprint.annotation.bean.Activation;
import org.apache.aries.blueprint.annotation.bean.Bean;
import org.apache.aries.blueprint.annotation.bean.Scope;
@Bean
public class BasicBean {
@Bean(id = "simpleProducedBean1")
public SimpleProducedBean getBean1() {
return null;
}
@Bean(id = "simpleProducedBean2", activation = Activation.EAGER, scope = Scope.PROTOTYPE)
public SimpleProducedBean getBean2() {
return null;
}
@Bean(id = "simpleProducedBean3", activation = Activation.LAZY, scope = Scope.PROTOTYPE, dependsOn = {"simpleProducedBean1", "simpleProducedBean2"}, initMethod = "init1", destroyMethod = "destroy1")
public SimpleProducedBean getBean3() {
return null;
}
}
| 9,289 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/bean/NamedBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.bean;
import org.apache.aries.blueprint.annotation.bean.Activation;
import org.apache.aries.blueprint.annotation.bean.Bean;
import org.apache.aries.blueprint.annotation.bean.Scope;
@Bean(id = "namedBean1", activation = Activation.EAGER, scope = Scope.PROTOTYPE)
public class NamedBean {
}
| 9,290 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/bean/SimpleProducedBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.bean;
public class SimpleProducedBean {
public void init1() {
}
public void destroy1() {
}
}
| 9,291 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/bean/BeanWithCallbackMethods.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.bean;
import org.apache.aries.blueprint.annotation.bean.Activation;
import org.apache.aries.blueprint.annotation.bean.Bean;
import org.apache.aries.blueprint.annotation.bean.Scope;
@Bean(activation = Activation.LAZY, scope = Scope.PROTOTYPE, dependsOn = {"basicBean", "namedBean1"}, initMethod = "init", destroyMethod = "destroy")
public class BeanWithCallbackMethods {
public void init() {
}
public void destroy() {
}
}
| 9,292 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/converters/Converter1.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.converters;
import org.osgi.service.blueprint.container.Converter;
import org.osgi.service.blueprint.container.ReifiedType;
import javax.inject.Singleton;
@Singleton
public class Converter1 implements Converter {
@Override
public boolean canConvert(Object o, ReifiedType reifiedType) {
return false;
}
@Override
public Object convert(Object o, ReifiedType reifiedType) throws Exception {
return null;
}
}
| 9,293 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/converters/Converter2.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.converters;
import org.osgi.service.blueprint.container.Converter;
import org.osgi.service.blueprint.container.ReifiedType;
import javax.inject.Singleton;
@Singleton
public class Converter2 implements Converter {
@Override
public boolean canConvert(Object o, ReifiedType reifiedType) {
return false;
}
@Override
public Object convert(Object o, ReifiedType reifiedType) throws Exception {
return null;
}
}
| 9,294 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/referencelistener/ReferenceListenerBeanWithName.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.referencelistener;
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.interfaces.ServiceA;
import javax.inject.Named;
@ReferenceListener(referenceInterface = ServiceA.class, cardinality = Cardinality.SINGLE, referenceName = "serviceAReferenceWithoutMethods")
@Singleton
@Named("referenceListenerBeanWithNameWithoutMethods")
public class ReferenceListenerBeanWithName {
}
| 9,295 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/referencelistener/ReferenceListenerToProduceWithoutAnnotation.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.referencelistener;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceB;
public class ReferenceListenerToProduceWithoutAnnotation {
public void addMe(ServiceB serviceB) {
}
public void removeMe(ServiceB serviceB) {
}
}
| 9,296 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/referencelistener/ReferenceListenerListBean.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.referencelistener;
import org.apache.aries.blueprint.annotation.referencelistener.Availability;
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.interfaces.ServiceA;
import javax.inject.Singleton;
@ReferenceListener(referenceInterface = ServiceA.class, filter = "(b=c)", componentName = "a", availability = Availability.MANDATORY)
@Singleton
public class ReferenceListenerListBean {
@Bind
public void add(ServiceA a) {
}
@Unbind
public void remove(ServiceA a) {
}
}
| 9,297 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/referencelistener/ReferenceListenerBeanWithoutMethodsAnnotation.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.referencelistener;
import org.apache.aries.blueprint.annotation.referencelistener.Cardinality;
import org.apache.aries.blueprint.annotation.referencelistener.ReferenceListener;
import org.apache.aries.blueprint.plugin.test.interfaces.ServiceA;
import javax.inject.Singleton;
@ReferenceListener(referenceInterface = ServiceA.class, cardinality = Cardinality.MULTIPLE,
referenceName = "serviceAReference", bindMethod = "addMe", unbindMethod = "removeMe")
@Singleton
public class ReferenceListenerBeanWithoutMethodsAnnotation {
public void addMe(ServiceA serviceB) {
}
public void removeMe(ServiceA serviceB) {
}
}
| 9,298 |
0 | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test | Create_ds/aries/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/referencelistener/ReferenceListenerProducer.java | /**
* 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
* <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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.plugin.test.referencelistener;
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.interfaces.ServiceB;
import javax.enterprise.inject.Produces;
import javax.inject.Named;
import javax.inject.Singleton;
@Singleton
public class ReferenceListenerProducer {
@Produces
@ReferenceListener(cardinality = Cardinality.SINGLE,
referenceInterface = ServiceB.class,
componentName = "producer123",
filter = "(b=123)"
)
@Named("referenceListenerToProduceForSingle")
public ReferenceListenerToProduce single() {
return null;
}
@Produces
@ReferenceListener(
referenceInterface = ServiceB.class,
componentName = "producer456",
filter = "(b=456)",
referenceName = "referenceListForProducer",
bindMethod = "addMe",
unbindMethod = "removeMe"
)
@Named("referenceListenerToProduceForList")
public ReferenceListenerToProduceWithoutAnnotation list() {
return null;
}
@Produces
@ReferenceListener(
referenceInterface = ServiceB.class,
bindMethod = "addMe",
unbindMethod = "removeMe",
availability = Availability.MANDATORY
)
@Singleton
@Named("referenceListenerToProduceWithBindingMethodsByName")
public ReferenceListenerToProduce listWithDefinedMethods() {
return null;
}
}
| 9,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.