From ca8da36d0139a4b8f26dd966c8928511f203d220 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Fri, 20 Oct 2017 18:30:05 -0400 Subject: [PATCH 01/20] Travis, wait. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8c652549..1b688ad5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: apt: true directories: - $HOME/.m2 -script: mvn install +script: travis_wait mvn install before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" From dfbf3ab83b008c464d379581ec72cd947f68a720 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Fri, 20 Oct 2017 21:14:57 -0400 Subject: [PATCH 02/20] Wait longer. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1b688ad5..07b0d4c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: apt: true directories: - $HOME/.m2 -script: travis_wait mvn install +script: travis_wait 30 mvn install before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" From e30ab21a89ad7fb0e4b7bc9001734399f959c418 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Sat, 21 Oct 2017 06:21:40 -0400 Subject: [PATCH 03/20] Wait longer. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 07b0d4c0..4dc84abb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: apt: true directories: - $HOME/.m2 -script: travis_wait 30 mvn install +script: travis_wait 60 mvn install before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" From 526b336c35b900f81bc35951e414165e0fef74d7 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 23 Oct 2017 12:03:36 -0400 Subject: [PATCH 04/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4dc84abb..575d0f59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ cache: apt: true directories: - $HOME/.m2 -script: travis_wait 60 mvn install +script: travis_wait 40 mvn install before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" From 15bd723b66afbcd318ee953e26293556c0a29fea Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 23 Oct 2017 12:42:21 -0400 Subject: [PATCH 05/20] Remove sudo. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 575d0f59..0ba66e4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -sudo: false language: java jdk: oraclejdk8 cache: From 89d39b28ab4988e98ea2185ae6337c45a360dd2f Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 23 Oct 2017 20:12:02 -0400 Subject: [PATCH 06/20] Another way to keep alive. --- .travis.yml | 2 +- scripts/keep_alive.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 scripts/keep_alive.sh diff --git a/.travis.yml b/.travis.yml index 0ba66e4f..4fed310d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ cache: apt: true directories: - $HOME/.m2 -script: travis_wait 40 mvn install +script: ./scripts/keep_alive.sh before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" diff --git a/scripts/keep_alive.sh b/scripts/keep_alive.sh new file mode 100755 index 00000000..900c05d7 --- /dev/null +++ b/scripts/keep_alive.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -ev +function write_visual_bells() { + for i in `seq 1 40`; do + echo -en "\a" + sleep 1m + done +} +write_visual_bells& +mvn install From 3b94e7976a129e43bc15a29a1479b86c50e9c01d Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 23 Oct 2017 21:03:11 -0400 Subject: [PATCH 07/20] Write it out. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4fed310d..5581e4c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ cache: apt: true directories: - $HOME/.m2 -script: ./scripts/keep_alive.sh +script: function write_visual_bells() { for i in `seq 1 40`; do echo -en "\a";sleep 1; done;};write_visual_bells&;mvn install before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" From 73d1008d64b7164c837d40b78f861e7206c53e62 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 23 Oct 2017 21:11:32 -0400 Subject: [PATCH 08/20] Try install. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5581e4c4..cf97f2e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,9 @@ cache: apt: true directories: - $HOME/.m2 -script: function write_visual_bells() { for i in `seq 1 40`; do echo -en "\a";sleep 1; done;};write_visual_bells&;mvn install before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" -# after_success: -# - mvn clean install jacoco:report coveralls:report +install: travis_wait 40 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From da81b1865f9f0f2cca495175810f1b3b5bbf57c0 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Mon, 23 Oct 2017 22:17:02 -0400 Subject: [PATCH 09/20] Try 60 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cf97f2e6..d54e8039 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,6 @@ cache: before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" -install: travis_wait 40 mvn install +install: travis_wait 60 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From 9c488829f6565f8daef863ac8de9a496ff5c3fe0 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Oct 2017 06:21:40 -0400 Subject: [PATCH 10/20] Try again. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d54e8039..7520f400 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,6 @@ cache: before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" -install: travis_wait 60 mvn install +install: travis_wait 90 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From ab395d303140030d5a0d4dac36a7d9465f328fdb Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Oct 2017 10:25:26 -0400 Subject: [PATCH 11/20] Add java options. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7520f400..5adefab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ cache: before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" + - "export _JAVA_OPTIONS: -Xmx4096m -Xms1024m" install: travis_wait 90 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From e30c91d0c40f26b733ab7cd3eb4b12571e5f6b9d Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Oct 2017 10:29:56 -0400 Subject: [PATCH 12/20] Fix. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5adefab5..7b24c5dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - - "export _JAVA_OPTIONS: -Xmx4096m -Xms1024m" + - "export _JAVA_OPTIONS='-Xmx4096m -Xms1024m'" install: travis_wait 90 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From fe87e615edeb1b58ba11237a28d6eb613f775479 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Oct 2017 10:37:19 -0400 Subject: [PATCH 13/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7b24c5dc..e4f50766 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ cache: before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - - "export _JAVA_OPTIONS='-Xmx4096m -Xms1024m'" + - echo "MAVEN_OPTS='-Xmx4g -XX:MaxPermSize=512m'" > ~/.mavenrc install: travis_wait 90 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From 49f7a15b98cf58a109ade831bde789e165bddb0c Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Oct 2017 13:46:26 -0400 Subject: [PATCH 14/20] Revert "Remove sudo." This reverts commit 15bd723b66afbcd318ee953e26293556c0a29fea. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e4f50766..98ec407a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: java jdk: oraclejdk8 cache: From 6789bc9bc9c9242cab983ea90afe0c831ef8838c Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Tue, 24 Oct 2017 16:20:30 -0400 Subject: [PATCH 15/20] Update pom.xml --- edu.cuny.hunter.streamrefactoring.tests/pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/edu.cuny.hunter.streamrefactoring.tests/pom.xml b/edu.cuny.hunter.streamrefactoring.tests/pom.xml index 79801047..761b0bd6 100644 --- a/edu.cuny.hunter.streamrefactoring.tests/pom.xml +++ b/edu.cuny.hunter.streamrefactoring.tests/pom.xml @@ -19,7 +19,7 @@ - ${tycho.testArgLine} -XstartOnFirstThread + ${tycho.testArgLine} -XstartOnFirstThread -Xmx4g -XX:MaxPermSize=1g @@ -31,7 +31,7 @@ - ${tycho.testArgLine} + ${tycho.testArgLine} -Xmx4g -XX:MaxPermSize=1g @@ -44,7 +44,6 @@ true false - ${ui.test.vmargs} true true false From 8f28edbf6c92b72d280bfa57c65916fcd5987f88 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Fri, 27 Oct 2017 09:17:04 -0400 Subject: [PATCH 16/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 829e33a8..948889b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,6 @@ cache: before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" -install: travis_wait 90 mvn install +install: travis_wait 120 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From 5f2265e2bedf91825b3ae635d0ecf147dc92ba5a Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Fri, 22 Dec 2017 10:25:00 -0500 Subject: [PATCH 17/20] Revert "Revert "Add complete first motivating example."" This reverts commit de6a50aededb99eb5ef525271766b7c78893c88e. We need this on this branch. --- .../testMotivatingExample/in/A.java | 27 +++++++++++++++++++ ...onvertStreamToParallelRefactoringTest.java | 24 +++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/edu.cuny.hunter.streamrefactoring.tests/resources/ConvertStreamToParallel/testMotivatingExample/in/A.java b/edu.cuny.hunter.streamrefactoring.tests/resources/ConvertStreamToParallel/testMotivatingExample/in/A.java index ef7adea9..2fe1f230 100644 --- a/edu.cuny.hunter.streamrefactoring.tests/resources/ConvertStreamToParallel/testMotivatingExample/in/A.java +++ b/edu.cuny.hunter.streamrefactoring.tests/resources/ConvertStreamToParallel/testMotivatingExample/in/A.java @@ -10,6 +10,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +import p.Widget.Color; + class Widget { public enum Color { RED, @@ -56,5 +58,30 @@ void m() { // sequentially skip the first 1000 widgets and // collect the remaining into a list. List skippedWidgetList = orderedWidgets.stream().skip(1000).collect(Collectors.toList()); + + Collection orderedWidgets2 = orderedWidgets; + + // collect the first green widgets into a list. + List firstGreenList = orderedWidgets2.stream().filter(w -> w.getColor() == Color.GREEN).unordered() + .limit(5).collect(Collectors.toList()); + + Collection orderedWidgets3 = orderedWidgets; + + // collect distinct widget weights into a set. + Set distinctWeightSet = orderedWidgets3.stream().parallel().map(Widget::getWeight).distinct() + .collect(Collectors.toCollection(TreeSet::new)); + + // collect distinct widget colors into a HashSet. + Set distinctColorSet = orderedWidgets2.parallelStream().map(Widget::getColor).distinct() + .collect(HashSet::new, Set::add, Set::addAll); + + // collect widget colors matching a regex. + Pattern pattern = Pattern.compile(".*e[a-z]"); + ArrayList results = new ArrayList<>(); + + Collection orderedWidgets4 = orderedWidgets; + + orderedWidgets4.stream().map(w -> w.getColor()).map(c -> c.toString()).filter(s -> pattern.matcher(s).matches()) + .forEach(s -> results.add(s)); } } \ No newline at end of file diff --git a/edu.cuny.hunter.streamrefactoring.tests/test cases/edu/cuny/hunter/streamrefactoring/ui/tests/ConvertStreamToParallelRefactoringTest.java b/edu.cuny.hunter.streamrefactoring.tests/test cases/edu/cuny/hunter/streamrefactoring/ui/tests/ConvertStreamToParallelRefactoringTest.java index f0f8894b..bc6be1e0 100644 --- a/edu.cuny.hunter.streamrefactoring.tests/test cases/edu/cuny/hunter/streamrefactoring/ui/tests/ConvertStreamToParallelRefactoringTest.java +++ b/edu.cuny.hunter.streamrefactoring.tests/test cases/edu/cuny/hunter/streamrefactoring/ui/tests/ConvertStreamToParallelRefactoringTest.java @@ -513,12 +513,32 @@ public void testMotivatingExample() throws Exception { Collections.emptySet()), new StreamAnalysisExpectedResult("orderedWidgets.parallelStream()", EnumSet.of(ExecutionMode.PARALLEL), - EnumSet.of(Ordering.ORDERED), false, false, false, null, null, null, RefactoringStatus.ERROR, + EnumSet.of(Ordering.ORDERED), false, false, true, null, null, null, RefactoringStatus.ERROR, EnumSet.of(PreconditionFailure.NO_STATEFUL_INTERMEDIATE_OPERATIONS)), new StreamAnalysisExpectedResult("orderedWidgets.stream()", EnumSet.of(ExecutionMode.SEQUENTIAL), EnumSet.of(Ordering.ORDERED), false, true, true, null, null, null, RefactoringStatus.ERROR, - EnumSet.of(PreconditionFailure.REDUCE_ORDERING_MATTERS))); + EnumSet.of(PreconditionFailure.REDUCE_ORDERING_MATTERS)), + + new StreamAnalysisExpectedResult("orderedWidgets2.stream()", EnumSet.of(ExecutionMode.SEQUENTIAL), + EnumSet.of(Ordering.UNORDERED), false, true, true, + EnumSet.of(TransformationAction.CONVERT_TO_PARALLEL), PreconditionSuccess.P1, + Refactoring.CONVERT_SEQUENTIAL_STREAM_TO_PARALLEL, RefactoringStatus.OK, + Collections.emptySet()), + + new StreamAnalysisExpectedResult("orderedWidgets3.stream()", EnumSet.of(ExecutionMode.PARALLEL), + EnumSet.of(Ordering.ORDERED), false, true, true, + EnumSet.of(TransformationAction.CONVERT_TO_SEQUENTIAL), PreconditionSuccess.P5, + Refactoring.OPTIMIZE_PARALLEL_STREAM, RefactoringStatus.OK, Collections.emptySet()), + + new StreamAnalysisExpectedResult("orderedWidgets2.parallelStream()", EnumSet.of(ExecutionMode.PARALLEL), + EnumSet.of(Ordering.ORDERED), false, true, false, EnumSet.of(TransformationAction.UNORDER), + PreconditionSuccess.P4, Refactoring.OPTIMIZE_PARALLEL_STREAM, RefactoringStatus.OK, + Collections.emptySet()), + + new StreamAnalysisExpectedResult("orderedWidgets4.stream()", EnumSet.of(ExecutionMode.SEQUENTIAL), + EnumSet.of(Ordering.ORDERED), true, false, false, null, null, null, RefactoringStatus.ERROR, + EnumSet.of(PreconditionFailure.HAS_SIDE_EFFECTS2))); } public void testTerminalOp1() throws Exception { From 9286ec14b67b3ae64f04eebc4a17727108967003 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Wed, 3 Jan 2018 20:45:19 -0500 Subject: [PATCH 18/20] Try .travis.yml from master. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 948889b7..9771061a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ cache: apt: true directories: - $HOME/.m2 +script: mvn clean verify -Pjacoco coveralls:report before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" -install: travis_wait 120 mvn install notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji From d5bdb07b3abbe1cb82aad84fc2f8c4ca3359a18b Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Wed, 21 Aug 2019 14:26:20 -0400 Subject: [PATCH 19/20] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9771061a..12d4cadd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false language: java -jdk: oraclejdk8 +jdk: openjdk8 cache: apt: true directories: From d7532c4d58e9e8f212baf404e4def56ddd856be6 Mon Sep 17 00:00:00 2001 From: Raffi Khatchadourian Date: Wed, 21 Aug 2019 14:35:30 -0400 Subject: [PATCH 20/20] Update xvfb. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12d4cadd..4bac75bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,8 @@ cache: apt: true directories: - $HOME/.m2 +services: + - xvfb script: mvn clean verify -Pjacoco coveralls:report -before_install: - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" notifications: slack: cunyponder:A8GuEoj0voEn2H7MJDL1eNji