1
- /**
2
- *
3
- */
4
1
package edu .cuny .hunter .streamrefactoring .ui .tests ;
5
2
6
3
import java .io .File ;
@@ -75,7 +72,7 @@ public class ConvertStreamToParallelRefactoringTest extends RefactoringTest {
75
72
76
73
private static final int RETRY_DELAY = 1000 ;
77
74
78
- private static final String ENTRY_POINT_FILE = "entry_points.txt" ;
75
+ private static final String ENTRY_POINT_FILENAME = "entry_points.txt" ;
79
76
80
77
static {
81
78
LOGGER .setLevel (Level .FINER );
@@ -133,49 +130,61 @@ public static Test setUpTest(Test test) {
133
130
}
134
131
135
132
/**
136
- * @return Path: an absolute path of entry_points.txt in the project directory
133
+ * @return an absolute path of entry_points.txt in the project directory.
137
134
*/
138
- private Path getAbsoluteProjectPath () {
139
- return this . getAbsolutePath (this .getTestPath () + this .getName ()).resolve (ENTRY_POINT_FILE );
135
+ private Path getEntryPointFileProjectSourcePath () {
136
+ return getAbsolutePath (this .getTestPath () + this .getName ()).resolve (ENTRY_POINT_FILENAME );
140
137
}
141
138
142
139
/**
143
- * @return Path: an absolute path of entry_points.txt in the project directory
144
- * of junit workspace
140
+ * @return The {@link Path} of where the entry points file should be copied to
141
+ * for the current project under test.
145
142
*/
146
- private Path getDestinationProjectPath () {
147
- return getDestinationPath (this .getPackageP ().getJavaProject ());
143
+ private Path getEntryPointFileProjectDestinationPath () {
144
+ return getEntryPointFileDestinationPath (this .getPackageP ().getJavaProject ());
148
145
}
149
146
150
147
/**
151
- * @return Path: an absolute path of entry_points.txt in the junit workspace
148
+ * @return The {@link Path} of where the entry_points.txt file should be copied
149
+ * to in the junit workspace.
152
150
*/
153
- private Path getDestinationWorkSpacePath () {
154
- return getDestinationPath (this .getPackageP ().getJavaProject ().getParent ());
151
+ @ SuppressWarnings ("unused" )
152
+ private Path getDestinationWorkspacePath () {
153
+ return getEntryPointFileDestinationPath (this .getPackageP ().getJavaProject ().getParent ());
155
154
}
156
155
157
- private Path getDestinationPath (IJavaElement element ) {
158
- return Paths .get (element .getResource ().getLocation ().toString () + File .separator + ENTRY_POINT_FILE );
156
+ /**
157
+ * Returns the path of where the entry points file should be copied relative to
158
+ * the given {@link IJavaElement}.
159
+ *
160
+ * @param element
161
+ * The {@link IJavaElement} in question.
162
+ * @return The {@link Path} where the entry points file should be copied
163
+ * relative to the given {@link IJavaElement}.
164
+ */
165
+ private static Path getEntryPointFileDestinationPath (IJavaElement element ) {
166
+ return Paths .get (element .getResource ().getLocation ().toString () + File .separator + ENTRY_POINT_FILENAME );
159
167
}
160
168
161
169
@ Override
162
170
protected void setUp () throws Exception {
163
171
super .setUp ();
164
172
165
173
// this is the source path.
166
- Path absoluteProjectPath = getAbsoluteProjectPath ();
174
+ Path entryPointFileProjectSourcePath = getEntryPointFileProjectSourcePath ();
175
+ Path entryPointFileProjectDestinationPath = getEntryPointFileProjectDestinationPath ();
167
176
168
177
// TODO: we also need to copy entry_points.txt to workspace directory here
169
178
// something like copyEntryPointFile(absoluteProjectPath,
170
179
// getDestinationWorkSpacePath())
171
- if (copyEntryPointFile (absoluteProjectPath , getDestinationProjectPath () ))
172
- LOGGER .info (() -> "Copy entry_points.txt successfully" );
180
+ if (copyEntryPointFile (entryPointFileProjectSourcePath , entryPointFileProjectDestinationPath ))
181
+ LOGGER .info ("Copied " + ENTRY_POINT_FILENAME + " successfully. " );
173
182
else
174
- LOGGER .info (() -> "entry_points.txt does not exist" );
183
+ LOGGER .info (ENTRY_POINT_FILENAME + " does not exist. " );
175
184
}
176
185
177
186
/**
178
- * Copy entry_points.txt from cuurent directory to the corresponding directory
187
+ * Copy entry_points.txt from current directory to the corresponding directory
179
188
* in junit-workspace
180
189
*
181
190
* @return true: copy successfully / false: the source file does not exist
@@ -418,7 +427,7 @@ protected void tearDown() throws Exception {
418
427
final boolean pExists = getPackageP ().exists ();
419
428
420
429
// this is destination path.
421
- Path destinationProjectPath = getDestinationProjectPath ();
430
+ Path destinationProjectPath = getEntryPointFileProjectDestinationPath ();
422
431
423
432
if (getEntryPointFile (destinationProjectPath ) != null )
424
433
Files .delete (destinationProjectPath );
@@ -809,8 +818,7 @@ public void testWithoutEntryPoint() throws Exception {
809
818
}
810
819
811
820
/**
812
- * Test #172.
813
- * This is a control group for testing entry point file.
821
+ * Test #172. This is a control group for testing entry point file.
814
822
*/
815
823
public void testEntryPointFile () throws Exception {
816
824
helper (new StreamAnalysisExpectedResult ("h1.stream()" , Collections .singleton (ExecutionMode .SEQUENTIAL ),
@@ -820,8 +828,7 @@ public void testEntryPointFile() throws Exception {
820
828
}
821
829
822
830
/**
823
- * Test #172.
824
- * Test correct entry point file.
831
+ * Test #172. Test correct entry point file.
825
832
*/
826
833
public void testEntryPointFile1 () throws Exception {
827
834
helper (new StreamAnalysisExpectedResult ("h1.stream()" , Collections .singleton (ExecutionMode .SEQUENTIAL ),
@@ -831,8 +838,8 @@ public void testEntryPointFile1() throws Exception {
831
838
}
832
839
833
840
/**
834
- * Test #172.
835
- * Test entry point file which is not corresponding to the source code.
841
+ * Test #172. Test entry point file which is not corresponding to the source
842
+ * code.
836
843
*/
837
844
public void testEntryPointFile2 () throws Exception {
838
845
helper (new StreamAnalysisExpectedResult ("h1.stream()" , null , null , false , false , false , null , null , null ,
0 commit comments