[GitHub] [tomee] cesarhernandezgt merged pull request #727: TOMEE-2939 TOMEE-2979 Update bcprov-jdk15on to 1.68

2021-03-17 Thread GitBox


cesarhernandezgt merged pull request #727:
URL: https://github.com/apache/tomee/pull/727


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] cesarhernandezgt merged pull request #769: TOMEE-2979 Upgrade to MyFaces 2.2.14

2021-03-17 Thread GitBox


cesarhernandezgt merged pull request #769:
URL: https://github.com/apache/tomee/pull/769


   



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on pull request #767:
URL: https://github.com/apache/tomee/pull/767#issuecomment-801386064


   Thanks for the review, the feedback and the comments, @rmannibucau. If you 
don't mind, it might be ready for a 2nd review round ... ;)



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596331107



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));

Review comment:
   Alright - just added a related validation.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596301148



##
File path: container/openejb-core/pom.xml
##
@@ -580,6 +580,22 @@
   org.apache.xbean
   xbean-bundleutils
 
+

Review comment:
   1. +1 -> I agree.
   2. Yes. It is a totally different approach, so keeping them separated is 
fine for me. Users may consume them as needed.
   
   





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rmannibucau commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rmannibucau commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596224991



##
File path: container/openejb-core/pom.xml
##
@@ -580,6 +580,22 @@
   org.apache.xbean
   xbean-bundleutils
 
+

Review comment:
   Hmm, the facts to consider IMHO are:
   
   1. any junit5 dep must not bring back any junit 4 dependency (this creates 
weird bugs in test runners for gradle/maven/ide)
   2. junit legacy module is completely transversal to app composer so I think 
we should keep them orthogonal, can need a better naming but also guarantees a 
better design/consumption





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rmannibucau commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rmannibucau commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596223276



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));

Review comment:
   guess you can skip @Deprecated ones, they shouldnt be used in junit5 
module anyway (new code with deprecated API sounds fishy from the IDE ;)).





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] jrxxjr commented on a change in pull request #775: TOMEE-2984 Translate to Portuguese: examples/simple-singleton

2021-03-17 Thread GitBox


jrxxjr commented on a change in pull request #775:
URL: https://github.com/apache/tomee/pull/775#discussion_r596202924



##
File path: examples/simple-singleton/README_pt.adoc
##
@@ -0,0 +1,365 @@
+:index-group: Session Beans
+:jbake-type: page
+:jbake-status: status=published
+= Simples Singleton
+
+Como o nome indica, um `javax.ejb.Singleton`, é um bean de sessão com a 
garantia de que há no máximo uma instância no aplicativo.
+
+O que está faltando completamente no EJB 3.0 e anteriores é a capacidade de 
ter um EJB que é notificado quando o aplicativo é iniciado e quando ele para. 
Portanto, você pode fazer todos os tipos de coisas que antes só podiam ser 
feitas com um servlet de carregamento na inicialização. Também oferece um local 
para armazenar dados que pertencem a todo o aplicativo e a todos os usuários 
que os utilizam, sem a necessidade de dados estáticos. Além disso, os beans 
singleton podem ser chamados por vários encadeamentos ao mesmo tempo semelhante 
a um servlet.
+
+Consulte o link:../../singleton-beans.html[Singleton Beans] para obter uma 
página inteira da descrição da API javax.ejb.Singleton.
+
+== O codigo
+
+== Concorrencia Bean-Managed de PropertyRegistry 
+
+Aqui, vemos um bean que usa a opção de concorrencia Bean-Managed, bem como a 
anotação @Startup que faz com que o bean seja confirmado pelo contêiner quando 
o aplicativo é iniciado.
+Beans singleton com @ConcurrencyManagement(BEAN) são responsáveis ​​por sua 
própria segurança de thread. O bean mostrado é um registro de propriedade 
simples e fornece um local onde todos os beans de aplicativo podem definir e 
recuperar opções.
+
+[source,java]
+
+package org.superbiz.registry;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.ConcurrencyManagement;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import java.util.Properties;
+
+import static javax.ejb.ConcurrencyManagementType.BEAN;
+
+@Singleton
+@Startup
+@ConcurrencyManagement(BEAN)
+public class PropertyRegistry {
+
+
+// Observe que o objeto java.util.Properties é um 
+// Uma coleção thread-safe que usa sincronização. Se não for assim,
+// Eu teria que usar alguma forma de sincronização para ter certeza
+// Certifique-se de que PropertyRegistryBean é seguro para thread.
+private final Properties properties = new Properties();
+
+// A anotação @Startup garante que
+// Chame esse método quando o aplicativo for iniciado.
+@PostConstruct
+public void applicationStartup() {
+properties.putAll(System.getProperties());
+}
+
+@PreDestroy
+public void applicationShutdown() {
+properties.clear();
+}
+
+public String getProperty(final String key) {
+return properties.getProperty(key);
+}
+
+public String setProperty(final String key, final String value) {
+return (String) properties.setProperty(key, value);
+}
+
+public String removeProperty(final String key) {
+return (String) properties.remove(key);
+}
+}
+
+
+== ComponentRegistry Container-Managed Concurrency
+
+Aqui, vemos um bean que usa a opção de concorrencia 'Container-Managed', o 
padrão. Com `@ConcurrencyManagement(CONTAINER)` o contêiner controla se deve 
permitir o acesso multithread ao bean `@Lock (READ)`) ou se deve forçar o 
acesso de thread único (`@Lock (WRITE)`).
+
+[source,java]
+
+package org.superbiz.registry;
+
+import javax.ejb.Lock;
+import javax.ejb.Singleton;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static javax.ejb.LockType.READ;
+import static javax.ejb.LockType.WRITE;
+
+@Singleton
+@Lock(READ)
+public class ComponentRegistry {
+
+private final Map components = new HashMap();
+
+public  T getComponent(final Class type) {
+return (T) components.get(type);
+}
+
+public Collection getComponents() {
+return new ArrayList(components.values());
+}
+
+@Lock(WRITE)
+public  T setComponent(final Class type, final T value) {
+return (T) components.put(type, value);
+}
+
+@Lock(WRITE)
+public  T removeComponent(final Class type) {
+return (T) components.remove(type);
+}
+}
+
+
+A menos que explicitamente especificado na classe de bean ou um método, o 
padrão `@Lock` é `@Lock(WRITE)`. O código acima usa a anotação `@Lock(READ)` na 
classe do bean para alterar o valor padrão para que o acesso multithread seja 
concedido por padrão. Portanto, só precisamos aplicar a anotação `@Lock(WRITE)` 
aos métodos que modificam o estado do bean.
+
+Essencialmente, `@Lock(READ)` permite acesso multithread à instância do bean 
Singleton, a menos que alguém invoque um método `@Lock(WRITE)`. Usar 
`@Lock(WRITE)` garantirá que a thread que invoca o bean terá acesso exclusivo à 
instância do Singleton bean durante sua invocação. Essa combinação permite que 
a instância do bean use tipos de dados que nor

[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596170235



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));

Review comment:
   If I get it right, the PER_JVM case takes a fully assembled 
`@Application` defined in a class specified via 
`tomee.application-composer.application`. The rational is now to check for 
additional annotations (modules, classes, ...), which would lead to undefined 
behaviour. So it requires a check / validation for the following annotations
   
   ```
   org.apache.openejb.testing.Component; //??
   org.apache.openejb.testing.Module;
   org.apache.openejb.testing.Classes;
   org.apache.openejb.testing.Default //??
   org.apache.openejb.testing.Jars; // ??
   //similar @Deprecated annotated annotations in *.junit.*
   ```
   on the test class and its related methods? Anything additional, @rmannibucau 
?
   





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596145338



##
File path: container/openejb-core/pom.xml
##
@@ -580,6 +580,22 @@
   org.apache.xbean
   xbean-bundleutils
 
+

Review comment:
   Just moved everything into `openejb-junit5`. 
   
   Should we also include the contents of `openejb-junit5-backward` in this new 
 `openejb-junit5` module? We haven't released it yet, so it wouldn't bother 
anyone.
   
   Would bring a dependency towards the legacy testing stuff:
   
   ```

   ${project.groupId}
   openejb-junit
   ${project.version}
   
   ```
   
   Might be cleaner without it? wdyt @rmannibucau ?
   
   





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




Re: TOMEE-2984 Translate to Portuguese: examples/simple-singleton

2021-03-17 Thread Daniel Dias Dos Santos
Hi Alex,

No problem, thanks : )

On Wed, Mar 17, 2021, 08:18 Alex Rabelo Ferreira <
alexrabeloferreira@gmail.com> wrote:

> Sorry for the late review, you did merge. But I think there were a
> few mistakes.
>
> see you later
>
>
>
> [image: Mailtrack]
> <
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;
> >
> Remetente
> notificado por
> Mailtrack
> <
> https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;
> >
> 17/03/21
> 08:13:52
>
> On Tue, Mar 16, 2021 at 10:13 PM Daniel Dias Dos Santos <
> daniel.dias.analist...@gmail.com> wrote:
>
> > Hi Alex,
> >
> > thank you very much for your help, it will be very good :)
> >
> >
> > Em ter., 16 de mar. de 2021 às 21:38, Alex Rabelo Ferreira <
> > alexrabeloferreira@gmail.com> escreveu:
> >
> > > I will help you tomorrow at morning.
> > >
> > > Em ter, 16 de mar de 2021 11:07, Daniel Dias Dos Santos <
> > > daniel.dias.analist...@gmail.com> escreveu:
> > >
> > > > Hello,
> > > >
> > > > I opened a ticket in Jira [1] and a PR [2], can anyone revise
> > > > the translation?
> > > >
> > > > thank you
> > > >
> > > > [1] https://issues.apache.org/jira/browse/TOMEE-2473
> > > > [2] https://github.com/apache/tomee/pull/775
> > > >
> > >
> >
>
>
> --
> *Att.*
>
> Alex Rabelo Ferreira
> Analista de Sistemas de Informação
> Mestre em Ciências da Computação INF/UFG
>
> *"Os grandes feitos são conseguidos não pela força, mas pela perseverança"
> - *Samuel Johnson
>


[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r596113257



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));

Review comment:
   Okay. I think I am understanding it now. Found some information about 
`-Dtomee.application-composer.application`, so I guess, we should do the 
validation.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r595971489



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {

Review comment:
   1.) -> might be addressed with 
https://github.com/apache/tomee/pull/767/commits/6fba175b05270b9838b87a98d346da246135c4d0





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r595909860



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {

Review comment:
   I updated the related code fragments (via `validate(context)`. I don't 
know exactly, if I got the idea. Can you check, @rmannibucau ?

##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));
+} else if (isPerAll(context)) {
+doStart(context);
+} else if (isPerDefault(context)) {
+if (isPerClass(context)) {
+doStart(context);
+}
+}
+
+if (isPerClass(context)) {
+doInject(context);
+}
+}
+
+@Override
+public void afterAll(ExtensionContext context) throws Exception {
+if (isPerJvm(context) || isPerAll(context)) {
+doRelease(context);
+} else if (isPerDefault(context) && isPerClass(context)) {
+doRelease(context);
+}
+}
+
+
+@Override
+public void beforeEach(ExtensionContext context) {
+
+if (isPerEach(context)) {

Review comment:
   Thx for clarification. Makes sense to me. I have updated the related 
code: 
https://github.com/apache/tomee/pull/767/commits/fc

Re: TOMEE-2984 Translate to Portuguese: examples/simple-singleton

2021-03-17 Thread Alex Rabelo Ferreira
Sorry for the late review, you did merge. But I think there were a
few mistakes.

see you later



[image: Mailtrack]

Remetente
notificado por
Mailtrack

17/03/21
08:13:52

On Tue, Mar 16, 2021 at 10:13 PM Daniel Dias Dos Santos <
daniel.dias.analist...@gmail.com> wrote:

> Hi Alex,
>
> thank you very much for your help, it will be very good :)
>
>
> Em ter., 16 de mar. de 2021 às 21:38, Alex Rabelo Ferreira <
> alexrabeloferreira@gmail.com> escreveu:
>
> > I will help you tomorrow at morning.
> >
> > Em ter, 16 de mar de 2021 11:07, Daniel Dias Dos Santos <
> > daniel.dias.analist...@gmail.com> escreveu:
> >
> > > Hello,
> > >
> > > I opened a ticket in Jira [1] and a PR [2], can anyone revise
> > > the translation?
> > >
> > > thank you
> > >
> > > [1] https://issues.apache.org/jira/browse/TOMEE-2473
> > > [2] https://github.com/apache/tomee/pull/775
> > >
> >
>


-- 
*Att.*

Alex Rabelo Ferreira
Analista de Sistemas de Informação
Mestre em Ciências da Computação INF/UFG

*"Os grandes feitos são conseguidos não pela força, mas pela perseverança"
- *Samuel Johnson


[GitHub] [tomee] rmannibucau commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rmannibucau commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r595920794



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));
+} else if (isPerAll(context)) {
+doStart(context);
+} else if (isPerDefault(context)) {
+if (isPerClass(context)) {
+doStart(context);
+}
+}
+
+if (isPerClass(context)) {
+doInject(context);
+}
+}
+
+@Override
+public void afterAll(ExtensionContext context) throws Exception {
+if (isPerJvm(context) || isPerAll(context)) {
+doRelease(context);
+} else if (isPerDefault(context) && isPerClass(context)) {
+doRelease(context);
+}
+}
+
+
+@Override
+public void beforeEach(ExtensionContext context) {
+
+if (isPerEach(context)) {

Review comment:
   Yes, my starting point is that it is very error prone to test multiple 
times the same thing (let's ignore perf since it is simple tests). Since any 
"start" logic will put something (likely different) in the store, the presence 
can be used to test which case you are in to handle > start callbacks.
   One way to see it is to have 3 impls (3 extensions) of 
BeforeAll+BeforeEach+AfterAll+AfterEach and put the impl in beforeAll of this 
extension which will then acts as a facade and select which impl to use in 
before all.
   This way code path is unique each time and simple, only this extension 
beforeAll has some mode usage, all others are passthrough.





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] alexferreiradev commented on a change in pull request #775: TOMEE-2984 Translate to Portuguese: examples/simple-singleton

2021-03-17 Thread GitBox


alexferreiradev commented on a change in pull request #775:
URL: https://github.com/apache/tomee/pull/775#discussion_r595916102



##
File path: examples/simple-singleton/README_pt.adoc
##
@@ -0,0 +1,365 @@
+:index-group: Session Beans
+:jbake-type: page
+:jbake-status: status=published
+= Simples Singleton
+
+Como o nome indica, um `javax.ejb.Singleton`, é um bean de sessão com a 
garantia de que há no máximo uma instância no aplicativo.

Review comment:
   I think that the translation of `applicación` can be `aplicação` in pt. 
What do you think ? 

##
File path: examples/simple-singleton/README_pt.adoc
##
@@ -0,0 +1,365 @@
+:index-group: Session Beans
+:jbake-type: page
+:jbake-status: status=published
+= Simples Singleton
+
+Como o nome indica, um `javax.ejb.Singleton`, é um bean de sessão com a 
garantia de que há no máximo uma instância no aplicativo.
+
+O que está faltando completamente no EJB 3.0 e anteriores é a capacidade de 
ter um EJB que é notificado quando o aplicativo é iniciado e quando ele para. 
Portanto, você pode fazer todos os tipos de coisas que antes só podiam ser 
feitas com um servlet de carregamento na inicialização. Também oferece um local 
para armazenar dados que pertencem a todo o aplicativo e a todos os usuários 
que os utilizam, sem a necessidade de dados estáticos. Além disso, os beans 
singleton podem ser chamados por vários encadeamentos ao mesmo tempo semelhante 
a um servlet.
+
+Consulte o link:../../singleton-beans.html[Singleton Beans] para obter uma 
página inteira da descrição da API javax.ejb.Singleton.
+
+== O codigo
+
+== Concorrencia Bean-Managed de PropertyRegistry 
+
+Aqui, vemos um bean que usa a opção de concorrencia Bean-Managed, bem como a 
anotação @Startup que faz com que o bean seja confirmado pelo contêiner quando 
o aplicativo é iniciado.
+Beans singleton com @ConcurrencyManagement(BEAN) são responsáveis ​​por sua 
própria segurança de thread. O bean mostrado é um registro de propriedade 
simples e fornece um local onde todos os beans de aplicativo podem definir e 
recuperar opções.
+
+[source,java]
+
+package org.superbiz.registry;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.ConcurrencyManagement;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import java.util.Properties;
+
+import static javax.ejb.ConcurrencyManagementType.BEAN;
+
+@Singleton
+@Startup
+@ConcurrencyManagement(BEAN)
+public class PropertyRegistry {
+
+
+// Observe que o objeto java.util.Properties é um 
+// Uma coleção thread-safe que usa sincronização. Se não for assim,
+// Eu teria que usar alguma forma de sincronização para ter certeza
+// Certifique-se de que PropertyRegistryBean é seguro para thread.
+private final Properties properties = new Properties();
+
+// A anotação @Startup garante que
+// Chame esse método quando o aplicativo for iniciado.
+@PostConstruct
+public void applicationStartup() {
+properties.putAll(System.getProperties());
+}
+
+@PreDestroy
+public void applicationShutdown() {
+properties.clear();
+}
+
+public String getProperty(final String key) {
+return properties.getProperty(key);
+}
+
+public String setProperty(final String key, final String value) {
+return (String) properties.setProperty(key, value);
+}
+
+public String removeProperty(final String key) {
+return (String) properties.remove(key);
+}
+}
+
+
+== ComponentRegistry Container-Managed Concurrency
+
+Aqui, vemos um bean que usa a opção de concorrencia 'Container-Managed', o 
padrão. Com `@ConcurrencyManagement(CONTAINER)` o contêiner controla se deve 
permitir o acesso multithread ao bean `@Lock (READ)`) ou se deve forçar o 
acesso de thread único (`@Lock (WRITE)`).
+
+[source,java]
+
+package org.superbiz.registry;
+
+import javax.ejb.Lock;
+import javax.ejb.Singleton;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import static javax.ejb.LockType.READ;
+import static javax.ejb.LockType.WRITE;
+
+@Singleton
+@Lock(READ)
+public class ComponentRegistry {
+
+private final Map components = new HashMap();
+
+public  T getComponent(final Class type) {
+return (T) components.get(type);
+}
+
+public Collection getComponents() {
+return new ArrayList(components.values());
+}
+
+@Lock(WRITE)
+public  T setComponent(final Class type, final T value) {
+return (T) components.put(type, value);
+}
+
+@Lock(WRITE)
+public  T removeComponent(final Class type) {
+return (T) components.remove(type);
+}
+}
+
+
+A menos que explicitamente especificado na classe de bean ou um método, o 
padrão `@Lock` é `@Lock(WRITE)`. O código acima usa a anotação `@Lock(READ)` na 
classe do bean para alterar o valor padrão para que o acesso multithread seja 
concedido por padrão. Porta

[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r595911922



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));
+} else if (isPerAll(context)) {
+doStart(context);
+} else if (isPerDefault(context)) {
+if (isPerClass(context)) {
+doStart(context);
+}
+}
+
+if (isPerClass(context)) {
+doInject(context);
+}
+}
+
+@Override
+public void afterAll(ExtensionContext context) throws Exception {
+if (isPerJvm(context) || isPerAll(context)) {
+doRelease(context);
+} else if (isPerDefault(context) && isPerClass(context)) {
+doRelease(context);
+}
+}
+
+
+@Override
+public void beforeEach(ExtensionContext context) {
+
+if (isPerEach(context)) {

Review comment:
   I think, I do not get the idea of the "all"-marker ? Is it about 
simplyfing the different conditions (which are some how reworked now but maybe 
subject to change) 
   
   Maybe you can add some more context, @rmannibucau ?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r595909860



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {

Review comment:
   I updated the related code fragments (via `validate(context)`. I don't 
know exactly, if I got the idea. Can you check, @rmannibucau ?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [tomee] rzo1 commented on a change in pull request #767: TOMEE-2977 - Provide a ApplicationComposer JUnit 5 Extension

2021-03-17 Thread GitBox


rzo1 commented on a change in pull request #767:
URL: https://github.com/apache/tomee/pull/767#discussion_r595907948



##
File path: 
container/openejb-core/src/main/java/org/apache/openejb/junit/jupiter/ApplicationComposerExtension.java
##
@@ -0,0 +1,155 @@
+/*
+ * 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.openejb.junit.jupiter;
+
+import org.apache.openejb.OpenEJBRuntimeException;
+import org.apache.openejb.testing.ApplicationComposers;
+import org.apache.openejb.testing.SingleApplicationComposerBase;
+import org.junit.jupiter.api.extension.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+public class ApplicationComposerExtension extends 
ApplicationComposerExtensionBase implements BeforeAllCallback, 
AfterAllCallback, BeforeEachCallback, AfterEachCallback {
+
+private static final ExtensionContext.Namespace NAMESPACE = 
ExtensionContext.Namespace.create(ApplicationComposerExtension.class.getName());
+private static final SingleApplicationComposerBase BASE = new 
SingleApplicationComposerBase();
+
+@Override
+public void beforeAll(ExtensionContext context) throws Exception {
+
+if (isPerJvm(context)) {
+BASE.start(context.getTestClass().orElse(null));

Review comment:
   Couldn't find any documentation related to `@Application` at all. It 
seems, it isn't quite often used in the code base nor in the examples? 
   
   `ApplicationComposers#validate()`will complain and fail to start any 
container, if there is no `@Classes` or `@Default` annotation present?
   
   Probably, I don't get the point here?





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org