Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package p;

import java.util.HashSet;

import edu.cuny.hunter.streamrefactoring.annotations.*;

class A {
@EntryPoint
void m() {
HashSet h1 = new HashSet();
h1.stream().count();
}

@EntryPoint
void n() {
HashSet h2 = new HashSet();
h2.stream().count();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test case, n() has a dependency on m(), but in the first test case, n() and m() are independent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In an effort to reduce test time, let's keep the file but remove it from the test case.


import java.util.HashSet;
import java.util.stream.*;

import edu.cuny.hunter.streamrefactoring.annotations.*;

class A {
@EntryPoint
Stream<Object> m() {
Stream<Object> stream = new HashSet<>().parallelStream();
return stream;
}

@EntryPoint
void n() {
Stream<Object> s = m();
s.count();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package p;

import java.util.HashSet;

import edu.cuny.hunter.streamrefactoring.annotations.*;

/**
* remove an annotation before m() from testMultipleEntryPoint
*/
class A {

void m() {
HashSet h1 = new HashSet();
h1.stream().count();
}

@EntryPoint
void n() {
HashSet h2 = new HashSet();
h2.stream().count();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just follow your instruction: " For the case created above, create another case by copying the above but removing one of the @entrypoint annotations." #122
I guess you want to create a comparison for the test case with multiple entry points.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I don't think we need a case with a dependency between the two methods. I'm unsure as to what that is going to buy us. Please let me know if you disagree.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.


import java.util.HashSet;
import java.util.stream.*;

import edu.cuny.hunter.streamrefactoring.annotations.*;

/**
* remove an entry point before m() from testMultipleEntryPoint1
*/
class A {

Stream<Object> m() {
Stream<Object> stream = new HashSet<>().parallelStream();
return stream;
}

@EntryPoint
void n() {
Stream<Object> s = m();
s.count();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,24 @@ public void testTerminalOp3() throws Exception {
false, false, false, null, null, null, RefactoringStatus.ERROR,
Collections.singleton(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
}

/**
* Test #122.
*/
public void testMultipleEntryPoints() throws Exception {
helper(new StreamAnalysisExpectedResult("h1.stream()", Collections.singleton(ExecutionMode.SEQUENTIAL),
Collections.singleton(Ordering.UNORDERED), false, false, false,
EnumSet.of(TransformationAction.CONVERT_TO_PARALLEL), PreconditionSuccess.P1,
Refactoring.CONVERT_SEQUENTIAL_STREAM_TO_PARALLEL, RefactoringStatus.OK, Collections.emptySet()));
}

/**
* Test #122. Remove an annotation from testMultipleEntryPoints().
*/
public void testOneEntryPoint() throws Exception {
helper(new StreamAnalysisExpectedResult("h2.stream()", Collections.singleton(ExecutionMode.SEQUENTIAL),
Collections.singleton(Ordering.UNORDERED), false, false, false,
EnumSet.of(TransformationAction.CONVERT_TO_PARALLEL), PreconditionSuccess.P1,
Refactoring.CONVERT_SEQUENTIAL_STREAM_TO_PARALLEL, RefactoringStatus.OK, Collections.emptySet()));
}
}