Re: Building TomEE, openejb-core, crashed test: org.apache.openejb.assembler.DeployerEjbTest

2018-11-26 Thread Ferdi
I've tried changing to that version as well, didn't work.

If I run the command that broke the test:

"C:\Program Files\Java\jdk1.8.0_161\jre\bin\java"
-javaagent:C:\Users\Ferdi_S672\Documents\Personal\Projects\tomee\container\openejb-core\target\openejb-javaagent-8.0.0-SNAPSHOT.jar
-Dopenejb.classloader.forced-skip=org.apache.openejb.jee.,org.apache.openejb.api.
-Dopenejb.classloader.forced-load=org.apache.openejb -enableassertions
-Dopenejb.descriptors.output.folder=./dump/
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=org,java -jar
C:\Users\FERDI_~1\AppData\Local\Temp\surefire4923413819281954940\surefirebooter7579699950053744316.jar
C:\Users\Ferdi_S672\AppData\Local\Temp\surefire4923413819281954940
2018-11-27T15-00-14_583-jvmRun1 surefire7936970543296277600tmp
surefire_04537004988640125092tmp

I got this:

# Created at 2018-11-27T15:08:14.729
System.exit() or native command error interrupted process checker.
java.lang.IllegalStateException: Cannot use PPID 5228 process
information. Going to use NOOP events.
at
org.apache.maven.surefire.booter.PpidChecker.checkProcessInfo(PpidChecker.java:155)
at
org.apache.maven.surefire.booter.PpidChecker.isProcessAlive(PpidChecker.java:116)
at
org.apache.maven.surefire.booter.ForkedBooter$2.run(ForkedBooter.java:214)
at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

On 11/26/2018 8:02 PM, Jonathan Gallimore wrote:
> Going to fire this off on a Linux and a Windows machine here to see a) if I
> see the same thing, and b) see if I can give some pointers. I don't have
> ideas right off the top of my head at the moment. Romain's suggestion is
> definitely worth a try.
> 
> For reference, we have a CI build here:
> https://ci.apache.org/builders/tomee-trunk-ubuntu-jvm8 - it doesn't look
> like we have the same issue there (we have different ones!)
> 
> Thanks for trying this - and thanks for trying it on a Windows machine too,
> its good to know whether it is or isn't working there.
> 
> Jon
> 
> On Mon, Nov 26, 2018 at 7:55 AM Romain Manni-Bucau 
> wrote:
> 
>> Hi Ferdi,
>>
>> surefire got some "hiccup" in last versions, maybe try 3.0.0-M1 or or
>> 2.22.1 which should work, if not the output dump can help sometimes to
>> identify if it is a memory issue or (more likely) another one.
>>



Re: Feedback as newbie

2018-11-26 Thread César Hernández Mendoza
Hi Frankie,
In case you found it useful, there is a video that Ivan created to show how
to build and test the website locally:
https://youtu.be/P6IM0LDevVU

El lun., 26 nov. 2018 a las 14:46, Frankie ()
escribió:

> Thanks for all the helpful input.
> I hope I will find time the next days to read, learn and play with the
> site-builder and then hopefully work on its content.
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


-- 
Atentamente:
César Hernández Mendoza.


Re: Feedback as newbie

2018-11-26 Thread Frankie
Thanks for all the helpful input.
I hope I will find time the next days to read, learn and play with the
site-builder and then hopefully work on its content.



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html


PRs and descriptive subjects

2018-11-26 Thread David Blevins
Quick note that emails for PRs should have a description of the work in the 
subject line.  Here are some examples and why:

 - bad:  This is an email about PR #451
 - bad:  See PR #451
 - bad:  Review PR #451
 - bad:  Help needed in PR #451

With this style you'll get low participation on the thread as the subject is 
hidden.  You yourself will curse these emails in six months or a year in the 
future when you're looking for that valuable thread you remember, but your 
search reveals 10 threads all with basically only a number as the subject.  
You'll either click and read all 10 PRs and email threads, or you'll more 
likely just give up.  Worse, you may read all 10 and not find what you're 
looking for.  Do your future self a favor and help him/her find the valuable 
discussions.


 - ok: Options pertaining to the configuration of Javamail - PR# 451
 - ok: Fixing issues on failover of JMS messages - PR# 451
 - ok: Documenting deployment of JCA Connectors - PR# 451

These are ok, much better than just a number.  Subjects are often truncated.  
The real "meat" is at the end of the sentence which makes it the first to go.  
Not a show-stopper, but can make your life hard when searching or scanning.

 - best: Javamail configuration options - PR# 451
 - best: JMS Failover issues - PR# 451
 - best: JCA connector deployment - PR# 451

Here we flip it.  The real subject as at the beginning.  The verbs and generic 
nouns like "options" come after.  When you can pull it off, huge respect.


-- 
David Blevins
http://twitter.com/dblevins
http://www.tomitribe.com



[GitHub] tomee pull request #221: TOMEE-2279 - Fixing issue with payload format

2018-11-26 Thread ivanjunckes
GitHub user ivanjunckes opened a pull request:

https://github.com/apache/tomee/pull/221

TOMEE-2279 - Fixing issue with payload format



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ivanjunckes/tomee 
metrics-counted-example-fixes

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/tomee/pull/221.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #221


commit e5455e5c46702dbae58e31b31230879be73b162b
Author: ivanjunckes 
Date:   2018-11-26T18:29:48Z

jsonb was wrong, so the payload was wrong as well




---


Re: Please review PR #214

2018-11-26 Thread Bruno Baptista

Hi Romain,

Thanks for you feedback.

I've pushed changes and added a comment to the PR.

Cheers.

Bruno Baptista
https://twitter.com/brunobat_


On 26/11/18 17:11, Romain Manni-Bucau wrote:

Hello Bruno,

I put some suggestions on the PR, hope it helps.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le lun. 26 nov. 2018 à 18:02, Bruno Baptista  a écrit :


Hi,

I think the code for this example: TOMEE-2283 New Example: Websocket
with TLS and Basic Auth 

Is ready for review here: https://github.com/apache/tomee/pull/214

Can one of you please take a look?

Cheers

--
Bruno Baptista
https://twitter.com/brunobat_





[GitHub] tomee issue #214: TOMEE-2283 - Websocket tls basic auth example

2018-11-26 Thread brunobat
Github user brunobat commented on the issue:

https://github.com/apache/tomee/pull/214
  
Hi @rmannibucau ,
Thanks for your comments. 
I've performed the following changes:
* I've removed the NOTICE/LICENSE files.
* Added missing headers to a few files. 
* I updated the package name... I had forgot to rename the package name... 
:)
* removed value= when 
* correct, the deplyment name is not needed here. Removed.

In relation to the server.xml and the keystore files...
The setup is on purpose. My initial idea was to have an arquillian 
configuration that can be easily migrated to an actual server. This way, The 
user can get inspiration to update their configuration files.
The keystore can be generated, but I fill it will complicate the example's 
interpretation. I feel it's easier like this. 


---


[GitHub] tomee issue #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on the issue:

https://github.com/apache/tomee/pull/218
  
@brunobat your  branch seems to be old dated. Can you update it and try 
again?


---


Re: Please review PR #214

2018-11-26 Thread Romain Manni-Bucau
Hello Bruno,

I put some suggestions on the PR, hope it helps.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le lun. 26 nov. 2018 à 18:02, Bruno Baptista  a écrit :

> Hi,
>
> I think the code for this example: TOMEE-2283 New Example: Websocket
> with TLS and Basic Auth 
>
> Is ready for review here: https://github.com/apache/tomee/pull/214
>
> Can one of you please take a look?
>
> Cheers
>
> --
> Bruno Baptista
> https://twitter.com/brunobat_
>
>
>


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236343729
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -157,7 +159,10 @@ private void assertJsonFormat(final String metricPath) 
{
 };
 
 Stream.of(expected)
-.forEach(text -> assertTrue("Expected: " + text + " to be 
present in " + metric, metric.contains(text)));
+.forEach(text ->
+assertTrue(
+"Expected: " + text + " to be present in " 
+ metric,
+
expectedJson.getJsonObject("weather_day_status").get("count") != null));
--- End diff --

Done :)


---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236343527
  
--- Diff: examples/mp-metrics-timed/pom.xml ---
@@ -0,0 +1,71 @@
+
--- End diff --

Done :) Tks


---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread rmannibucau
Github user rmannibucau commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236342694
  
--- Diff: examples/mp-metrics-timed/pom.xml ---
@@ -0,0 +1,71 @@
+
--- End diff --

header ;)


---


Please review PR #214

2018-11-26 Thread Bruno Baptista

Hi,

I think the code for this example: TOMEE-2283 New Example: Websocket 
with TLS and Basic Auth 


Is ready for review here: https://github.com/apache/tomee/pull/214

Can one of you please take a look?

Cheers

--
Bruno Baptista
https://twitter.com/brunobat_




[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236338450
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
+.path("/weather/day/status")
+.get(String.class);
+
+final String metricPath = 
"/metrics/application/weather_day_status";
+assertPrometheusFormat(metricPath);
+assertJsonFormat(metricPath);
+}
+
+private void assertPrometheusFormat(final String metricPath) {
+final String metric = WebClient.create(base.toExternalForm())
+.path(metricPath)
+.accept(MediaType.TEXT_PLAIN)
+.get(String.class);
+
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds summary timer"));
--- End diff --

But added the suggestion using Stream


---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236337920
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
+.path("/weather/day/status")
+.get(String.class);
+
+final String metricPath = 
"/metrics/application/weather_day_status";
+assertPrometheusFormat(metricPath);
+assertJsonFormat(metricPath);
+}
+
+private void assertPrometheusFormat(final String metricPath) {
+final String metric = WebClient.create(base.toExternalForm())
+.path(metricPath)
+.accept(MediaType.TEXT_PLAIN)
+.get(String.class);
+
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds summary timer"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds_count timer"));
+
assertTrue(metric.contains("application:weather_day_status_seconds_count 1.0"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_one_min_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_one_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_five_min_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_five_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_fifteen_min_rate_per_second time"));
+
assertTrue(metric.contains("application:weather_day_status_fifteen_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_min_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_min_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_max_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_max_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_mean_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_mean_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_stddev_seconds timer"));
+

[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236337860
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
+.path("/weather/day/status")
+.get(String.class);
+
+final String metricPath = 
"/metrics/application/weather_day_status";
+assertPrometheusFormat(metricPath);
+assertJsonFormat(metricPath);
+}
+
+private void assertPrometheusFormat(final String metricPath) {
+final String metric = WebClient.create(base.toExternalForm())
+.path(metricPath)
+.accept(MediaType.TEXT_PLAIN)
+.get(String.class);
+
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds summary timer"));
--- End diff --

I think keeping extra tests will not hurt :)


---


Re: Please review PR #201

2018-11-26 Thread Romain Manni-Bucau
@Bruno: note that this is not what we are doing, I'm just mentionning that
TomEE does not need that and that there is no need to put any pressure
either on TomEE or Geronimo in such situation since everything is good on
both side in current state.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le lun. 26 nov. 2018 à 17:05, Bruno Baptista  a écrit :

> It's just that I would expect to release 1.0.1 for a mater of principle.
>
> I think we shouldn't throw away an already approved valid contribution.
>
> Bruno Baptista
> https://twitter.com/brunobat_
>
>
> On 26/11/18 13:53, Romain Manni-Bucau wrote:
> > Le lun. 26 nov. 2018 à 14:48, Bruno Baptista  a
> écrit :
> >
> >> Hi Romain,
> >>
> >> We are holding other work with this discussion.
> >>
> >> Can we agree that this is good enough for a 1st version and move on with
> >> a follow up PR?... It's not going to be worse than starting SE tasks
> >> inside the container, like we have now.
> >>
> > As I said, while it is not released without being harnessed I'm happy
> > without any way working for you.
> >
> >
> >> Also, releasing Safegard 1.0.1 would be nice. There is unreleased code
> >> in there that this work needs. We can live with the SNAPSHOT in the
> >> meantime because there is no prediction of work for that SNAPSHOT.
> >>
> > I don't think there is anything needed, you can replace all that by a
> > standard cdi extension if the snapshot is bothering you can use the last
> > release.
> > Just veto the default and override the impl, no?
> >
> >
> >> Cheers.
> >>
> >> Bruno Baptista
> >> https://twitter.com/brunobat_
> >>
> >>
> >> On 23/11/18 15:41, Romain Manni-Bucau wrote:
> >>> Le ven. 23 nov. 2018 à 16:34, Bruno Baptista  a
> >> écrit :
>  Hi Romain,
> 
>  About "The point is not the cdi bean but the executor. So high level
> you
>  deploy an
>  app not using safeguard but it being present and you ensure the
> >> container
>  has no executor resource instantiated (you will get one (the
> facade))."
> 
>  Sorry Romain, I still don't understand how the code in the PR can
>  possible affect something not using the FT API or Safeguard in
> >> particular.
> >>> I think the code is ok but it uses assumptions which are likely not
> >> obvious
> >>> and it is not tested so next commit will break it - since this code
> must
> >> be
> >>> reworked anyway - and you will not see it.
> >>> So better to ensure the build guarantee all the outcome we want for end
> >>> users.
> >>>
> >>>
>  In relation to the Managed executor... What you say makes sense but I
>  wonder how likely it is to happen and if it's enough to hold the PR.
> Do
>  you have a custom executor example somewhere?
> 
> >>> We have some in the core tests you can reuse. But long story short you
> >> run
> >>> your test, don't use safeguard and guarantee in @Test by looking up the
> >>> resource directly using internals (SystemInstance > ContainerSystem and
> >> so
> >>> on) that the instance is not yet instantiated. See for a test doing
> >> exactly
> >>> that:
> >>>
> >>
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/LazyResourceTest.java#L41
> >>> To summarize:
> >>>
> >>> 1. CDI is lazy
> >>> 2. we define the default executor as being lazy
> >>> 3. we assume safeguard will not impact an app not using it
> >>>
> >>> ==> you must ensure that 3 didnt trigger an executor creation, it is
> fine
> >>> to rely on 1+2 (which means so "main" code)
> >>>
> >>>
>  Cheers
> 
>  Bruno Baptista
>  https://twitter.com/brunobat_
> 
> 
>  On 23/11/18 15:14, Romain Manni-Bucau wrote:
> > Le ven. 23 nov. 2018 à 15:49, Bruno Baptista  a
>  écrit :
> >> Hi Romain,
> >>
> >> Thanks for your comment.
> >>
> >> The class doing the resource injection is lazy loaded, specifically
> >> /FailsafeContainerExecutionManagerProvider/. I did verify it in
> >> development but no test was produced... And to say the truth I
> >> wouldn't
> >> know how to validate if a bean has already been loaded or not. Can
> you
> >> please provide a test example?
> >>
> > The point is not the cdi bean but the executor. So high level you
> >> deploy
>  an
> > app not using safeguard but it being present and you ensure the
> >> container
> > has no executor resource instantiated (you will get one (the
> facade)).
> >
> >
> >> Please explain what do you mean by "MP-fault-tolerance executor for
> >> that
> >> case if noone exists". It will exist, that's the whole purpose of
> this
> >> PR. Can you please provide an example where 

Re: Please review PR #201

2018-11-26 Thread Bruno Baptista

It's just that I would expect to release 1.0.1 for a mater of principle.

I think we shouldn't throw away an already approved valid contribution.

Bruno Baptista
https://twitter.com/brunobat_


On 26/11/18 13:53, Romain Manni-Bucau wrote:

Le lun. 26 nov. 2018 à 14:48, Bruno Baptista  a écrit :


Hi Romain,

We are holding other work with this discussion.

Can we agree that this is good enough for a 1st version and move on with
a follow up PR?... It's not going to be worse than starting SE tasks
inside the container, like we have now.


As I said, while it is not released without being harnessed I'm happy
without any way working for you.



Also, releasing Safegard 1.0.1 would be nice. There is unreleased code
in there that this work needs. We can live with the SNAPSHOT in the
meantime because there is no prediction of work for that SNAPSHOT.


I don't think there is anything needed, you can replace all that by a
standard cdi extension if the snapshot is bothering you can use the last
release.
Just veto the default and override the impl, no?



Cheers.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:41, Romain Manni-Bucau wrote:

Le ven. 23 nov. 2018 à 16:34, Bruno Baptista  a

écrit :

Hi Romain,

About "The point is not the cdi bean but the executor. So high level you
deploy an
app not using safeguard but it being present and you ensure the

container

has no executor resource instantiated (you will get one (the facade))."

Sorry Romain, I still don't understand how the code in the PR can
possible affect something not using the FT API or Safeguard in

particular.

I think the code is ok but it uses assumptions which are likely not

obvious

and it is not tested so next commit will break it - since this code must

be

reworked anyway - and you will not see it.
So better to ensure the build guarantee all the outcome we want for end
users.



In relation to the Managed executor... What you say makes sense but I
wonder how likely it is to happen and if it's enough to hold the PR. Do
you have a custom executor example somewhere?


We have some in the core tests you can reuse. But long story short you

run

your test, don't use safeguard and guarantee in @Test by looking up the
resource directly using internals (SystemInstance > ContainerSystem and

so

on) that the instance is not yet instantiated. See for a test doing

exactly

that:


https://github.com/apache/tomee/blob/master/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/LazyResourceTest.java#L41

To summarize:

1. CDI is lazy
2. we define the default executor as being lazy
3. we assume safeguard will not impact an app not using it

==> you must ensure that 3 didnt trigger an executor creation, it is fine
to rely on 1+2 (which means so "main" code)



Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:14, Romain Manni-Bucau wrote:

Le ven. 23 nov. 2018 à 15:49, Bruno Baptista  a

écrit :

Hi Romain,

Thanks for your comment.

The class doing the resource injection is lazy loaded, specifically
/FailsafeContainerExecutionManagerProvider/. I did verify it in
development but no test was produced... And to say the truth I

wouldn't

know how to validate if a bean has already been loaded or not. Can you
please provide a test example?


The point is not the cdi bean but the executor. So high level you

deploy

an

app not using safeguard but it being present and you ensure the

container

has no executor resource instantiated (you will get one (the facade)).



Please explain what do you mean by "MP-fault-tolerance executor for

that

case if noone exists". It will exist, that's the whole purpose of this
PR. Can you please provide an example where a
/ManagedScheduledExecutorService/ will not be present?


You can see it as "don't let it default to a random executor". This is

the

current behavior. So here is what can happen:

1. The user doesnt use any executor -> it defaults -> it is ok
2. The user uses one or more executors for his app -> it defaults to it

->

it messes up the app and does not have the expected setting

Case 2 is important cause it can really make it not functional and even
lead to locks in some cases so better to not let it happen and just

create

a safeguard executor if
the user didnt specify he wants safeguard to use the executor
"'mysafeguardexecutor".

This is why the config is important and I mentionned it early even if

it

is

not the most sexy part to do, I agree.



Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 14:39, Romain Manni-Bucau wrote:

It's lazily loaded, so no worries on that regard.

What is "it" here? :)

Conretely the bean instantiation yes cause it is normal scoped and

the

resource too cause it is by default lazy in tomee (service-jar.xml)

but

it

is worth a test that prevent regression on that behavior IMHO, I

didn't

catch on in the PR.

Concretely in terms of container we can want to create a dedicated
MP-fault-tolerance 

[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread rmannibucau
Github user rmannibucau commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236314041
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
--- End diff --

WebClient is a CXF API, you can use the standard JAXRS Client 
https://docs.oracle.com/javaee/7/api/javax/ws/rs/client/Client.html


---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread ivanjunckes
Github user ivanjunckes commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236312514
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
--- End diff --

What you mean by "Use the Client (jaxrs) instead of a cxf api?"?


---


[GitHub] tomee pull request #208: Fixed a couple CDI Examples

2018-11-26 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/tomee/pull/208


---


[GitHub] tomee pull request #219: Avoid String in a loop

2018-11-26 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/tomee/pull/219


---


Re: Avoid String in a loop

2018-11-26 Thread Jonathan Gallimore
I was surprised the figures were as different as they are. I appreciate
Romain's feedback - I suspect we won't see dramatic performance increases,
but it certainly doesn't do us any harm, so I'll merge this in. Thanks for
the patch!

Jon

On Mon, Nov 26, 2018 at 2:40 PM Romain Manni-Bucau 
wrote:

> +0 (this is only for error cases as far as i saw and a few concatenations
> so you don't see the diff in practise + the compiler is able to optimize it
> and even replace string builder when relevant these days)
>
> Romain Manni-Bucau
> @rmannibucau  |  Blog
>  | Old Blog
>  | Github <
> https://github.com/rmannibucau> |
> LinkedIn  | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le lun. 26 nov. 2018 à 15:38, Daniel Cunha  a
> écrit :
>
> > Wowww!
> >
> > Nice catch Otávio!
> > That is really a good improvement!
> >
> > Em seg, 26 de nov de 2018 às 10:47, Otávio Gonçalves de Santana <
> > osant...@tomitribe.com> escreveu:
> >
> > > The reason to prefer StringBuilder is that both + and concat create a
> new
> > > object every time you call them (provided the right-hand side argument
> is
> > > not empty). This can quickly add up to a lot of objects, almost all of
> > > which are completely unnecessary.
> > >
> > > public class Main{
> > > public static void main(String[] args)
> > > {
> > > long now = System.currentTimeMillis();
> > > slow();
> > > System.out.println("slow elapsed " +
> > > (System.currentTimeMillis() - now) + " ms");
> > >
> > > now = System.currentTimeMillis();
> > > fast();
> > > System.out.println("fast elapsed " +
> > > (System.currentTimeMillis() - now) + " ms");
> > > }
> > >
> > > private static void fast()
> > > {
> > > StringBuilder s = new StringBuilder();
> > > for(int i=0;i<10;i++)
> > > s.append("*");
> > > }
> > >
> > > private static void slow()
> > > {
> > > String s = "";
> > > for(int i=0;i<10;i++)
> > > s+="*";
> > > }
> > > }
> > >
> > >
> > >- slow elapsed 11741 ms
> > >- fast elapsed 7 ms
> > >
> > > Also, this PR avoids unnecessary call in StringBuilder
> > > Ref: https://github.com/apache/tomee/pull/219
> > >
> >
> >
> > --
> > Daniel "soro" Cunha
> > https://twitter.com/dvlc_
> >
>


[GitHub] tomee pull request #220: [WIP] TOMEE-2292 - Config Microprofile Example

2018-11-26 Thread danielsoro
GitHub user danielsoro opened a pull request:

https://github.com/apache/tomee/pull/220

[WIP] TOMEE-2292 - Config Microprofile Example



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/danielsoro/tomee mp-config-sample

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/tomee/pull/220.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #220


commit 3ba14b8d86dd7d83667f6c33827c3cc42a44741b
Author: Daniel Cunha (soro) 
Date:   2018-11-26T14:45:15Z

TOMEE-2292 - Config Microprofile Example




---


Re: Avoid String in a loop

2018-11-26 Thread Romain Manni-Bucau
+0 (this is only for error cases as far as i saw and a few concatenations
so you don't see the diff in practise + the compiler is able to optimize it
and even replace string builder when relevant these days)

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github  |
LinkedIn  | Book



Le lun. 26 nov. 2018 à 15:38, Daniel Cunha  a écrit :

> Wowww!
>
> Nice catch Otávio!
> That is really a good improvement!
>
> Em seg, 26 de nov de 2018 às 10:47, Otávio Gonçalves de Santana <
> osant...@tomitribe.com> escreveu:
>
> > The reason to prefer StringBuilder is that both + and concat create a new
> > object every time you call them (provided the right-hand side argument is
> > not empty). This can quickly add up to a lot of objects, almost all of
> > which are completely unnecessary.
> >
> > public class Main{
> > public static void main(String[] args)
> > {
> > long now = System.currentTimeMillis();
> > slow();
> > System.out.println("slow elapsed " +
> > (System.currentTimeMillis() - now) + " ms");
> >
> > now = System.currentTimeMillis();
> > fast();
> > System.out.println("fast elapsed " +
> > (System.currentTimeMillis() - now) + " ms");
> > }
> >
> > private static void fast()
> > {
> > StringBuilder s = new StringBuilder();
> > for(int i=0;i<10;i++)
> > s.append("*");
> > }
> >
> > private static void slow()
> > {
> > String s = "";
> > for(int i=0;i<10;i++)
> > s+="*";
> > }
> > }
> >
> >
> >- slow elapsed 11741 ms
> >- fast elapsed 7 ms
> >
> > Also, this PR avoids unnecessary call in StringBuilder
> > Ref: https://github.com/apache/tomee/pull/219
> >
>
>
> --
> Daniel "soro" Cunha
> https://twitter.com/dvlc_
>


[GitHub] tomee pull request #219: Avoid String in a loop

2018-11-26 Thread danielsoro
Github user danielsoro commented on a diff in the pull request:

https://github.com/apache/tomee/pull/219#discussion_r236279011
  
--- Diff: 
container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 ---
@@ -2939,12 +2939,14 @@ public EjbModule deploy(final EjbModule ejbModule) 
throws OpenEJBException {
 }
 
 if (interfaces.size() != 1) {
-String msg = "When annotating a bean class as 
@MessageDriven without declaring messageListenerInterface, the bean must 
implement exactly one interface, no more and no less. beanClass=" + 
clazz.getName() + " interfaces=";
+StringBuilder msg = new StringBuilder("When 
annotating a bean class as @MessageDriven without" +
--- End diff --

What do you think to use String.format in cases like that?


---


[GitHub] tomee issue #208: Fixed a couple CDI Examples

2018-11-26 Thread monsonhaefel
Github user monsonhaefel commented on the issue:

https://github.com/apache/tomee/pull/208
  
More changes to example README.mds


---


Re: Avoid String in a loop

2018-11-26 Thread Daniel Cunha
Wowww!

Nice catch Otávio!
That is really a good improvement!

Em seg, 26 de nov de 2018 às 10:47, Otávio Gonçalves de Santana <
osant...@tomitribe.com> escreveu:

> The reason to prefer StringBuilder is that both + and concat create a new
> object every time you call them (provided the right-hand side argument is
> not empty). This can quickly add up to a lot of objects, almost all of
> which are completely unnecessary.
>
> public class Main{
> public static void main(String[] args)
> {
> long now = System.currentTimeMillis();
> slow();
> System.out.println("slow elapsed " +
> (System.currentTimeMillis() - now) + " ms");
>
> now = System.currentTimeMillis();
> fast();
> System.out.println("fast elapsed " +
> (System.currentTimeMillis() - now) + " ms");
> }
>
> private static void fast()
> {
> StringBuilder s = new StringBuilder();
> for(int i=0;i<10;i++)
> s.append("*");
> }
>
> private static void slow()
> {
> String s = "";
> for(int i=0;i<10;i++)
> s+="*";
> }
> }
>
>
>- slow elapsed 11741 ms
>- fast elapsed 7 ms
>
> Also, this PR avoids unnecessary call in StringBuilder
> Ref: https://github.com/apache/tomee/pull/219
>


-- 
Daniel "soro" Cunha
https://twitter.com/dvlc_


Re: Please review PR #201

2018-11-26 Thread Romain Manni-Bucau
Le lun. 26 nov. 2018 à 14:48, Bruno Baptista  a écrit :

> Hi Romain,
>
> We are holding other work with this discussion.
>
> Can we agree that this is good enough for a 1st version and move on with
> a follow up PR?... It's not going to be worse than starting SE tasks
> inside the container, like we have now.
>

As I said, while it is not released without being harnessed I'm happy
without any way working for you.


>
> Also, releasing Safegard 1.0.1 would be nice. There is unreleased code
> in there that this work needs. We can live with the SNAPSHOT in the
> meantime because there is no prediction of work for that SNAPSHOT.
>

I don't think there is anything needed, you can replace all that by a
standard cdi extension if the snapshot is bothering you can use the last
release.
Just veto the default and override the impl, no?


>
> Cheers.
>
> Bruno Baptista
> https://twitter.com/brunobat_
>
>
> On 23/11/18 15:41, Romain Manni-Bucau wrote:
> > Le ven. 23 nov. 2018 à 16:34, Bruno Baptista  a
> écrit :
> >
> >> Hi Romain,
> >>
> >> About "The point is not the cdi bean but the executor. So high level you
> >> deploy an
> >> app not using safeguard but it being present and you ensure the
> container
> >> has no executor resource instantiated (you will get one (the facade))."
> >>
> >> Sorry Romain, I still don't understand how the code in the PR can
> >> possible affect something not using the FT API or Safeguard in
> particular.
> >>
> > I think the code is ok but it uses assumptions which are likely not
> obvious
> > and it is not tested so next commit will break it - since this code must
> be
> > reworked anyway - and you will not see it.
> > So better to ensure the build guarantee all the outcome we want for end
> > users.
> >
> >
> >> In relation to the Managed executor... What you say makes sense but I
> >> wonder how likely it is to happen and if it's enough to hold the PR. Do
> >> you have a custom executor example somewhere?
> >>
> > We have some in the core tests you can reuse. But long story short you
> run
> > your test, don't use safeguard and guarantee in @Test by looking up the
> > resource directly using internals (SystemInstance > ContainerSystem and
> so
> > on) that the instance is not yet instantiated. See for a test doing
> exactly
> > that:
> >
> https://github.com/apache/tomee/blob/master/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/LazyResourceTest.java#L41
> >
> > To summarize:
> >
> > 1. CDI is lazy
> > 2. we define the default executor as being lazy
> > 3. we assume safeguard will not impact an app not using it
> >
> > ==> you must ensure that 3 didnt trigger an executor creation, it is fine
> > to rely on 1+2 (which means so "main" code)
> >
> >
> >> Cheers
> >>
> >> Bruno Baptista
> >> https://twitter.com/brunobat_
> >>
> >>
> >> On 23/11/18 15:14, Romain Manni-Bucau wrote:
> >>> Le ven. 23 nov. 2018 à 15:49, Bruno Baptista  a
> >> écrit :
>  Hi Romain,
> 
>  Thanks for your comment.
> 
>  The class doing the resource injection is lazy loaded, specifically
>  /FailsafeContainerExecutionManagerProvider/. I did verify it in
>  development but no test was produced... And to say the truth I
> wouldn't
>  know how to validate if a bean has already been loaded or not. Can you
>  please provide a test example?
> 
> >>> The point is not the cdi bean but the executor. So high level you
> deploy
> >> an
> >>> app not using safeguard but it being present and you ensure the
> container
> >>> has no executor resource instantiated (you will get one (the facade)).
> >>>
> >>>
>  Please explain what do you mean by "MP-fault-tolerance executor for
> that
>  case if noone exists". It will exist, that's the whole purpose of this
>  PR. Can you please provide an example where a
>  /ManagedScheduledExecutorService/ will not be present?
> 
> >>> You can see it as "don't let it default to a random executor". This is
> >> the
> >>> current behavior. So here is what can happen:
> >>>
> >>> 1. The user doesnt use any executor -> it defaults -> it is ok
> >>> 2. The user uses one or more executors for his app -> it defaults to it
> >> ->
> >>> it messes up the app and does not have the expected setting
> >>>
> >>> Case 2 is important cause it can really make it not functional and even
> >>> lead to locks in some cases so better to not let it happen and just
> >> create
> >>> a safeguard executor if
> >>> the user didnt specify he wants safeguard to use the executor
> >>> "'mysafeguardexecutor".
> >>>
> >>> This is why the config is important and I mentionned it early even if
> it
> >> is
> >>> not the most sexy part to do, I agree.
> >>>
> >>>
>  Cheers
> 
>  Bruno Baptista
>  https://twitter.com/brunobat_
> 
> 
>  On 23/11/18 14:39, Romain Manni-Bucau wrote:
> >> It's lazily loaded, so no worries on that regard.
> > What is "it" here? :)
> >
> > Conretely the bean 

Re: How Can I Help?

2018-11-26 Thread Michael Redlich
Hi Ivan:

OK, great, thanks!

Mike.


On Mon, Nov 26, 2018 at 6:31 AM Ivan Junckes Filho 
wrote:

> Hello Michael,
>
> I suggest that you always ask questions to the list and not to me
> privately. I may be busy like I was this weekend, and barely had time to
> open my computer. A lot of people on the list are willing to help you with
> these questions :)
>
> You can do a master update periodically if you want, just to avoid
> conflicts. I would say at least every time you start a new branch.
>
> This will avoid conflicts.
>
>
> On Sat, Nov 24, 2018 at 11:57 AM Michael Redlich 
> wrote:
>
>> Hi Ivan:
>>
>> I cloned the *tomee* repository and started getting myself organized to
>> add the Histogram example.  I'm curious if I should periodically initiate a:
>>
>> *git pull origin master*
>>
>> to get the latest changes.  Please advise...thanks!
>>
>> Sincerely,
>>
>> On Fri, Nov 23, 2018 at 11:11 AM Ivan Junckes Filho <
>> ivanjunc...@gmail.com> wrote:
>>
>>> Hi Michael, great to have you here!
>>>
>>> I would suggest that you start doing some MicroProfile examples.
>>>
>>> What about taking this task?
>>> https://issues.apache.org/jira/browse/TOMEE-2287
>>>
>>> We have very similar examples that will help you with that, it is
>>> documented in the ticket.
>>>
>>> Let us know if you have questions!
>>>
>>> On Fri, Nov 23, 2018 at 1:45 PM Michael Redlich 
>>> wrote:
>>>
 Hello:

 My name is Michael Redlich and I was just confirmed to the TomEE
 Developers
 mailing list.

 Here's some background information about myself:

- I live in Flemington , New
 Jersey
with my lovely wife, Rowena.  We love to visit New Orleans, LA and
 Newport,
RI on a regular basis.  We are avid cyclists and I am an avid runner.
- I have worked for ExxonMobil for almost 29 years.
- I have been writing for InfoQ
 since May 2016.
- I founded the ACGNJ Java Users Group  in
 2001
and co-facilitate the group with Barry Burd
.

 I am very interested in MicroProfile APIs.  I look forward to
 contributing
 to TomEE!

 Sincerely,

 Mike.




 --
 *Code*, *Write*, *Cycle*, *Run*, *Drink*,
 *Sleep ... Repeat*

 *InfoQ  Java Queue Editor*
 https://about.me/mpredli 
 https://twitter.com/mpredli
 https://redlich.net/
 https://javasig.org/
 *Laissez Les Bon Temps Rouler*

>>>
>>
>> --
>> *Code*, *Write*, *Cycle*, *Run*, *Drink*,
>> *Sleep ... Repeat*
>>
>> *InfoQ  Java Queue Editor*
>> https://about.me/mpredli 
>> https://twitter.com/mpredli
>> https://redlich.net/
>> https://javasig.org/
>> *Laissez Les Bon Temps Rouler*
>>
> --
*Code*, *Write*, *Cycle*, *Run*, *Drink*,
*Sleep ... Repeat*

*InfoQ  Java Queue Editor*
https://about.me/mpredli 
https://twitter.com/mpredli
https://redlich.net/
https://javasig.org/
*Laissez Les Bon Temps Rouler*


Re: Metrics Gauge Example and Bug

2018-11-26 Thread Bruno Baptista

Sure,

Will have a look after lunch.

Cheers.

Bruno Baptista
https://twitter.com/brunobat_


On 26/11/18 13:29, Ivan Junckes Filho wrote:

Bruno, can you review again please?

On Mon, Nov 26, 2018 at 10:46 AM Ivan Junckes Filho 
wrote:


Awesome, thanks Bruno

On Mon, Nov 26, 2018 at 10:23 AM Bruno Baptista 
wrote:


Hi Ivan,

I've requested some changes.

Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 26/11/18 11:29, Bruno Baptista wrote:

Hi,

I can review it.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 18:27, Ivan Junckes Filho wrote:

Hey guys can anyone review and merge this?

https://github.com/apache/tomee/pull/218


On Fri, Nov 23, 2018 at 2:22 PM Roberto Cortez

wrote:


And it did cover. The test was failing.


On 23 Nov 2018, at 16:00, Romain Manni-Bucau 

wrote:

https://github.com/apache/tomee/blob/4c7fd4af95983a92bef89dc598873310dd13dd2e/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/johnzon/JsonbJaxrsProviderTest.java

was supposed to cover that

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github <

https://github.com/rmannibucau> |

LinkedIn  | Book
<

https://www.packtpub.com/application-development/java-ee-8-high-performance


Le ven. 23 nov. 2018 à 16:58, Bruno Baptista  a

écrit :

We should probably add a test for that regression.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:50, Ivan Junckes Filho wrote:

It worked, thanks man!

On Fri, Nov 23, 2018 at 12:40 PM Roberto Cortez


wrote:

Yes, that was the issue. This should fix it:



https://github.com/apache/tomee/commit/1bfb65a1837235f4e9ad4458f67aabcab5eff829

Try to pull the code and test it again.

Cheers,
Roberto

On 23 Nov 2018, at 14:14, Roberto Cortez 
wrote:

No point. I’ve found the issue:

It’s here:



https://github.com/tomitribe/tomee/commit/7f18f4bcfe64119b9001d5ac6bffeb7324987a37

This commit reverted back the new JsonbProvider to the old

JohnzonProvider.

The fix should be just to replace one with another. Let me try
it and

test.

Cheers,
Roberto

On 23 Nov 2018, at 12:06, Ivan Junckes Filho

wrote:

I was using the current master.

1.1.9

I will try to use the version Romain proposed and see how it

works.


On Thu, Nov 22, 2018 at 7:36 PM Roberto Cortez <
radcor...@yahoo.com.invalid> wrote:


Hey,

I think metrics doesn’t even run properly on TomEE 7.x because
of CDI

2.0.

Regarding the fail, I’m not sure what is wrong. I remember seeing

that

before and I think it got fixed when we added the JsonB JAX-RS

Provider.

Maybe there is a regression in some place.

Cheers,
Roberto


On 22 Nov 2018, at 21:08, Romain Manni-Bucau

wrote:

Hi Ivan

Do you use tomee 8 with johnzon 1.1.10? Works well on this one

normally

if johnzon defaults are not broken. On tomee 7 you need to add
jsonb

;)

Le jeu. 22 nov. 2018 21:51, Ivan Junckes Filho <

ivanjunc...@gmail.com

> a écrit :

Also there are a lot of properties being returned on that

payload

that

are not needed like rate1, rate5... etc.

On Thu, Nov 22, 2018 at 6:26 PM Ivan Junckes Filho <

ivanjunc...@gmail.com > wrote:

The issue with the TCK is because meter in the spec expects

fifteenMinRate instead of fifteenMinuteRate.

Same apply for the other properties like fiveMin..oneMin..

@JsonbProperty("fifteenMinRate") is probably being ignored.




On Thu, Nov 22, 2018 at 5:46 PM Ivan Junckes Filho <

ivanjunc...@gmail.com > wrote:

Hey Romain, it is actually a mapping issue. I created the PR
but the

microprofile metrics TCK seems to be broken on TomEE, so I am not

sure

if

the PR is reliable.

https://github.com/apache/geronimo-metrics/pull/2 <

https://github.com/apache/geronimo-metrics/pull/2>

I will try to check what is going on with the TCK on TomEE, if
you

have

any tips let me know.



On Wed, Nov 21, 2018 at 7:59 PM Romain Manni-Bucau <

rmannibu...@gmail.com > wrote:

Hi Ivan

It is a bug in tomee scanning I think


Le mer. 21 nov. 2018 21:35, Ivan Junckes Filho <

ivanjunc...@gmail.com

> a

écrit :


Hey guys, I was writing an example of metrics gauge (WIP).

https://github.com/apache/tomee/pull/213 <

https://github.com/apache/tomee/pull/213>

And I found a bug when trying access a gauge with "Accept:
application/json".

Just to let you know that I will work on a fix for this:

21-Nov-2018 17:24:08.811 WARNING [http-nio-8080-exec-4]


org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.compare

Both


org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints#getJson


and


org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints#getJson

are equal candidates for handling the current request which can

lead

to

unpredictable results
21-Nov-2018 

Re: Please review PR #201

2018-11-26 Thread Bruno Baptista

Hi Romain,

We are holding other work with this discussion.

Can we agree that this is good enough for a 1st version and move on with 
a follow up PR?... It's not going to be worse than starting SE tasks 
inside the container, like we have now.


Also, releasing Safegard 1.0.1 would be nice. There is unreleased code 
in there that this work needs. We can live with the SNAPSHOT in the 
meantime because there is no prediction of work for that SNAPSHOT.


Cheers.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:41, Romain Manni-Bucau wrote:

Le ven. 23 nov. 2018 à 16:34, Bruno Baptista  a écrit :


Hi Romain,

About "The point is not the cdi bean but the executor. So high level you
deploy an
app not using safeguard but it being present and you ensure the container
has no executor resource instantiated (you will get one (the facade))."

Sorry Romain, I still don't understand how the code in the PR can
possible affect something not using the FT API or Safeguard in particular.


I think the code is ok but it uses assumptions which are likely not obvious
and it is not tested so next commit will break it - since this code must be
reworked anyway - and you will not see it.
So better to ensure the build guarantee all the outcome we want for end
users.



In relation to the Managed executor... What you say makes sense but I
wonder how likely it is to happen and if it's enough to hold the PR. Do
you have a custom executor example somewhere?


We have some in the core tests you can reuse. But long story short you run
your test, don't use safeguard and guarantee in @Test by looking up the
resource directly using internals (SystemInstance > ContainerSystem and so
on) that the instance is not yet instantiated. See for a test doing exactly
that:
https://github.com/apache/tomee/blob/master/container/openejb-core/src/test/java/org/apache/openejb/assembler/classic/LazyResourceTest.java#L41

To summarize:

1. CDI is lazy
2. we define the default executor as being lazy
3. we assume safeguard will not impact an app not using it

==> you must ensure that 3 didnt trigger an executor creation, it is fine
to rely on 1+2 (which means so "main" code)



Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:14, Romain Manni-Bucau wrote:

Le ven. 23 nov. 2018 à 15:49, Bruno Baptista  a

écrit :

Hi Romain,

Thanks for your comment.

The class doing the resource injection is lazy loaded, specifically
/FailsafeContainerExecutionManagerProvider/. I did verify it in
development but no test was produced... And to say the truth I wouldn't
know how to validate if a bean has already been loaded or not. Can you
please provide a test example?


The point is not the cdi bean but the executor. So high level you deploy

an

app not using safeguard but it being present and you ensure the container
has no executor resource instantiated (you will get one (the facade)).



Please explain what do you mean by "MP-fault-tolerance executor for that
case if noone exists". It will exist, that's the whole purpose of this
PR. Can you please provide an example where a
/ManagedScheduledExecutorService/ will not be present?


You can see it as "don't let it default to a random executor". This is

the

current behavior. So here is what can happen:

1. The user doesnt use any executor -> it defaults -> it is ok
2. The user uses one or more executors for his app -> it defaults to it

->

it messes up the app and does not have the expected setting

Case 2 is important cause it can really make it not functional and even
lead to locks in some cases so better to not let it happen and just

create

a safeguard executor if
the user didnt specify he wants safeguard to use the executor
"'mysafeguardexecutor".

This is why the config is important and I mentionned it early even if it

is

not the most sexy part to do, I agree.



Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 14:39, Romain Manni-Bucau wrote:

It's lazily loaded, so no worries on that regard.

What is "it" here? :)

Conretely the bean instantiation yes cause it is normal scoped and the
resource too cause it is by default lazy in tomee (service-jar.xml) but

it

is worth a test that prevent regression on that behavior IMHO, I didn't
catch on in the PR.

Concretely in terms of container we can want to create a dedicated
MP-fault-tolerance executor for that case if noone exists and the user
didn't specify one cause this default behavior (cumulated with tomee
defaulting on @Resouce) will make this not reliable which is quite
ridiculous when you think about it for something about failt tolerance.
This is why it should be in before next release. Now if you do the PR

next

week it is fine, was not to do it today but to ensure it is not merged

and

the enthusiasm makes it forgotten.

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github <


Avoid String in a loop

2018-11-26 Thread Otávio Gonçalves de Santana
The reason to prefer StringBuilder is that both + and concat create a new
object every time you call them (provided the right-hand side argument is
not empty). This can quickly add up to a lot of objects, almost all of
which are completely unnecessary.

public class Main{
public static void main(String[] args)
{
long now = System.currentTimeMillis();
slow();
System.out.println("slow elapsed " +
(System.currentTimeMillis() - now) + " ms");

now = System.currentTimeMillis();
fast();
System.out.println("fast elapsed " +
(System.currentTimeMillis() - now) + " ms");
}

private static void fast()
{
StringBuilder s = new StringBuilder();
for(int i=0;i<10;i++)
s.append("*");
}

private static void slow()
{
String s = "";
for(int i=0;i<10;i++)
s+="*";
}
}


   - slow elapsed 11741 ms
   - fast elapsed 7 ms

Also, this PR avoids unnecessary call in StringBuilder
Ref: https://github.com/apache/tomee/pull/219


[GitHub] tomee pull request #219: Avoid String in a loop

2018-11-26 Thread otaviojava
GitHub user otaviojava opened a pull request:

https://github.com/apache/tomee/pull/219

Avoid String in a loop

The reason to prefer StringBuilder is that both + and concat create a new 
object every time you call them (provided the right-hand side argument is not 
empty). This can quickly add up to a lot of objects, almost all of which are 
completely unnecessary.

```java
public class Main
{
public static void main(String[] args)
{
long now = System.currentTimeMillis();
slow();
System.out.println("slow elapsed " + (System.currentTimeMillis() - 
now) + " ms");

now = System.currentTimeMillis();
fast();
System.out.println("fast elapsed " + (System.currentTimeMillis() - 
now) + " ms");
}

private static void fast()
{
StringBuilder s = new StringBuilder();
for(int i=0;i<10;i++)
s.append("*");  
}

private static void slow()
{
String s = "";
for(int i=0;i<10;i++)
s+="*";
}
}
```

* slow elapsed 11741 ms
* fast elapsed 7 ms

Also, this PR avoids unnecessary call in StringBuilder

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/otaviojava/tomee 
use_string_builder_instad_string_loop

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/tomee/pull/219.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #219


commit 442a81b3e78b7700f0420573927872bedbec30a4
Author: Otavio Santana 
Date:   2018-11-22T15:23:49Z

removes String concatenation loop in Assembler

commit afec54d2204e6e5b8814cddc7eef427a35b54dd5
Author: Otavio Santana 
Date:   2018-11-22T15:24:04Z

removes String concatenation loop in AnnotationDeployer

commit 20b08f5093e2c562886d6221e5f2a6322bd158e1
Author: Otavio Santana 
Date:   2018-11-22T15:24:17Z

removes String concatenation loop in SunConvertion

commit e859469a996d4581a971869f685dea5bf9b06b8d
Author: Otavio Santana 
Date:   2018-11-22T15:24:41Z

removes String concatenation loop in LoggingPreparedSqlStatement

commit 806df6dc4095d0d444357b242560d182544fa69f
Author: Otavio Santana 
Date:   2018-11-22T18:26:57Z

removes redudant toString




---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread rmannibucau
Github user rmannibucau commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236249672
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
+.path("/weather/day/status")
+.get(String.class);
+
+final String metricPath = 
"/metrics/application/weather_day_status";
+assertPrometheusFormat(metricPath);
+assertJsonFormat(metricPath);
+}
+
+private void assertPrometheusFormat(final String metricPath) {
+final String metric = WebClient.create(base.toExternalForm())
+.path(metricPath)
+.accept(MediaType.TEXT_PLAIN)
+.get(String.class);
+
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds summary timer"));
--- End diff --

as a general rule put a small description and the actual value in "message" 
parameter of the assert

proposal:

 Stream.of("expected text 1", "expected text 2")
.forEach(text -> assertTrue("Expected: " + text + " to be present 
in " + metric, metric.contains(text)));

Also for an example you don't need to assert that much so just checking 
"application:weather_day_status_seconds_count 1.0" can be sufficient for the 
demonstration IMHO


---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread rmannibucau
Github user rmannibucau commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236248226
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
--- End diff --

maybe use Client (jaxrs) instead of a cxf api - without forgetting to close 
the client ;)


---


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread rmannibucau
Github user rmannibucau commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236248396
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
+.path("/weather/day/status")
+.get(String.class);
+
+final String metricPath = 
"/metrics/application/weather_day_status";
+assertPrometheusFormat(metricPath);
+assertJsonFormat(metricPath);
+}
+
+private void assertPrometheusFormat(final String metricPath) {
+final String metric = WebClient.create(base.toExternalForm())
+.path(metricPath)
+.accept(MediaType.TEXT_PLAIN)
+.get(String.class);
+
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds summary timer"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds_count timer"));
+
assertTrue(metric.contains("application:weather_day_status_seconds_count 1.0"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_one_min_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_one_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_five_min_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_five_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_fifteen_min_rate_per_second time"));
+
assertTrue(metric.contains("application:weather_day_status_fifteen_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_min_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_min_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_max_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_max_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_mean_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_mean_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_stddev_seconds timer"));
+

[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread rmannibucau
Github user rmannibucau commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236248868
  
--- Diff: examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java 
---
@@ -0,0 +1,151 @@
+/**
+ * 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.
+ */
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.StringReader;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class WeatherServiceTest {
+
+@Deployment(testable = false)
+public static WebArchive createDeployment() {
+final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
"test.war")
+.addClass(WeatherService.class)
+.addAsWebInfResource(new StringAsset(""), 
"beans.xml");
+return webArchive;
+}
+
+@ArquillianResource
+private URL base;
+
+@Test
+public void testTimedMetric() {
+WebClient.create(base.toExternalForm())
+.path("/weather/day/status")
+.get(String.class);
+
+final String metricPath = 
"/metrics/application/weather_day_status";
+assertPrometheusFormat(metricPath);
+assertJsonFormat(metricPath);
+}
+
+private void assertPrometheusFormat(final String metricPath) {
+final String metric = WebClient.create(base.toExternalForm())
+.path(metricPath)
+.accept(MediaType.TEXT_PLAIN)
+.get(String.class);
+
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds summary timer"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_seconds_count timer"));
+
assertTrue(metric.contains("application:weather_day_status_seconds_count 1.0"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_one_min_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_one_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_five_min_rate_per_second timer"));
+
assertTrue(metric.contains("application:weather_day_status_five_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_fifteen_min_rate_per_second time"));
+
assertTrue(metric.contains("application:weather_day_status_fifteen_min_rate_per_second"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_min_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_min_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_max_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_max_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_mean_seconds timer"));
+
assertTrue(metric.contains("application:weather_day_status_mean_seconds"));
+assertTrue(metric.contains("# TYPE 
application:weather_day_status_stddev_seconds timer"));
+

Re: Metrics Gauge Example and Bug

2018-11-26 Thread Ivan Junckes Filho
Bruno, can you review again please?

On Mon, Nov 26, 2018 at 10:46 AM Ivan Junckes Filho 
wrote:

> Awesome, thanks Bruno
>
> On Mon, Nov 26, 2018 at 10:23 AM Bruno Baptista 
> wrote:
>
>> Hi Ivan,
>>
>> I've requested some changes.
>>
>> Cheers
>>
>> Bruno Baptista
>> https://twitter.com/brunobat_
>>
>>
>> On 26/11/18 11:29, Bruno Baptista wrote:
>> > Hi,
>> >
>> > I can review it.
>> >
>> > Bruno Baptista
>> > https://twitter.com/brunobat_
>> >
>> >
>> > On 23/11/18 18:27, Ivan Junckes Filho wrote:
>> >> Hey guys can anyone review and merge this?
>> >>
>> >> https://github.com/apache/tomee/pull/218
>> >>
>> >>
>> >> On Fri, Nov 23, 2018 at 2:22 PM Roberto Cortez
>> >> 
>> >> wrote:
>> >>
>> >>> And it did cover. The test was failing.
>> >>>
>>  On 23 Nov 2018, at 16:00, Romain Manni-Bucau 
>> >>> wrote:
>> 
>> >>>
>> https://github.com/apache/tomee/blob/4c7fd4af95983a92bef89dc598873310dd13dd2e/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/johnzon/JsonbJaxrsProviderTest.java
>> >>>
>>  was supposed to cover that
>> 
>>  Romain Manni-Bucau
>>  @rmannibucau  |  Blog
>>   | Old Blog
>>   | Github <
>> >>> https://github.com/rmannibucau> |
>>  LinkedIn  | Book
>>  <
>> >>>
>> https://www.packtpub.com/application-development/java-ee-8-high-performance
>> >>>
>> 
>> 
>>  Le ven. 23 nov. 2018 à 16:58, Bruno Baptista  a
>> >>> écrit :
>> > We should probably add a test for that regression.
>> >
>> > Bruno Baptista
>> > https://twitter.com/brunobat_
>> >
>> >
>> > On 23/11/18 15:50, Ivan Junckes Filho wrote:
>> >> It worked, thanks man!
>> >>
>> >> On Fri, Nov 23, 2018 at 12:40 PM Roberto Cortez
>> >> 
>> > wrote:
>> >>> Yes, that was the issue. This should fix it:
>> >>>
>> >>>
>> >>>
>> https://github.com/apache/tomee/commit/1bfb65a1837235f4e9ad4458f67aabcab5eff829
>> >>>
>> >>> Try to pull the code and test it again.
>> >>>
>> >>> Cheers,
>> >>> Roberto
>> >>>
>> >>> On 23 Nov 2018, at 14:14, Roberto Cortez 
>> >>> wrote:
>> >>>
>> >>> No point. I’ve found the issue:
>> >>>
>> >>> It’s here:
>> >>>
>> >>>
>> >>>
>> https://github.com/tomitribe/tomee/commit/7f18f4bcfe64119b9001d5ac6bffeb7324987a37
>> >>>
>> >>> This commit reverted back the new JsonbProvider to the old
>> > JohnzonProvider.
>> >>> The fix should be just to replace one with another. Let me try
>> >>> it and
>> > test.
>> >>> Cheers,
>> >>> Roberto
>> >>>
>> >>> On 23 Nov 2018, at 12:06, Ivan Junckes Filho
>> >>> 
>> >>> wrote:
>> >>>
>> >>> I was using the current master.
>> >>>
>> >>> 1.1.9
>> >>>
>> >>> I will try to use the version Romain proposed and see how it
>> works.
>> >>>
>> >>>
>> >>> On Thu, Nov 22, 2018 at 7:36 PM Roberto Cortez <
>> >>> radcor...@yahoo.com.invalid> wrote:
>> >>>
>>  Hey,
>> 
>>  I think metrics doesn’t even run properly on TomEE 7.x because
>>  of CDI
>> > 2.0.
>>  Regarding the fail, I’m not sure what is wrong. I remember seeing
>> >>> that
>>  before and I think it got fixed when we added the JsonB JAX-RS
>> > Provider.
>>  Maybe there is a regression in some place.
>> 
>>  Cheers,
>>  Roberto
>> 
>> > On 22 Nov 2018, at 21:08, Romain Manni-Bucau
>> > >  wrote:
>> > Hi Ivan
>> >
>> > Do you use tomee 8 with johnzon 1.1.10? Works well on this one
>> > normally
>>  if johnzon defaults are not broken. On tomee 7 you need to add
>>  jsonb
>> >>> ;)
>> > Le jeu. 22 nov. 2018 21:51, Ivan Junckes Filho <
>> >>> ivanjunc...@gmail.com
>>  > a écrit :
>> > Also there are a lot of properties being returned on that
>> payload
>> >>> that
>>  are not needed like rate1, rate5... etc.
>> >
>> > On Thu, Nov 22, 2018 at 6:26 PM Ivan Junckes Filho <
>>  ivanjunc...@gmail.com > wrote:
>> > The issue with the TCK is because meter in the spec expects
>>  fifteenMinRate instead of fifteenMinuteRate.
>> > Same apply for the other properties like fiveMin..oneMin..
>> >
>> > @JsonbProperty("fifteenMinRate") is probably being ignored.
>> >
>> >
>> >
>> >
>> > On Thu, Nov 22, 2018 at 5:46 PM Ivan Junckes Filho <
>>  ivanjunc...@gmail.com > wrote:
>> > Hey Romain, it is actually a mapping issue. I created the PR
>> > but the
>>  microprofile metrics TCK seems to be broken on TomEE, so I am not
>> >>> sure
>> > if

Re: Metrics Gauge Example and Bug

2018-11-26 Thread Ivan Junckes Filho
Awesome, thanks Bruno

On Mon, Nov 26, 2018 at 10:23 AM Bruno Baptista  wrote:

> Hi Ivan,
>
> I've requested some changes.
>
> Cheers
>
> Bruno Baptista
> https://twitter.com/brunobat_
>
>
> On 26/11/18 11:29, Bruno Baptista wrote:
> > Hi,
> >
> > I can review it.
> >
> > Bruno Baptista
> > https://twitter.com/brunobat_
> >
> >
> > On 23/11/18 18:27, Ivan Junckes Filho wrote:
> >> Hey guys can anyone review and merge this?
> >>
> >> https://github.com/apache/tomee/pull/218
> >>
> >>
> >> On Fri, Nov 23, 2018 at 2:22 PM Roberto Cortez
> >> 
> >> wrote:
> >>
> >>> And it did cover. The test was failing.
> >>>
>  On 23 Nov 2018, at 16:00, Romain Manni-Bucau 
> >>> wrote:
> 
> >>>
> https://github.com/apache/tomee/blob/4c7fd4af95983a92bef89dc598873310dd13dd2e/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/johnzon/JsonbJaxrsProviderTest.java
> >>>
>  was supposed to cover that
> 
>  Romain Manni-Bucau
>  @rmannibucau  |  Blog
>   | Old Blog
>   | Github <
> >>> https://github.com/rmannibucau> |
>  LinkedIn  | Book
>  <
> >>>
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >>>
> 
> 
>  Le ven. 23 nov. 2018 à 16:58, Bruno Baptista  a
> >>> écrit :
> > We should probably add a test for that regression.
> >
> > Bruno Baptista
> > https://twitter.com/brunobat_
> >
> >
> > On 23/11/18 15:50, Ivan Junckes Filho wrote:
> >> It worked, thanks man!
> >>
> >> On Fri, Nov 23, 2018 at 12:40 PM Roberto Cortez
> >> 
> > wrote:
> >>> Yes, that was the issue. This should fix it:
> >>>
> >>>
> >>>
> https://github.com/apache/tomee/commit/1bfb65a1837235f4e9ad4458f67aabcab5eff829
> >>>
> >>> Try to pull the code and test it again.
> >>>
> >>> Cheers,
> >>> Roberto
> >>>
> >>> On 23 Nov 2018, at 14:14, Roberto Cortez 
> >>> wrote:
> >>>
> >>> No point. I’ve found the issue:
> >>>
> >>> It’s here:
> >>>
> >>>
> >>>
> https://github.com/tomitribe/tomee/commit/7f18f4bcfe64119b9001d5ac6bffeb7324987a37
> >>>
> >>> This commit reverted back the new JsonbProvider to the old
> > JohnzonProvider.
> >>> The fix should be just to replace one with another. Let me try
> >>> it and
> > test.
> >>> Cheers,
> >>> Roberto
> >>>
> >>> On 23 Nov 2018, at 12:06, Ivan Junckes Filho
> >>> 
> >>> wrote:
> >>>
> >>> I was using the current master.
> >>>
> >>> 1.1.9
> >>>
> >>> I will try to use the version Romain proposed and see how it works.
> >>>
> >>>
> >>> On Thu, Nov 22, 2018 at 7:36 PM Roberto Cortez <
> >>> radcor...@yahoo.com.invalid> wrote:
> >>>
>  Hey,
> 
>  I think metrics doesn’t even run properly on TomEE 7.x because
>  of CDI
> > 2.0.
>  Regarding the fail, I’m not sure what is wrong. I remember seeing
> >>> that
>  before and I think it got fixed when we added the JsonB JAX-RS
> > Provider.
>  Maybe there is a regression in some place.
> 
>  Cheers,
>  Roberto
> 
> > On 22 Nov 2018, at 21:08, Romain Manni-Bucau
> >   wrote:
> > Hi Ivan
> >
> > Do you use tomee 8 with johnzon 1.1.10? Works well on this one
> > normally
>  if johnzon defaults are not broken. On tomee 7 you need to add
>  jsonb
> >>> ;)
> > Le jeu. 22 nov. 2018 21:51, Ivan Junckes Filho <
> >>> ivanjunc...@gmail.com
>  > a écrit :
> > Also there are a lot of properties being returned on that payload
> >>> that
>  are not needed like rate1, rate5... etc.
> >
> > On Thu, Nov 22, 2018 at 6:26 PM Ivan Junckes Filho <
>  ivanjunc...@gmail.com > wrote:
> > The issue with the TCK is because meter in the spec expects
>  fifteenMinRate instead of fifteenMinuteRate.
> > Same apply for the other properties like fiveMin..oneMin..
> >
> > @JsonbProperty("fifteenMinRate") is probably being ignored.
> >
> >
> >
> >
> > On Thu, Nov 22, 2018 at 5:46 PM Ivan Junckes Filho <
>  ivanjunc...@gmail.com > wrote:
> > Hey Romain, it is actually a mapping issue. I created the PR
> > but the
>  microprofile metrics TCK seems to be broken on TomEE, so I am not
> >>> sure
> > if
>  the PR is reliable.
> > https://github.com/apache/geronimo-metrics/pull/2 <
>  https://github.com/apache/geronimo-metrics/pull/2>
> > I will try to check what is going on with the TCK on TomEE, if
> > you
> > have
> 

Re: Metrics Gauge Example and Bug

2018-11-26 Thread Bruno Baptista

Hi Ivan,

I've requested some changes.

Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 26/11/18 11:29, Bruno Baptista wrote:

Hi,

I can review it.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 18:27, Ivan Junckes Filho wrote:

Hey guys can anyone review and merge this?

https://github.com/apache/tomee/pull/218


On Fri, Nov 23, 2018 at 2:22 PM Roberto Cortez 


wrote:


And it did cover. The test was failing.


On 23 Nov 2018, at 16:00, Romain Manni-Bucau 

wrote:


https://github.com/apache/tomee/blob/4c7fd4af95983a92bef89dc598873310dd13dd2e/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/johnzon/JsonbJaxrsProviderTest.java 


was supposed to cover that

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github <

https://github.com/rmannibucau> |

LinkedIn  | Book
<
https://www.packtpub.com/application-development/java-ee-8-high-performance 




Le ven. 23 nov. 2018 à 16:58, Bruno Baptista  a

écrit :

We should probably add a test for that regression.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:50, Ivan Junckes Filho wrote:

It worked, thanks man!

On Fri, Nov 23, 2018 at 12:40 PM Roberto Cortez 


wrote:

Yes, that was the issue. This should fix it:


https://github.com/apache/tomee/commit/1bfb65a1837235f4e9ad4458f67aabcab5eff829 


Try to pull the code and test it again.

Cheers,
Roberto

On 23 Nov 2018, at 14:14, Roberto Cortez  
wrote:


No point. I’ve found the issue:

It’s here:


https://github.com/tomitribe/tomee/commit/7f18f4bcfe64119b9001d5ac6bffeb7324987a37 


This commit reverted back the new JsonbProvider to the old

JohnzonProvider.
The fix should be just to replace one with another. Let me try 
it and

test.

Cheers,
Roberto

On 23 Nov 2018, at 12:06, Ivan Junckes Filho 


wrote:

I was using the current master.

1.1.9

I will try to use the version Romain proposed and see how it works.


On Thu, Nov 22, 2018 at 7:36 PM Roberto Cortez <
radcor...@yahoo.com.invalid> wrote:


Hey,

I think metrics doesn’t even run properly on TomEE 7.x because 
of CDI

2.0.

Regarding the fail, I’m not sure what is wrong. I remember seeing

that

before and I think it got fixed when we added the JsonB JAX-RS

Provider.

Maybe there is a regression in some place.

Cheers,
Roberto

On 22 Nov 2018, at 21:08, Romain Manni-Bucau 

wrote:

Hi Ivan

Do you use tomee 8 with johnzon 1.1.10? Works well on this one

normally
if johnzon defaults are not broken. On tomee 7 you need to add 
jsonb

;)

Le jeu. 22 nov. 2018 21:51, Ivan Junckes Filho <

ivanjunc...@gmail.com

> a écrit :

Also there are a lot of properties being returned on that payload

that

are not needed like rate1, rate5... etc.


On Thu, Nov 22, 2018 at 6:26 PM Ivan Junckes Filho <

ivanjunc...@gmail.com > wrote:

The issue with the TCK is because meter in the spec expects

fifteenMinRate instead of fifteenMinuteRate.

Same apply for the other properties like fiveMin..oneMin..

@JsonbProperty("fifteenMinRate") is probably being ignored.




On Thu, Nov 22, 2018 at 5:46 PM Ivan Junckes Filho <

ivanjunc...@gmail.com > wrote:
Hey Romain, it is actually a mapping issue. I created the PR 
but the

microprofile metrics TCK seems to be broken on TomEE, so I am not

sure

if

the PR is reliable.

https://github.com/apache/geronimo-metrics/pull/2 <

https://github.com/apache/geronimo-metrics/pull/2>
I will try to check what is going on with the TCK on TomEE, if 
you

have

any tips let me know.




On Wed, Nov 21, 2018 at 7:59 PM Romain Manni-Bucau <

rmannibu...@gmail.com > wrote:

Hi Ivan

It is a bug in tomee scanning I think


Le mer. 21 nov. 2018 21:35, Ivan Junckes Filho <

ivanjunc...@gmail.com

> a

écrit :


Hey guys, I was writing an example of metrics gauge (WIP).

https://github.com/apache/tomee/pull/213 <

https://github.com/apache/tomee/pull/213>

And I found a bug when trying access a gauge with "Accept:
application/json".

Just to let you know that I will work on a fix for this:

21-Nov-2018 17:24:08.811 WARNING [http-nio-8080-exec-4]
org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.compare 


Both

org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints#getJson 


and

org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints#getJson 


are equal candidates for handling the current request which can

lead

to

unpredictable results
21-Nov-2018 17:26:52.183 SEVERE [http-nio-8080-exec-4]
org.apache.cxf.jaxrs.utils.JAXRSUtils.logMessageHandlerProblem

Problem with

writing the data, class java.util.Collections$SingletonMap,

ContentType:

application/json
21-Nov-2018 17:26:52.184 WARNING [http-nio-8080-exec-4]

Re: Building TomEE, openejb-core, crashed test: org.apache.openejb.assembler.DeployerEjbTest

2018-11-26 Thread Bruno Baptista

Hi All,

I've also experienced this error a few times. Never tried to change the 
surefire version, though.


Bruno Baptista

https://twitter.com/brunobat_


On 26/11/18 07:25, Ferdi wrote:

Hi,

I've got the latest master from github and was trying to run `mvn 
clean install`, but I've got this error:


[ERROR] Crashed tests:
[ERROR] org.apache.openejb.assembler.DeployerEjbTest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: 
ExecutionException The forked VM terminated without properly saying 
goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program 
Files\Java\jdk1.8.0_161\jre\bin\java" 
-javaagent:C:\Users\Ferdi_S672\Documents\Personal\Projects\tomee\container\openejb-core/target/openejb-javaagent-8.0.0-SNAPSHOT.jar 
-Dopenejb.classloader.forced-skip=org.apache.openejb.jee.,org.apache.openejb.api. 
-Dopenejb.classloader.forced-load=org.apache.openejb -enableassertions 
-Dopenejb.descriptors.output.folder=./dump/ 
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=org,java -jar 
C:\Users\FERDI_~1\AppData\Local\Temp\surefire925326680556375235\surefirebooter1103379934330427088.jar 
C:\Users\Ferdi_S672\AppData\Local\Temp\surefire925326680556375235 
2018-11-26T14-39-15_252-jvmRun1 surefire1842635169862471047tmp 
surefire_521382701203330047466tmp"

[ERROR] Process Exit Code: 0
[ERROR] Crashed tests:
[ERROR] org.apache.openejb.assembler.DeployerEjbTest

The rest is in this gist: 



Has anyone found / seen this before? I've tried:

1. -Xmx1024m -XX:MaxPermSize=256m
2. -Xmx2048m -XX:MaxPermSize=512m
3. Change Surefire to 2.22

My computer has 16 GB RAM, and plenty of space available during the run.


[GitHub] tomee pull request #218: TOMEE-2290 - Metrics timer example

2018-11-26 Thread brunobat
Github user brunobat commented on a diff in the pull request:

https://github.com/apache/tomee/pull/218#discussion_r236229984
  
--- Diff: pom.xml ---
@@ -208,7 +208,7 @@
 1.0
 
1.0.0
 1.1
-
1.0.0
+
1.0.1-SNAPSHOT
--- End diff --

Hi @ivanjunckes I get an error here:
`[ERROR] Failed to execute goal on project tomee-microprofile-webapp: Could 
not resolve dependencies for project 
org.apache.tomee:tomee-microprofile-webapp:war:8.0.0-SNAPSHOT: Failure to find 
org.apache.geronimo:geronimo-metrics:jar:1.0.1-SNAPSHOT in 
https://repository.apache.org/service/local/repositories/orgapachegeronimo-1067/content/
 was cached in the local repository, resolution will not be reattempted until 
the update interval of Geronimo OpenAPI Staging has elapsed or updates are 
forced`
The lib is not found in the maven repo.


---


Re: Building TomEE, openejb-core, crashed test: org.apache.openejb.assembler.DeployerEjbTest

2018-11-26 Thread Jonathan Gallimore
Going to fire this off on a Linux and a Windows machine here to see a) if I
see the same thing, and b) see if I can give some pointers. I don't have
ideas right off the top of my head at the moment. Romain's suggestion is
definitely worth a try.

For reference, we have a CI build here:
https://ci.apache.org/builders/tomee-trunk-ubuntu-jvm8 - it doesn't look
like we have the same issue there (we have different ones!)

Thanks for trying this - and thanks for trying it on a Windows machine too,
its good to know whether it is or isn't working there.

Jon

On Mon, Nov 26, 2018 at 7:55 AM Romain Manni-Bucau 
wrote:

> Hi Ferdi,
>
> surefire got some "hiccup" in last versions, maybe try 3.0.0-M1 or or
> 2.22.1 which should work, if not the output dump can help sometimes to
> identify if it is a memory issue or (more likely) another one.
>
> Romain Manni-Bucau
> @rmannibucau  |  Blog
>  | Old Blog
>  | Github <
> https://github.com/rmannibucau> |
> LinkedIn  | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le lun. 26 nov. 2018 à 08:25, Ferdi  a écrit :
>
> > Hi,
> >
> > I've got the latest master from github and was trying to run `mvn clean
> > install`, but I've got this error:
> >
> > [ERROR] Crashed tests:
> > [ERROR] org.apache.openejb.assembler.DeployerEjbTest
> > [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException:
> > ExecutionException The forked VM terminated without properly saying
> > goodbye. VM crash or System.exit called?
> > [ERROR] Command was cmd.exe /X /C ""C:\Program
> > Files\Java\jdk1.8.0_161\jre\bin\java"
> >
> -javaagent:C:\Users\Ferdi_S672\Documents\Personal\Projects\tomee\container\openejb-core/target/openejb-javaagent-8.0.0-SNAPSHOT.jar
> >
> >
> -Dopenejb.classloader.forced-skip=org.apache.openejb.jee.,org.apache.openejb.api.
> >
> > -Dopenejb.classloader.forced-load=org.apache.openejb -enableassertions
> > -Dopenejb.descriptors.output.folder=./dump/
> > -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=org,java -jar
> >
> C:\Users\FERDI_~1\AppData\Local\Temp\surefire925326680556375235\surefirebooter1103379934330427088.jar
> >
> > C:\Users\Ferdi_S672\AppData\Local\Temp\surefire925326680556375235
> > 2018-11-26T14-39-15_252-jvmRun1 surefire1842635169862471047tmp
> > surefire_521382701203330047466tmp"
> > [ERROR] Process Exit Code: 0
> > [ERROR] Crashed tests:
> > [ERROR] org.apache.openejb.assembler.DeployerEjbTest
> >
> > The rest is in this gist:
> > 
> >
> > Has anyone found / seen this before? I've tried:
> >
> > 1. -Xmx1024m -XX:MaxPermSize=256m
> > 2. -Xmx2048m -XX:MaxPermSize=512m
> > 3. Change Surefire to 2.22
> >
> > My computer has 16 GB RAM, and plenty of space available during the run.
> >
>


Re: Feedback as newbie

2018-11-26 Thread Jonathan Gallimore
Thanks for the feedback! The most correct out of the pages listed is this
one: http://tomee.apache.org/community/sources.html.

These pages are out of date: http://tomee.apache.org/dev/source-code.html,
and http://tomee.apache.org/dev/git.html. I can't recall if we tried using
the "develop" branch or not, but if we did, it was fairly short lived.

Our current development effort is in "master", this is TomEE 8.0.0. We also
the following branches which are maintained:

* 7.1.x (TomEE 7.1.x, targets EE7, Java SE 8)
* 7.0.x (TomEE 7.0.x, targets EE7, Java SE 7)
* 1.7.x (TomEE 1.7.x, targets EE6, Java SE 6)

The big jump in version number if because the community decided to align
the version number with the EE version number when we went to TomEE 7.

Documentation patches are most welcome to help with this. I notice David
Blevins has started a thread here:
http://tomee-openejb.979440.n4.nabble.com/Merging-Old-and-New-Websites-td4685488.html
- that initiative to try and structure the website better will likely
really help. It'll be a good place to get involved, and we'd certainly
appreciate feedback as a newcomer to the project.

Jon

On Sat, Nov 24, 2018 at 9:59 AM Frankie  wrote:

> Did my first tiny contrubution yesterday and would like to share how it
> felt
> for me.
>
> First of all I have to say thanks for the great support and the fast reply
> to posts on the TomEE Dev mailing list. I feel very comfortable and
> welcomed
> with that.
>
> There were some little points of struggle that caused unsureness. I would
> like to take this as a chance to help to get the docu updated/improved so
> that other newcomers can benefit - or to get hints where I should have
> looked ... ;-)
>
> [1] current docu pages
> How can I tell which docu page is current, e.g. from:
> *  http://tomee.apache.org/community/sources.html
> 
> *  http://tomee.apache.org/dev/source-code.html
> 
>
> [2] git workflow: howto find the correct branch
> http://tomee.apache.org/dev/git.html 
>
> says:
> * The 'develop' repository is the equivalent of the SVN trunk directory
>=> branch "develop"? In github it is not active and the last commit on
> this is dated march 2015 ... ?
> * The 'master' repository is the equivalent of the SVN tags directory.
>=> branch "master" seems to be the used for the actual developing on
> Version 8.0.0?
>=> Branches "tomee-7.1.x", "tomee-7.0.x" and "tomee-1.7.x" obvoiusly
> used
> for the matching versions
>=> branch "tomee-8.0.0-ML1-rel"?
> I read through some PRs to figure out that I had to use the master for
> 8.0.0
> ...
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
>


Re: How Can I Help?

2018-11-26 Thread Ivan Junckes Filho
Hello Michael,

I suggest that you always ask questions to the list and not to me
privately. I may be busy like I was this weekend, and barely had time to
open my computer. A lot of people on the list are willing to help you with
these questions :)

You can do a master update periodically if you want, just to avoid
conflicts. I would say at least every time you start a new branch.

This will avoid conflicts.


On Sat, Nov 24, 2018 at 11:57 AM Michael Redlich  wrote:

> Hi Ivan:
>
> I cloned the *tomee* repository and started getting myself organized to
> add the Histogram example.  I'm curious if I should periodically initiate a:
>
> *git pull origin master*
>
> to get the latest changes.  Please advise...thanks!
>
> Sincerely,
>
> On Fri, Nov 23, 2018 at 11:11 AM Ivan Junckes Filho 
> wrote:
>
>> Hi Michael, great to have you here!
>>
>> I would suggest that you start doing some MicroProfile examples.
>>
>> What about taking this task?
>> https://issues.apache.org/jira/browse/TOMEE-2287
>>
>> We have very similar examples that will help you with that, it is
>> documented in the ticket.
>>
>> Let us know if you have questions!
>>
>> On Fri, Nov 23, 2018 at 1:45 PM Michael Redlich 
>> wrote:
>>
>>> Hello:
>>>
>>> My name is Michael Redlich and I was just confirmed to the TomEE
>>> Developers
>>> mailing list.
>>>
>>> Here's some background information about myself:
>>>
>>>- I live in Flemington , New
>>> Jersey
>>>with my lovely wife, Rowena.  We love to visit New Orleans, LA and
>>> Newport,
>>>RI on a regular basis.  We are avid cyclists and I am an avid runner.
>>>- I have worked for ExxonMobil for almost 29 years.
>>>- I have been writing for InfoQ
>>> since May 2016.
>>>- I founded the ACGNJ Java Users Group  in 2001
>>>and co-facilitate the group with Barry Burd
>>>.
>>>
>>> I am very interested in MicroProfile APIs.  I look forward to
>>> contributing
>>> to TomEE!
>>>
>>> Sincerely,
>>>
>>> Mike.
>>>
>>>
>>>
>>>
>>> --
>>> *Code*, *Write*, *Cycle*, *Run*, *Drink*,
>>> *Sleep ... Repeat*
>>>
>>> *InfoQ  Java Queue Editor*
>>> https://about.me/mpredli 
>>> https://twitter.com/mpredli
>>> https://redlich.net/
>>> https://javasig.org/
>>> *Laissez Les Bon Temps Rouler*
>>>
>>
>
> --
> *Code*, *Write*, *Cycle*, *Run*, *Drink*,
> *Sleep ... Repeat*
>
> *InfoQ  Java Queue Editor*
> https://about.me/mpredli 
> https://twitter.com/mpredli
> https://redlich.net/
> https://javasig.org/
> *Laissez Les Bon Temps Rouler*
>


Re: Metrics Gauge Example and Bug

2018-11-26 Thread Bruno Baptista

Hi,

I can review it.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 18:27, Ivan Junckes Filho wrote:

Hey guys can anyone review and merge this?

https://github.com/apache/tomee/pull/218


On Fri, Nov 23, 2018 at 2:22 PM Roberto Cortez 
wrote:


And it did cover. The test was failing.


On 23 Nov 2018, at 16:00, Romain Manni-Bucau 

wrote:



https://github.com/apache/tomee/blob/4c7fd4af95983a92bef89dc598873310dd13dd2e/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/johnzon/JsonbJaxrsProviderTest.java

was supposed to cover that

Romain Manni-Bucau
@rmannibucau  |  Blog
 | Old Blog
 | Github <

https://github.com/rmannibucau> |

LinkedIn  | Book
<

https://www.packtpub.com/application-development/java-ee-8-high-performance



Le ven. 23 nov. 2018 à 16:58, Bruno Baptista  a

écrit :

We should probably add a test for that regression.

Bruno Baptista
https://twitter.com/brunobat_


On 23/11/18 15:50, Ivan Junckes Filho wrote:

It worked, thanks man!

On Fri, Nov 23, 2018 at 12:40 PM Roberto Cortez 

wrote:

Yes, that was the issue. This should fix it:



https://github.com/apache/tomee/commit/1bfb65a1837235f4e9ad4458f67aabcab5eff829

Try to pull the code and test it again.

Cheers,
Roberto

On 23 Nov 2018, at 14:14, Roberto Cortez  wrote:

No point. I’ve found the issue:

It’s here:



https://github.com/tomitribe/tomee/commit/7f18f4bcfe64119b9001d5ac6bffeb7324987a37

This commit reverted back the new JsonbProvider to the old

JohnzonProvider.

The fix should be just to replace one with another. Let me try it and

test.

Cheers,
Roberto

On 23 Nov 2018, at 12:06, Ivan Junckes Filho 
wrote:

I was using the current master.

1.1.9

I will try to use the version Romain proposed and see how it works.


On Thu, Nov 22, 2018 at 7:36 PM Roberto Cortez <
radcor...@yahoo.com.invalid> wrote:


Hey,

I think metrics doesn’t even run properly on TomEE 7.x because of CDI

2.0.

Regarding the fail, I’m not sure what is wrong. I remember seeing

that

before and I think it got fixed when we added the JsonB JAX-RS

Provider.

Maybe there is a regression in some place.

Cheers,
Roberto


On 22 Nov 2018, at 21:08, Romain Manni-Bucau 
wrote:

Hi Ivan

Do you use tomee 8 with johnzon 1.1.10? Works well on this one

normally

if johnzon defaults are not broken. On tomee 7 you need to add jsonb

;)

Le jeu. 22 nov. 2018 21:51, Ivan Junckes Filho <

ivanjunc...@gmail.com

> a écrit :

Also there are a lot of properties being returned on that payload

that

are not needed like rate1, rate5... etc.


On Thu, Nov 22, 2018 at 6:26 PM Ivan Junckes Filho <

ivanjunc...@gmail.com > wrote:

The issue with the TCK is because meter in the spec expects

fifteenMinRate instead of fifteenMinuteRate.

Same apply for the other properties like fiveMin..oneMin..

@JsonbProperty("fifteenMinRate") is probably being ignored.




On Thu, Nov 22, 2018 at 5:46 PM Ivan Junckes Filho <

ivanjunc...@gmail.com > wrote:

Hey Romain, it is actually a mapping issue. I created the PR but the

microprofile metrics TCK seems to be broken on TomEE, so I am not

sure

if

the PR is reliable.

https://github.com/apache/geronimo-metrics/pull/2 <

https://github.com/apache/geronimo-metrics/pull/2>

I will try to check what is going on with the TCK on TomEE, if you

have

any tips let me know.




On Wed, Nov 21, 2018 at 7:59 PM Romain Manni-Bucau <

rmannibu...@gmail.com > wrote:

Hi Ivan

It is a bug in tomee scanning I think


Le mer. 21 nov. 2018 21:35, Ivan Junckes Filho <

ivanjunc...@gmail.com

> a

écrit :


Hey guys, I was writing an example of metrics gauge (WIP).

https://github.com/apache/tomee/pull/213 <

https://github.com/apache/tomee/pull/213>

And I found a bug when trying access a gauge with "Accept:
application/json".

Just to let you know that I will work on a fix for this:

21-Nov-2018 17:24:08.811 WARNING [http-nio-8080-exec-4]
org.apache.cxf.jaxrs.model.OperationResourceInfoComparator.compare

Both


org.apache.geronimo.microprofile.metrics.common.jaxrs.MetricsEndpoints#getJson

and


org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints#getJson

are equal candidates for handling the current request which can

lead

to

unpredictable results
21-Nov-2018 17:26:52.183 SEVERE [http-nio-8080-exec-4]
org.apache.cxf.jaxrs.utils.JAXRSUtils.logMessageHandlerProblem

Problem with

writing the data, class java.util.Collections$SingletonMap,

ContentType:

application/json
21-Nov-2018 17:26:52.184 WARNING [http-nio-8080-exec-4]
org.apache.cxf.phase.PhaseInterceptorChain.doDefaultLogging

Interceptor for

{


http://jaxrs.common.metrics.microprofile.geronimo.apache.org/}MetricsEndpoints

  <



Merging Old and New Websites

2018-11-26 Thread David Blevins
Hi All,

Our current status with regards to the TomEE website is we have one foot in 
each world, old and new.  The high-level history is more or less this:

 - 2006-2012 we used Confluence as the "source" and rendered that to html via a 
plugin maintained by one brave ASF individual, Pier Paolo Fumagalli.

 - 2012-2016 the ASF discontinued use of confluence like this and everyone 
moved to the Apache CMS, maintained by one brave ASF individual, Joe Schaefer.
   Each project's code was exported as-is into svn.  Joe and I did a bunch of 
work to get TomEE setup and was one of the first to use this system.  It was 
written in perl and basically invented Pull Requests before github and wasn't a 
bad solution.  We succeeded in fully migrating away from Confluence.  We didn't 
succeed in fully migrating content from Confluence markup to Markdown.

 - 2016 the ASF discontinued Apache CMS after Joe left.  Romain did a lot of 
great work to get JBake up and running.  JBake is written in Java and can 
easily be maintained by us, whereas anything else we've had could not.  This 
was done "on top" of the old site, with all the old content still there and 
decaying.  The old content is still generated by the Apache CMS.  We didn't 
succeeded in fully migrating away from Apache CMS.  We now have duplicate 
content that confuses us all.

The JBake work is technically the closest to success I think we've ever seen.  
The state of our content, however, is in need of significant love.

Here are some issues I think have caused repeat failure in all our 
documentation attempts:

 - Having just one "source" where documentation lived.
 - Mixing general project docs and technical docs.

When the topic of moving the docs into the main TomEE repo is raised, someone 
rightfully says, "what about the general project docs like contribution-tips?"

When the topic of trying to version the docs outside TomEE, someone says 
"that's a huge maintenance nightmare, maybe we can put some kind of 'since 
version 1.2.3' on sections of the docs?"

In the end I think all forms of "one big pile of docs" doesn't work even if 
that's git, svn, or confluence.  Our current status of "two big piles of docs", 
but with no clear line between them, works even less.

Here's what I've tried to do and this is a work in progress:

 - Merge old and new docs into one "pile" again
 - Split out the docs that could be versioned and put them into the main TomEE 
repo
 - Update our JBake setup so it uses jgit to select content from maintained 
TomEE branches & tags

The Merge:

 - old: https://github.com/apache/tomee-site/tree/trunk/content
 - new: 
https://github.com/apache/tomee-site-generator/tree/master/src/main/jbake/content
 - merged: 
https://github.com/dblevins/tomee-site-generator/tree/master/src/main/jbake/content

The Split:

Anything that could reasonably be tied to a release has been moved to "master" 
of the main TomEE repo:

 - https://github.com/dblevins/tomee/tree/tomee-8.0.x-docs/docs

The JBake Improvements:

We just grab from any number of repos and make one directory tree from them 
before we pass it to JBake.  This gives us these URLs (not live of course, so 
don't try to click them):

 - http://tomee.apache.org/tomee-7.0/docs/
 - http://tomee.apache.org/tomee-7.0/examples/

 - http://tomee.apache.org/tomee-7.1/docs/
 - http://tomee.apache.org/tomee-7.1/examples/

 - http://tomee.apache.org/tomee-8.0/docs/
 - http://tomee.apache.org/tomee-8.0/examples/

 - http://tomee.apache.org/latest/docs/
 - http://tomee.apache.org/latest/examples/

 - http://tomee.apache.org/master/docs/
 - http://tomee.apache.org/master/examples/

The intent being 7.0 is feed from the latest tag, which is currently 7.0.5.  
When 7.0.6 is released, all "/tomee-7.0/" urls will be rebuilt from the 7.0.6 
tag.  Same for 7.1, 8.0, etc.  The "latest" allows for a permalink and would 
point to what we consider to be the best, likely the tomee-8.0.0-M1 tag.  The 
"master" is so we can update and publish documentation in conversations with 
users and get their feedback prior to release.



This is all early-stage, still prototype, work in progress.  Help is incredibly 
welcome.  You can try out what's there so far, like so:

 $ git clone g...@github.com:dblevins/tomee-site-generator.git
 $ cd tomee-site-generator
 $ mvn clean compile -Djbake.http=true

Once that is done, you can open your browser to any of these urls:

 - http://localhost:8080/docs.html
 - http://localhost:8080/master/examples/mp-metrics-counted.html
 - http://localhost:8080/latest/examples/cdi-basic.html
 - http://localhost:8080/tomee-8.0/examples/cdi-basic.html
 - http://localhost:8080/tomee-8.0/docs/configuring-javamail.html


-- 
David Blevins
http://twitter.com/dblevins
http://www.tomitribe.com