Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaExtension.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaExtension.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaExtension.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaExtension.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,205 @@ +/* + * 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.meecrowave.jpa.internal; + +import org.apache.meecrowave.Meecrowave; +import org.apache.meecrowave.jpa.api.Jpa; +import org.apache.meecrowave.jpa.api.PersistenceUnitInfoBuilder; +import org.apache.meecrowave.jpa.api.Unit; + +import javax.enterprise.context.spi.CreationalContext; +import javax.enterprise.event.Observes; +import javax.enterprise.inject.spi.AfterBeanDiscovery; +import javax.enterprise.inject.spi.AfterDeploymentValidation; +import javax.enterprise.inject.spi.Bean; +import javax.enterprise.inject.spi.BeanManager; +import javax.enterprise.inject.spi.BeforeBeanDiscovery; +import javax.enterprise.inject.spi.Extension; +import javax.enterprise.inject.spi.ProcessAnnotatedType; +import javax.enterprise.inject.spi.ProcessBean; +import javax.enterprise.inject.spi.WithAnnotations; +import javax.persistence.Embeddable; +import javax.persistence.Entity; +import javax.persistence.MappedSuperclass; +import javax.persistence.SynchronizationType; +import javax.persistence.spi.PersistenceUnitInfo; +import javax.servlet.ServletContext; +import javax.sql.DataSource; +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import static java.util.Optional.ofNullable; +import static java.util.function.Function.identity; +import static java.util.stream.Collectors.toMap; + +/** + * This extension is responsible to create entitymanagers, entitymanagerfactories + * and link it to CDI named units. + * <p> + * Note: we don't reuse @DataSourceDefinition which is all but defined (pooling, datasource configs are a mess). + */ +public class JpaExtension implements Extension { + private final EntityManagerContext entityManagerContext = new EntityManagerContext(); + private final List<String> jpaClasses = new ArrayList<>(); + private final Map<UnitKey, EntityManagerBean> entityManagerBeans = new HashMap<>(); + private final Collection<Bean<?>> unitBuilders = new ArrayList<>(2); + + void addInternals(@Observes final BeforeBeanDiscovery bbd, final BeanManager bm) { + Stream.of(JpaTransactionInterceptor.class, JpaNoTransactionInterceptor.class) + .forEach(interceptor -> bbd.addAnnotatedType(bm.createAnnotatedType(interceptor))); + } + + <T> void addJpaToEmConsumers(@Observes @WithAnnotations(Unit.class) final ProcessAnnotatedType<T> pat) { + if (pat.getAnnotatedType().isAnnotationPresent(Jpa.class)) { + return; + } + pat.setAnnotatedType(new AutoJpaAnnotationType<T>(pat.getAnnotatedType())); + } + + void collectEntityManagerInjections(@Observes final ProcessBean<?> bean) { + final Map<UnitKey, EntityManagerBean> beans = bean.getBean().getInjectionPoints().stream() + .filter(i -> i.getAnnotated().isAnnotationPresent(Unit.class)) + .map(i -> i.getAnnotated().getAnnotation(Unit.class)) + .collect(toMap(u -> new UnitKey(u.name(), u.synchronization()), unit -> new EntityManagerBean(entityManagerContext, unit.name(), unit.synchronization()))); + entityManagerBeans.putAll(beans); + } + + void collectEntityManagers(@Observes final ProcessBean<?> bean) { + if (bean.getBean().getTypes().contains(PersistenceUnitInfoBuilder.class)) { + unitBuilders.add(bean.getBean()); + } + } + + void collectEntities(@Observes @WithAnnotations({Entity.class, MappedSuperclass.class, Embeddable.class}) final ProcessAnnotatedType<?> jpa) { + jpaClasses.add(jpa.getAnnotatedType().getJavaClass().getName()); + } + + void addBeans(@Observes final AfterBeanDiscovery afb, final BeanManager bm) { + afb.addContext(entityManagerContext); + entityManagerBeans.forEach((n, b) -> afb.addBean(b)); + } + + void initBeans(@Observes final AfterDeploymentValidation adv, final BeanManager bm) { + if (entityManagerBeans.isEmpty()) { + return; + } + + // only not portable part is this config read, could be optional + final ServletContext sc = ServletContext.class.cast(bm.getReference(bm.resolve(bm.getBeans(ServletContext.class)), ServletContext.class, bm.createCreationalContext(null))); + final Meecrowave.Builder config = Meecrowave.Builder.class.cast(sc.getAttribute("meecrowave.configuration")); + final Map<String, String> props = new HashMap<>(); + if (config != null) { + ofNullable(config.getProperties()).ifPresent(p -> p.stringPropertyNames().stream() + .filter(k -> k.startsWith("jpa.property.")) + .forEach(k -> props.put(k.substring("jpa.property.".length()), p.getProperty(k)))); + } + + final Map<String, PersistenceUnitInfo> infoIndex = unitBuilders.stream() + .map(bean -> { + final CreationalContext<?> cc = bm.createCreationalContext(null); + try { + final Bean<?> resolvedBean = bm.resolve(bm.getBeans( + PersistenceUnitInfoBuilder.class, + bean.getQualifiers().toArray(new Annotation[bean.getQualifiers().size()]))); + final PersistenceUnitInfoBuilder builder = PersistenceUnitInfoBuilder.class.cast( + bm.getReference(resolvedBean, PersistenceUnitInfoBuilder.class, cc)); + if (builder.getManagedClasses().isEmpty()) { + builder.setManagedClassNames(jpaClasses).setExcludeUnlistedClasses(true); + } + props.forEach(builder::addProperty); + return builder.toInfo(); + } finally { + cc.release(); + } + }).collect(toMap(PersistenceUnitInfo::getPersistenceUnitName, identity())); + + entityManagerBeans.forEach((k, e) -> { + PersistenceUnitInfo info = infoIndex.get(k.unitName); + if (info == null) { + info = tryCreateDefaultPersistenceUnit(k.unitName, bm, props); + } + if (info == null) { // not valid + adv.addDeploymentProblem(new IllegalArgumentException("Didn't find any PersistenceUnitInfoBuilder for " + k)); + } else { + e.init(info, bm); + } + }); + } + + private PersistenceUnitInfo tryCreateDefaultPersistenceUnit(final String unitName, final BeanManager bm, final Map<String, String> props) { + final Set<Bean<?>> beans = bm.getBeans(DataSource.class); + final Bean<?> bean = bm.resolve(beans); + if (bean == null || !bm.isNormalScope(bean.getScope())) { + return null; + } + + final DataSource ds = DataSource.class.cast(bm.getReference(bean, DataSource.class, bm.createCreationalContext(null))); + + final PersistenceUnitInfoBuilder builder = new PersistenceUnitInfoBuilder() + .setManagedClassNames(jpaClasses) + .setExcludeUnlistedClasses(true) + .setUnitName(unitName) + .setDataSource(ds); + + props.forEach(builder::addProperty); + + return builder.toInfo(); + } + + EntityManagerContext getEntityManagerContext() { + return entityManagerContext; + } + + private static class UnitKey { + private final String unitName; + private final SynchronizationType synchronizationType; + private final int hash; + + private UnitKey(final String unitName, final SynchronizationType synchronizationType) { + this.unitName = unitName; + this.synchronizationType = synchronizationType; + this.hash = 31 * unitName.hashCode() + synchronizationType.hashCode(); + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + final UnitKey unitKey = UnitKey.class.cast(o); + return unitName.equals(unitKey.unitName) && synchronizationType == unitKey.synchronizationType; + + } + + @Override + public int hashCode() { + return hash; + } + } +}
Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaInterceptorBase.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaInterceptorBase.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaInterceptorBase.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaInterceptorBase.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,45 @@ +/* + * 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.meecrowave.jpa.internal; + +import javax.inject.Inject; +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; +import java.io.Serializable; + +public abstract class JpaInterceptorBase implements Serializable { + @Inject + private JpaExtension extension; + + @AroundInvoke + public Object inTransaction(final InvocationContext context) throws Exception { + final EntityManagerContext entityManagerContext = extension.getEntityManagerContext(); + final boolean owner = entityManagerContext.enter(isTransactional()); + try { + return context.proceed(); + } catch (final Exception e) { + entityManagerContext.failed(); + throw e; + } finally { + entityManagerContext.exit(owner); + } + } + + protected abstract boolean isTransactional(); +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaLiteral.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaLiteral.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaLiteral.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaLiteral.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,61 @@ +/* + * 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.meecrowave.jpa.internal; + +import org.apache.meecrowave.jpa.api.Jpa; + +import javax.enterprise.util.AnnotationLiteral; +import java.lang.annotation.Annotation; + +class JpaLiteral extends AnnotationLiteral<Jpa> implements Jpa { + public static final Annotation DEFAULT = new JpaLiteral(true); + + private final boolean transactional; + private final int hash; + + JpaLiteral(final boolean transactional) { + this.transactional = transactional; + this.hash = hashCode(); + } + + @Override + public Class<? extends Annotation> annotationType() { + return Jpa.class; + } + + @Override + public boolean transactional() { + return transactional; + } + + @Override + public boolean equals(final Object other) { + return Jpa.class.isInstance(other) && Jpa.class.cast(other).transactional() == transactional; + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public String toString() { + return "@Jpa(transactional)" + transactional + ")"; + } +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaNoTransactionInterceptor.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaNoTransactionInterceptor.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaNoTransactionInterceptor.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaNoTransactionInterceptor.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,34 @@ +/* + * 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.meecrowave.jpa.internal; + +import org.apache.meecrowave.jpa.api.Jpa; + +import javax.annotation.Priority; +import javax.interceptor.Interceptor; + +@Jpa(transactional = false) +@Interceptor +@Priority(Interceptor.Priority.LIBRARY_BEFORE) +public class JpaNoTransactionInterceptor extends JpaInterceptorBase { + @Override + protected boolean isTransactional() { + return false; + } +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaTransactionInterceptor.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaTransactionInterceptor.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaTransactionInterceptor.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/JpaTransactionInterceptor.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,34 @@ +/* + * 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.meecrowave.jpa.internal; + +import org.apache.meecrowave.jpa.api.Jpa; + +import javax.annotation.Priority; +import javax.interceptor.Interceptor; + +@Jpa +@Interceptor +@Priority(Interceptor.Priority.LIBRARY_BEFORE) +public class JpaTransactionInterceptor extends JpaInterceptorBase { + @Override + protected boolean isTransactional() { + return true; + } +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/UnitLiteral.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/UnitLiteral.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/UnitLiteral.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/java/org/apache/meecrowave/jpa/internal/UnitLiteral.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,49 @@ +package org.apache.meecrowave.jpa.internal; + +import org.apache.meecrowave.jpa.api.Unit; + +import javax.enterprise.util.AnnotationLiteral; +import javax.persistence.SynchronizationType; + +class UnitLiteral extends AnnotationLiteral<Unit> implements Unit { + private final String name; + private final SynchronizationType synchronization; + + UnitLiteral(final String name, final SynchronizationType synchronization) { + this.name = name; + this.synchronization = synchronization; + } + + @Override + public String name() { + return name; + } + + @Override + public SynchronizationType synchronization() { + return synchronization; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UnitLiteral that = UnitLiteral.class.cast(o); + return name.equals(that.name) && synchronization.equals(that.synchronization); + + } + + @Override + public int hashCode() { + return name.hashCode() + 31 * synchronization.hashCode(); + } + + @Override + public String toString() { + return "@Unit(name=" + name + ",synchronization=" + synchronization.name() + ")"; + } +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/LICENSE URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/LICENSE?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/LICENSE (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/LICENSE Sun Nov 13 09:34:07 2016 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/NOTICE URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/NOTICE?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/NOTICE (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/NOTICE Sun Nov 13 09:34:07 2016 @@ -0,0 +1,5 @@ +Apache Microwave +Copyright 2016 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension Sun Nov 13 09:34:07 2016 @@ -0,0 +1 @@ +org.apache.meecrowave.jpa.internal.JpaExtension Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/apache/meecrowave/jpa/internal/JpaExtensionTest.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/apache/meecrowave/jpa/internal/JpaExtensionTest.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/apache/meecrowave/jpa/internal/JpaExtensionTest.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/apache/meecrowave/jpa/internal/JpaExtensionTest.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,49 @@ +/* + * 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.meecrowave.jpa.internal; + +import org.apache.meecrowave.Meecrowave; +import org.apache.meecrowave.junit.MeecrowaveRule; +import org.app.JPADao; +import org.junit.Rule; +import org.junit.Test; + +import javax.inject.Inject; + +import static org.junit.Assert.assertEquals; + +public class JpaExtensionTest { + @Rule + public final MeecrowaveRule rule = new MeecrowaveRule( + new Meecrowave.Builder().randomHttpPort() + .property("jpa.property.openjpa.RuntimeUnenhancedClasses", "supported") + .property("jpa.property.openjpa.jdbc.SynchronizeMappings", "buildSchema"), + "") + .inject(this); + + @Inject + private JPADao service; + + @Test + public void run() { + final JPADao.User u = new JPADao.User(); + u.setName("test"); + assertEquals("test", service.find(service.save(u).getId()).getName()); + } +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/app/JPADao.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/app/JPADao.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/app/JPADao.java (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/test/java/org/app/JPADao.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,87 @@ +/* + * 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.app; + +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.meecrowave.jpa.api.Jpa; +import org.apache.meecrowave.jpa.api.Unit; +import org.h2.Driver; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.Dependent; +import javax.enterprise.inject.Produces; +import javax.inject.Inject; +import javax.persistence.Entity; +import javax.persistence.EntityManager; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.sql.DataSource; + +@ApplicationScoped +public class JPADao { + @Inject + @Unit(name = "test") + private EntityManager em; + + // tx by default + public User save(final User user) { + em.persist(user); + return user; + } + + @Jpa(transactional = false) // no tx + public User find(final long id) { + return em.find(User.class, id); + } + + @ApplicationScoped + public static class JpaConfig { + @Produces + @ApplicationScoped + public DataSource dataSource() { + final BasicDataSource source = new BasicDataSource(); + source.setDriver(new Driver()); + source.setUrl("jdbc:h2:mem:jpaextensiontest"); + return source; + } + } + + @Entity + @Dependent + public static class User { + @Id + @GeneratedValue + private long id; + + private String name; + + public long getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + } + +} Added: openwebbeans/microwave/trunk/meecrowave-jpa/src/test/resources/META-INF/beans.xml URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-jpa/src/test/resources/META-INF/beans.xml?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-jpa/src/test/resources/META-INF/beans.xml (added) +++ openwebbeans/microwave/trunk/meecrowave-jpa/src/test/resources/META-INF/beans.xml Sun Nov 13 09:34:07 2016 @@ -0,0 +1,19 @@ +<!-- + 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. +--> +<beans /> Added: openwebbeans/microwave/trunk/meecrowave-junit/pom.xml URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/pom.xml?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/pom.xml (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/pom.xml Sun Nov 13 09:34:07 2016 @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>meecrowave</artifactId> + <groupId>org.apache.meecrowave</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>meecrowave-junit</artifactId> + <name>Meecrowave :: JUnit</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + </dependency> + <dependency> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-core</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <!-- cause of mono runner/rule --> + <reuseForks>false</reuseForks> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRule.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRule.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRule.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRule.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,45 @@ +/* + * 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.meecrowave.junit; + +import org.apache.meecrowave.Meecrowave; + +public class MeecrowaveRule extends MeecrowaveRuleBase<MeecrowaveRule> { + private final Meecrowave.Builder configuration; + private final String context; + + public MeecrowaveRule() { + this(new Meecrowave.Builder().randomHttpPort(), ""); + } + + public MeecrowaveRule(final Meecrowave.Builder configuration, final String context) { + this.configuration = configuration; + this.context = context; + } + + @Override + public Meecrowave.Builder getConfiguration() { + return configuration; + } + + @Override + protected AutoCloseable onStart() { + return new Meecrowave(configuration).bake(context); + } +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRuleBase.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRuleBase.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRuleBase.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MeecrowaveRuleBase.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,81 @@ +/* + * 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.meecrowave.junit; + +import org.apache.meecrowave.Meecrowave; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import javax.enterprise.context.spi.CreationalContext; +import javax.enterprise.inject.spi.AnnotatedType; +import javax.enterprise.inject.spi.BeanManager; +import javax.enterprise.inject.spi.CDI; +import javax.enterprise.inject.spi.InjectionTarget; +import java.util.ArrayList; +import java.util.Collection; +import java.util.concurrent.atomic.AtomicBoolean; + +import static java.util.stream.Collectors.toList; + +public abstract class MeecrowaveRuleBase<T extends MeecrowaveRuleBase> implements TestRule { + private final Collection<Object> toInject = new ArrayList<>(); + private final AtomicBoolean started = new AtomicBoolean(false); + + @Override + public Statement apply(final Statement base, final Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + try (final AutoCloseable closeable = onStart()) { + started.set(true); + final Collection<CreationalContext<?>> contexts = toInject.stream().map(MeecrowaveRuleBase::doInject).collect(toList()); + try { + base.evaluate(); + } finally { + contexts.forEach(CreationalContext::release); + started.set(false); + } + } + } + }; + } + + private static CreationalContext<Object> doInject(final Object instance) { + final BeanManager bm = CDI.current().getBeanManager(); + final AnnotatedType<?> annotatedType = bm.createAnnotatedType(instance.getClass()); + final InjectionTarget injectionTarget = bm.createInjectionTarget(annotatedType); + final CreationalContext<Object> creationalContext = bm.createCreationalContext(null); + injectionTarget.inject(instance, creationalContext); + return creationalContext; + } + + public <T> T inject(final Object instance) { + if (started.get()) { + doInject(instance); // TODO: store cc to release it + } else { + toInject.add(instance); + } + return (T) this; + } + + public abstract Meecrowave.Builder getConfiguration(); + + protected abstract AutoCloseable onStart(); +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MonoMeecrowave.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MonoMeecrowave.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MonoMeecrowave.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/main/java/org/apache/meecrowave/junit/MonoMeecrowave.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,153 @@ +/* + * 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.meecrowave.junit; + +import org.apache.meecrowave.Meecrowave; +import org.junit.rules.MethodRule; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.InitializationError; +import org.junit.runners.model.Statement; + +import java.io.File; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.util.List; +import java.util.ServiceLoader; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +// a MeecrowaveRule starting a single container, very awesome for forkCount=1, reuseForks=true +public class MonoMeecrowave { + private static final AtomicReference<AutoCloseable> CONTAINER = new AtomicReference<>(); + private static final AtomicReference<Meecrowave.Builder> CONFIGURATION = new AtomicReference<>(); + private static final AutoCloseable NOOP_CLOSEABLE = () -> { + }; + + public static class Runner extends BlockJUnit4ClassRunner { + public Runner(final Class<?> klass) throws InitializationError { + super(klass); + } + + @Override + protected List<MethodRule> rules(final Object test) { + final List<MethodRule> rules = super.rules(test); + rules.add((base, method, target) -> new Statement() { + @Override + public void evaluate() throws Throwable { + doBoot(); + configInjection(test.getClass(), test); + base.evaluate(); + } + + private void configInjection(final Class<?> aClass, final Object test) { + Stream.of(aClass.getDeclaredFields()) + .filter(f -> f.isAnnotationPresent(ConfigurationInject.class)) + .forEach(f -> { + if (!f.isAccessible()) { + f.setAccessible(true); + } + try { + f.set(test, CONFIGURATION.get()); + } catch (final IllegalAccessException e) { + throw new IllegalStateException(e); + } + }); + final Class<?> parent = aClass.getSuperclass(); + if (parent != null && parent != Object.class) { + configInjection(parent, true); + } + } + }); + return rules; + } + + /** + * Only working with the runner + */ + @Target(FIELD) + @Retention(RUNTIME) + public @interface ConfigurationInject { + } + } + + public static class Rule extends MeecrowaveRuleBase<Rule> { + @Override + public Meecrowave.Builder getConfiguration() { + return CONFIGURATION.get(); + } + + @Override + protected AutoCloseable onStart() { + if (CONTAINER.get() == null) { // yes synchro could be simpler but it does the job, feel free to rewrite it + synchronized (CONTAINER) { + if (CONTAINER.get() == null) { + doBoot(); + } + } + } + return NOOP_CLOSEABLE; + } + } + + private static void doBoot() { + final Meecrowave.Builder configuration = new Meecrowave.Builder().randomHttpPort().noShutdownHook(/*the rule does*/); + StreamSupport.stream(ServiceLoader.load(Meecrowave.ConfigurationCustomizer.class).spliterator(), false) + .forEach(c -> c.accept(configuration)); + CONFIGURATION.compareAndSet(null, configuration); + + final Meecrowave meecrowave = new Meecrowave(CONFIGURATION.get()); + if (CONTAINER.compareAndSet(null, meecrowave)) { + final Configuration runnerConfig = StreamSupport.stream(ServiceLoader.load(Configuration.class).spliterator(), false) + .findAny() + .orElseGet(() -> new Configuration() { + }); + + final File war = runnerConfig.application(); + if (war == null) { + meecrowave.bake(runnerConfig.context()); + } else { + meecrowave.deployWebapp(runnerConfig.context(), runnerConfig.application()); + } + Runtime.getRuntime().addShutdownHook(new Thread() { + { + setName("Meecrowave-mono-rue-stopping"); + } + + @Override + public void run() { + meecrowave.close(); + } + }); + } + } + + public interface Configuration { + default String context() { + return ""; + } + + default File application() { + return null; + } + } +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/LICENSE URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/LICENSE?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/LICENSE (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/LICENSE Sun Nov 13 09:34:07 2016 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. Added: openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/NOTICE URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/NOTICE?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/NOTICE (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/main/resources/META-INF/NOTICE Sun Nov 13 09:34:07 2016 @@ -0,0 +1,5 @@ +Apache Microwave +Copyright 2016 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). Added: openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MeecrowaveRuleTest.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MeecrowaveRuleTest.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MeecrowaveRuleTest.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MeecrowaveRuleTest.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,49 @@ +/* + * 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.meecrowave.junit; + +import org.apache.meecrowave.io.IO; +import org.junit.ClassRule; +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +public class MeecrowaveRuleTest { + @ClassRule + public static final MeecrowaveRule RULE = new MeecrowaveRule(); + + @Test + public void test() throws IOException { + assertEquals("simple", slurp(new URL("http://localhost:" + RULE.getConfiguration().getHttpPort() + "/api/test"))); + } + + private String slurp(final URL url) { + try (final InputStream is = url.openStream()) { + return IO.toString(is); + } catch (final IOException e) { + fail(e.getMessage()); + } + return null; + } +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MonoMeecrowaveRuleTest.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MonoMeecrowaveRuleTest.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MonoMeecrowaveRuleTest.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/apache/meecrowave/junit/MonoMeecrowaveRuleTest.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,56 @@ +/* + * 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.meecrowave.junit; + +import org.apache.meecrowave.Meecrowave; +import org.apache.meecrowave.io.IO; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +@RunWith(MonoMeecrowave.Runner.class) +public class MonoMeecrowaveRuleTest { + /* or + @ClassRule + public static final MonoMeecrowave.Rule RULE = new MonoMeecrowave.Rule(); + */ + + @MonoMeecrowave.Runner.ConfigurationInject + private Meecrowave.Builder config; + + @Test + public void test() throws IOException { + assertEquals("simple", slurp(new URL("http://localhost:" + config.getHttpPort() + "/api/test"))); + } + + private String slurp(final URL url) { + try (final InputStream is = url.openStream()) { + return IO.toString(is); + } catch (final IOException e) { + fail(e.getMessage()); + } + return null; + } +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Endpoint.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Endpoint.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Endpoint.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Endpoint.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,66 @@ +/* + * 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.app; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +@Path("test") +@ApplicationScoped +public class Endpoint { + @Inject + private Injectable injectable; + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String simple() { + return Boolean.parseBoolean(injectable.injected()) ? "simple" : "fail"; + } + + @GET + @Path("json") + @Produces(MediaType.APPLICATION_JSON) + public Simple json() { + return new Simple("test"); + } + + public static class Simple { + private String name; + + public Simple() { + // no-op + } + + public Simple(final String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + } +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Injectable.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Injectable.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Injectable.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/Injectable.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,28 @@ +/* + * 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.app; + +import javax.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class Injectable { + public String injected() { + return "true"; + } +} Added: openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/RsApp.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/RsApp.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/RsApp.java (added) +++ openwebbeans/microwave/trunk/meecrowave-junit/src/test/java/org/app/RsApp.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,28 @@ +/* + * 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.app; + +import javax.enterprise.context.Dependent; +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@Dependent +@ApplicationPath("api") +public class RsApp extends Application { +} Added: openwebbeans/microwave/trunk/meecrowave-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-maven-plugin/pom.xml?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-maven-plugin/pom.xml (added) +++ openwebbeans/microwave/trunk/meecrowave-maven-plugin/pom.xml Sun Nov 13 09:34:07 2016 @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://maven.apache.org/POM/4.0.0 + http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>meecrowave</artifactId> + <groupId>org.apache.meecrowave</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>meecrowave-maven-plugin</artifactId> + <name>Meecrowave :: Maven</name> + <packaging>maven-plugin</packaging> + + <properties> + <maven.version>3.3.9</maven.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${maven.version}</version> + <exclusions> + <exclusion> + <groupId>javax.enterprise</groupId> + <artifactId>cdi-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${maven.version}</version> + <exclusions> + <exclusion> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>3.3</version> + </dependency> + + <dependency> + <groupId>org.apache.meecrowave</groupId> + <artifactId>meecrowave-core</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.maven.plugin-testing</groupId> + <artifactId>maven-plugin-testing-harness</artifactId> + <version>3.3.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-compat</artifactId> + <version>${maven.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.tomee</groupId> + <artifactId>ziplock</artifactId> + <version>7.0.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.apache.tomee</groupId> + <artifactId>javaee-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.tomee</groupId> + <artifactId>openejb-jee</artifactId> + </exclusion> + <exclusion> + <groupId>org.jboss.shrinkwrap</groupId> + <artifactId>shrinkwrap-api</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <version>3.4</version> + <executions> + <execution> + <id>mojo-descriptor</id> + <goals> + <goal>descriptor</goal> + <goal>helpmojo</goal> + </goals> + </execution> + </executions> + <configuration> + <goalPrefix>meecrowave</goalPrefix> + <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> + </configuration> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <version>${maven.version}</version> + </plugin> + </plugins> + </reporting> +</project> Added: openwebbeans/microwave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBakeMojo.java URL: http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBakeMojo.java?rev=1769479&view=auto ============================================================================== --- openwebbeans/microwave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBakeMojo.java (added) +++ openwebbeans/microwave/trunk/meecrowave-maven-plugin/src/main/java/org/apache/meecrowave/maven/MeecrowaveBakeMojo.java Sun Nov 13 09:34:07 2016 @@ -0,0 +1,30 @@ +/* + * 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.meecrowave.maven; + +import org.apache.maven.plugins.annotations.Mojo; + +import static org.apache.maven.plugins.annotations.ResolutionScope.RUNTIME_PLUS_SYSTEM; + +/** + * Just an alias for run Mojo. + */ +@Mojo(name = "bake", requiresDependencyResolution = RUNTIME_PLUS_SYSTEM) +public class MeecrowaveBakeMojo extends MeecrowaveRunMojo { +}