This is an automated email from the ASF dual-hosted git repository.
jlmonteiro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/master by this push:
new a3357254a5 Some small fixes in versions
a3357254a5 is described below
commit a3357254a580d35ba532a619ef3ffe1d8f657c07
Author: Jean-Louis Monteiro <[email protected]>
AuthorDate: Fri Jun 24 23:09:08 2022 +0200
Some small fixes in versions
---
examples/javamail/pom.xml | 2 +-
examples/pom.xml | 2 +-
itests/ejb/pom.xml | 86 -----
.../apache/tomee/itests/ejb/CalculatorBean.java | 24 --
.../apache/tomee/itests/ejb/CalculatorRemote.java | 20 -
.../org/apache/tomee/itests/ejb/PortReuseTest.java | 165 --------
itests/startup/pom.xml | 113 ------
.../apache/tomee/itest/startup/StartupTest.java | 430 ---------------------
tomee/tomee-deb/pom.xml | 2 +-
9 files changed, 3 insertions(+), 841 deletions(-)
diff --git a/examples/javamail/pom.xml b/examples/javamail/pom.xml
index a9c571e77a..a468915faa 100644
--- a/examples/javamail/pom.xml
+++ b/examples/javamail/pom.xml
@@ -59,7 +59,7 @@
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-mail_2.1_spec</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0-M1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/examples/pom.xml b/examples/pom.xml
index 612bf493be..83b4f76b18 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -71,6 +71,7 @@
<module>deltaspike-exception-handling</module>
<module>deltaspike-fullstack</module>
<module>deltaspike-i18n</module>
+ <module>projectstage-demo</module>
-->
<module>dynamic-dao-implementation</module>
<module>dynamic-datasource-routing</module>
@@ -140,7 +141,6 @@
<module>persistence-fragment</module>
<module>pojo-webservice</module>
<!-- <module>polling-parent</module>-->
- <module>projectstage-demo</module>
<module>quartz-app</module>
<module>realm-in-tomee</module>
<module>reload-persistence-unit-properties</module>
diff --git a/itests/ejb/pom.xml b/itests/ejb/pom.xml
deleted file mode 100644
index 794139546d..0000000000
--- a/itests/ejb/pom.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <version>8.0.11-SNAPSHOT</version>
-
- <parent>
- <artifactId>itests</artifactId>
- <groupId>org.apache.tomee</groupId>
- <version>8.0.11-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.tomee.itests</groupId>
- <artifactId>ejb</artifactId>
- <packaging>jar</packaging>
- <name>TomEE :: iTests :: EJB</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <version>${project.version}</version>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>tomee-server-composer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>apache-tomee</artifactId>
- <version>8.0.11-SNAPSHOT</version>
- <type>tar.gz</type>
- <classifier>microprofile</classifier>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee.bom</groupId>
- <artifactId>tomee-webprofile-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>openejb-client</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-</project>
-
diff --git
a/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/CalculatorBean.java
b/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/CalculatorBean.java
deleted file mode 100644
index 7b060f7725..0000000000
--- a/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/CalculatorBean.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.itests.ejb;
-
-import javax.ejb.Remote;
-
-@Remote
-public interface CalculatorRemote {
- int sum (int a1, int a2);
-}
diff --git
a/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/CalculatorRemote.java
b/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/CalculatorRemote.java
deleted file mode 100644
index 1b10772d8e..0000000000
--- a/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/CalculatorRemote.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.itests.ejb;
-
-public interface CalculatorRemote {
-}
diff --git
a/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/PortReuseTest.java
b/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/PortReuseTest.java
deleted file mode 100644
index 54f897fad4..0000000000
--- a/itests/ejb/src/test/java/org/apache/tomee/itests/ejb/PortReuseTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.tomee.itests.ejb;
-
-import org.apache.tomee.server.composer.Archive;
-import org.apache.tomee.server.composer.TomEE;
-import org.junit.Assert;
-import org.junit.Test;
-import org.tomitribe.util.Files;
-import org.tomitribe.util.IO;
-import org.tomitribe.util.Join;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-public class PortReuse Test {
-
- @Test
- public void test() throws Exception {
- final TomEE tomee = TomEE.webprofile()
- .add("webapps/test/WEB-INF/lib/app.jar", Archive.archive()
- .add(CalculatorRemote.class)
- .add(CalculatorBean.class)
- .asJar())
- .home(this::editAccessLogPattern)
- .home(this::updateSystemProperties)
- .build();
-
- final Properties p = new Properties();
- p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
- p.setProperty(Context.PROVIDER_URL, "http://localhost:" +
tomee.getPort() + "/tomee/ejb");
-
- final InitialContext initialContext = new InitialContext(p);
- final CalculatorRemote calc = (CalculatorRemote)
initialContext.lookup("CalculatorBeanRemote");
- Assert.assertEquals(3, calc.sum(1, 2));
- Assert.assertEquals(6, calc.sum(2, 4));
- Assert.assertEquals(12, calc.sum(3, 9));
- Assert.assertEquals(24, calc.sum(4, 20));
-
- final List<String> ejbRequests = getEjbRequests(5, tomee.getHome(),
30);
-
- final Set<String> sourcePorts = ejbRequests.stream()
- .map(this::lastNumber)
- .filter(Objects::nonNull)
- .collect(Collectors.toSet());
-
- System.out.println(Join.join(", ", sourcePorts));
- Assert.assertEquals(1, sourcePorts.size());
- Assert.assertEquals(5, ejbRequests.size());
- }
-
- private List<String> getEjbRequests(final int expected, final File
tomeeHome, final int retries) {
- // The access log is written to asynchronously, so we poll it up to
<retries> times.
- for (int i = 0; i < retries; i++) {
- final List<String> ejbRequests = getEjbRequests(tomeeHome);
-
- if (ejbRequests != null && ejbRequests.size() >= expected) {
- return ejbRequests;
- }
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // ignore
- }
- }
-
- return null;
- }
-
- private List<String> getEjbRequests(final File tomeeHome) {
- try {
- final File accessLog = findAccessLog(tomeeHome);
- final String requests = IO.slurp(accessLog);
-
- final List<String> ejbRequests =
Arrays.stream(requests.split("([\\r\\n])+"))
- .filter(r -> r.contains("/tomee/ejb"))
- .collect(Collectors.toList());
-
- return ejbRequests;
- } catch (Throwable t) {
- // ignore
- }
-
- return null;
- }
-
- private String lastNumber(final String input) {
- final Pattern lastNumber = Pattern.compile("^.*?(\\d+)$");
- final Matcher matcher = lastNumber.matcher(input);
- if (matcher.matches()) {
- return matcher.group(1);
- } else {
- return null;
- }
- }
-
- private File findAccessLog(final File home) {
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- final File logsDirectory = new File(home, "logs");
- final String expectedFilename = "localhost_access_log." +
sdf.format(new Date()) + ".txt";
-
- final File[] accessLogs = logsDirectory.listFiles(f ->
f.getName().equals(expectedFilename));
-
- if (accessLogs.length != 1) {
- throw new RuntimeException("Unable to find access log");
- }
-
- return accessLogs[0];
- }
-
- private void updateSystemProperties(File home) {
- try {
- final File systemProps = Files.file(home, "conf",
"system.properties");
- String props = IO.slurp(systemProps);
- props = props + "\ntomee.remote.support = true" +
- "\ntomee.serialization.class.whitelist =
java.,org.apache.openejb.,org.apache.tomee." +
- "\ntomee.serialization.class.blacklist = -";
-
- IO.copy(IO.read(props), systemProps);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private void editAccessLogPattern(final File home) {
- try {
- final File serverxml = Files.file(home, "conf", "server.xml");
- final String config = IO.slurp(serverxml)
- .replaceAll("pattern=\".*?\"", "pattern=\"%h %l %u %t
"%r" %s %b %{remote}p\"");
-
- IO.copy(IO.read(config), serverxml);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-}
\ No newline at end of file
diff --git a/itests/startup/pom.xml b/itests/startup/pom.xml
deleted file mode 100644
index 16ac1d5714..0000000000
--- a/itests/startup/pom.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <artifactId>itests</artifactId>
- <groupId>org.apache.tomee</groupId>
- <version>8.0.2-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.tomee.itests</groupId>
- <artifactId>startup</artifactId>
- <packaging>jar</packaging>
- <name>TomEE :: iTests :: Server Composer</name>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <version>${project.version}</version>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>tomee-server-composer</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>apache-tomee</artifactId>
- <version>8.0.2-SNAPSHOT</version>
- <type>tar.gz</type>
- <classifier>microprofile</classifier>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>jakartaee-api</artifactId>
- <version>9.1-M2</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.microprofile.jwt</groupId>
- <artifactId>microprofile-jwt-auth-api</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.nimbusds</groupId>
- <artifactId>nimbus-jose-jwt</artifactId>
- <version>4.23</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>openejb-cxf-rs</artifactId>
- <version>${tomee.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-math3</artifactId>
- <version>3.6.1</version>
- </dependency>
- <dependency>
- <groupId>com.github.tomas-langer</groupId>
- <artifactId>chalk</artifactId>
- <version>1.0.2</version>
- </dependency>
- <dependency>
- <groupId>com.github.tomas-langer.cli</groupId>
- <artifactId>cli-progress</artifactId>
- <version>1.0.0</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-</project>
-
diff --git
a/itests/startup/src/test/java/org/apache/tomee/itest/startup/StartupTest.java
b/itests/startup/src/test/java/org/apache/tomee/itest/startup/StartupTest.java
deleted file mode 100644
index 7957c3f611..0000000000
---
a/itests/startup/src/test/java/org/apache/tomee/itest/startup/StartupTest.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.itest.startup;
-
-import com.github.tomaslanger.chalk.Ansi;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.openejb.loader.Files;
-import org.apache.openejb.loader.IO;
-import
org.apache.openejb.math.stat.descriptive.SynchronizedDescriptiveStatistics;
-import org.apache.openejb.util.Join;
-import org.apache.tomee.server.composer.TomEE;
-import org.junit.Test;
-
-import jakarta.ws.rs.core.Response;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class StartupTest {
-
- private static final File downloads = new
File("/Users/dblevins/work/apache/downloads");
-
- public StartupTest() {
- if (!downloads.exists()) assertTrue(downloads.mkdir());
- }
-
- public static class Binary implements Sortable<Binary> {
- final AtomicInteger nameWidth;
- final AtomicInteger count = new AtomicInteger(0);
- final SynchronizedDescriptiveStatistics extraction = new
SynchronizedDescriptiveStatistics(2000);
- final SynchronizedDescriptiveStatistics startup = new
SynchronizedDescriptiveStatistics(2000);
- final SynchronizedDescriptiveStatistics other = new
SynchronizedDescriptiveStatistics(2000);
- final File file;
- final String name;
- String last;
-
- public Binary(final AtomicInteger nameWidth, final File file) {
- this.file = file;
- this.name = this.file.getName().replace(".tar.gz", "");
- this.nameWidth = nameWidth;
- this.nameWidth.set(Math.max(this.nameWidth.get(), name.length()));
- }
-
- @Override
- public String last() {
- return last;
- }
-
- public String get() {
- final String namePadded = String.format("%-" + nameWidth.get() +
"s", name);
- final String nameColored =
namePadded.replaceAll("(apache-tomee-)(.+)-(.+)",
"$1\033[38;5;231m$2\033[0m-\033[38;5;186m$3\033[0m");
- TomEE tomee = null;
- try {
- final long start = System.nanoTime();
- tomee = TomEE.from(file)
- .out(INGORED())
- .err(INGORED())
- .add("webapps/speed.war", new
File(StartupTest.downloads, "speed.war"))
- .build();
-
- final String address =
tomee.toURI().resolve("/speed").toURL().toExternalForm();
- final WebClient webClient = WebClient.create(address);
-
- {// valid token
- final Response response = webClient.reset()
- .path("/color/")
- .header("Content-Type", "application/json")
- .get();
- assertEquals(200, response.getStatus());
- }
-
- extraction.addValue(toMillis(tomee.getStats().getExtracted()));
- startup.addValue(toMillis(tomee.getStats().getStartup()));
- other.addValue(toMillis(System.nanoTime() - start));
-
- final int i = count.incrementAndGet();
- final long extractedTime = (long)
extraction.getPercentile(90.0);
- final long startupTime = (long) startup.getPercentile(90.0);
- final long executionTime = (long) other.getPercentile(90.0);
-
- final int unit = 100;
- final int n = (int) (executionTime / unit);
- final char[] bar = new char[n];
-
- int j = 0;
- for (int k = 0; k * unit < extractedTime && j < bar.length;
k++, j++) bar[j] = 'x';
- for (int k = 0; k * unit < startupTime && j < bar.length; k++,
j++) bar[j] = 's';
- for (; j < bar.length; j++) bar[j] = 'o';
-
- final String executionBar = new String(bar)
- .replaceFirst("(x+)(s+)?(o+)?",
"\033[38;5;060m$1\033[38;5;088m$2\033[38;5;071m$3\033[0m");
-
- return last = String.format("%s %4s %6s %6s %6s %s",
- nameColored,
- i,
- extractedTime,
- startupTime,
- executionTime,
- executionBar
- );
- } catch (Throwable e1) {
- return String.format("%-" + nameWidth.get() + "s %s: %s",
nameColored, e1.getClass().getSimpleName(), e1.getMessage());
- } finally {
- if (tomee != null) tomee.shutdown();
- }
- }
-
- @Override
- public int compareTo(final Binary that) {
- final Double a = this.other.getPercentile(90.0);
- final Double b = that.other.getPercentile(90.0);
- return a.compareTo(b);
- }
- }
-
- @Test
- public void test() throws Exception {
-
- final AtomicInteger nameWidth = new AtomicInteger(10);
- final List<Sortable> list = Stream.of(downloads.listFiles())
- .filter(file -> file.getName().endsWith(".tar.gz"))
-// .peek(System.out::println)
- .filter(file ->
file.getName().matches(".*(plus|webprofile).*"))
- .filter(file -> !file.getName().contains("beta"))
- .map(this::toJaxrs)
- .filter(File::exists)
-// .filter(file -> file.getName().contains("-M"))
- .peek(System.out::println)
- .map(file -> new Binary(nameWidth, file))
- .map(binary -> (Sortable) binary)
- .collect(Collectors.toList());
-
- runAndSort(() -> true, list);
-// run(() -> true,
-// new Binary(nameWidth, new File(downloads,
"apache-tomee-1.0.0-plus.tar.gz"))::run,
-// new Binary(nameWidth, new File(downloads,
"apache-tomee-1.7.0-plus.tar.gz"))::run,
-// new Binary(nameWidth, new File(downloads,
"apache-tomee-7.0.0-plus.tar.gz"))::run,
-// new Binary(nameWidth, new File(downloads,
"apache-tomee-8.0.0-M1-plus.tar.gz"))::run
-// );
- }
-
- private File toJaxrs(final File file) {
- if (!file.getName().contains("-1.")) return file;
- if (!file.getName().contains("webprofile")) return file;
- return new File(file.getAbsolutePath().replace("webprofile", "jaxrs"));
- }
-
-
- private static long toMillis(final long time) {
- return TimeUnit.NANOSECONDS.toMillis(time);
- }
-
- private static PrintStream INGORED() {
- return new PrintStream(new OutputStream() {
- @Override
- public void write(final int b) throws IOException {
- }
- });
- }
-
- // @Test
- public void progress2() throws Exception {
- run(() -> true,
- new Line("seven", 7),
- new Line("one", 1),
- new Line("eleven", 11),
- new Line("five", 5),
- new Line("three", 3)
- );
- }
-
- public interface Sortable<T> extends Comparable<T> {
- String get();
-
- String last();
- }
-
- public static class SortableAdapter implements Comparable<SortableAdapter>
{
- private String last;
- private final SynchronizedDescriptiveStatistics time = new
SynchronizedDescriptiveStatistics(10);
- private Supplier<String> supplier;
-
- public SortableAdapter(final Supplier<String> supplier) {
- this.supplier = supplier;
- }
-
- public String get() {
- final long start = System.currentTimeMillis();
- try {
- return last = supplier.get();
- } finally {
- final long elapsed = System.currentTimeMillis() - start;
- time.addValue(elapsed);
- }
- }
-
- public String last() {
- return last;
- }
-
- @Override
- public int compareTo(final SortableAdapter that) {
- final Double a = this.time.getPercentile(90);
- final Double b = that.time.getPercentile(90);
- return a.compareTo(b);
- }
- }
-
- private static void run(final Supplier<Boolean> proceed,
Supplier<String>... items) {
- run(proceed, Arrays.asList(items));
- }
-
- private static void run(final Supplier<Boolean> proceed, final
List<Supplier<String>> items) {
- final List<Sortable> sortables = items.stream()
- .map(SortableAdapter::new)
- .map(Sortable.class::cast)
- .collect(Collectors.toList());
- runAndSort(proceed, sortables);
- }
-
- private static void runAndSort(final Supplier<Boolean> proceed, final
List<Sortable> list) {
- final List<Sortable> items = new ArrayList<>(list);
-
- for (final Sortable item : items) System.out.println();
-
- long lastSort = System.currentTimeMillis();
-
- while (proceed.get()) {
-
- final long start = System.currentTimeMillis();
-
- System.out.print(Ansi.cursorUp(items.size() + 1));
- for (final Sortable item : items) {
- System.out.print("\r");
- System.out.print(Ansi.cursorDown());
- final String s = item.get();
- System.out.print(Ansi.eraseLine());
- System.out.print(s);
- }
- System.out.print(Ansi.cursorDown());
- System.out.printf("\r");
-
- final long elapsed = System.currentTimeMillis() - start;
- if (elapsed < 500) {
- try {
- Thread.sleep(500 - elapsed);
- } catch (InterruptedException e) {
- e.printStackTrace();
- Thread.interrupted();
- }
- }
-
- final long due = System.currentTimeMillis() - lastSort;
- if (due > TimeUnit.SECONDS.toMillis(10)) {
- lastSort = System.currentTimeMillis();
- Collections.sort(items);
- System.out.print(Ansi.cursorUp(items.size() + 1));
- for (final Sortable item : items) {
- System.out.print("\r");
- System.out.print(Ansi.cursorDown());
- final String s = item.last();
- System.out.print(Ansi.eraseLine());
- System.out.print(s);
- }
- System.out.print(Ansi.cursorDown());
- System.out.printf("\r");
- }
- }
- }
-
-
- // @Test
- public void get() throws Exception {
- getCachedTomeeTarGzs()
- .stream()
- .map(this::getDownloaded)
- .map(File::getAbsolutePath)
- .forEach(System.out::println);
-
- }
-
- private List<URI> getCachedTomeeTarGzs() {
- final File index = new File(downloads, "index.txt");
- if (index.exists()) {
- return Stream.of(slurp(index).split("\n"))
- .map(URI::create)
- .collect(Collectors.toList());
- }
-
- final List<URI> uris = getAllTomeeTarGzs();
-
- try {
- IO.copy(IO.read(Join.join("\n", uris)), index);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- return uris;
- }
-
- private File getDownloaded(final URI uri) {
- final File file = getFile(uri);
-
- if (file.exists()) return file;
-
- return download(uri);
- }
-
- private File download(final URI uri) {
- final WebClient client = WebClient.create(uri.toASCIIString());
- final Response response = client.get();
- assertEquals(200, response.getStatus());
-
- final InputStream entity = (InputStream) response.getEntity();
- final BufferedInputStream buffer = new BufferedInputStream(entity);
-
- Files.mkdir(downloads);
-
- final File file = getFile(uri);
-
- System.out.printf("Downloading: %s%n", file.getAbsolutePath());
-
- try {
- IO.copy(buffer, file);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- return file;
- }
-
- private File getFile(final URI uri) {
- return new File(downloads, new File(uri.getPath()).getName());
- }
-
- private List<URI> getAllTomeeTarGzs() {
- final URI uri = URI.create("http://archive.apache.org/dist/");
- return (List<URI>) Stream.of("openejb/", "tomee/")
- .map(uri::resolve)
- .map(this::getVersions)
- .flatMap(Collection::stream)
- .map(this::getTarGzs)
- .flatMap(Collection::stream)
- .collect(Collectors.toList());
- }
-
- private String slurp(final File index) {
- try {
- return IO.slurp(index);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
-
- private List<URI> getVersions(final URI uri) {
- final WebClient client = WebClient.create(uri.toASCIIString());
- final String html = client.get(String.class);
- return (List<URI>) Stream.of(html.split("\n"))
- .filter(s -> s.contains("alt=\"[DIR]\""))
- .map(s -> s.replaceAll(".*a href=\"([^\"]+)\".*", "$1"))
- .map(uri::resolve)
- .collect(Collectors.toList());
- }
-
- private List<URI> getTarGzs(final URI uri) {
- final WebClient client = WebClient.create(uri.toASCIIString());
- final String html = client.get(String.class);
-
- return (List<URI>) Stream.of(html.split("[<>]"))
- .filter(s -> s.contains("tar.gz\""))
- .filter(s -> s.contains("apache-tomee"))
- .map(s -> s.replace("a href=\"", ""))
- .map(s -> s.replace("\"", ""))
- .map(uri::resolve)
- .collect(Collectors.toList());
- }
-
- private static class Line implements Supplier<String> {
- private final String prefix;
- private final int mod;
- private int i;
-
- public Line(final String prefix, final int mod) {
- this.prefix = prefix;
- this.mod = mod;
- }
-
- @Override
- public String get() {
- try {
- Thread.sleep(10 * mod);
- } catch (InterruptedException e) {
- Thread.interrupted();
- }
- i += mod;
- return prefix + " " + i;
- }
- }
-}
diff --git a/tomee/tomee-deb/pom.xml b/tomee/tomee-deb/pom.xml
index ccbc83c679..e321e7d105 100644
--- a/tomee/tomee-deb/pom.xml
+++ b/tomee/tomee-deb/pom.xml
@@ -17,7 +17,7 @@
<parent>
<artifactId>tomee</artifactId>
<groupId>org.apache.tomee</groupId>
- <version>8.0.2-SNAPSHOT</version>
+ <version>9.0.0-M8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>