19
19
20
20
import jakarta .persistence .EntityManagerFactory ;
21
21
22
- import java .io .FileOutputStream ;
23
22
import java .io .IOException ;
24
23
import java .io .InputStreamReader ;
25
24
import java .io .Reader ;
26
25
import java .nio .charset .StandardCharsets ;
26
+ import java .nio .file .Files ;
27
27
import java .nio .file .Path ;
28
28
import java .util .Properties ;
29
29
30
30
import javax .sql .DataSource ;
31
31
32
32
import org .junit .jupiter .api .AfterAll ;
33
- import org .junit .jupiter .api .BeforeEach ;
33
+ import org .junit .jupiter .api .BeforeAll ;
34
34
import org .junit .jupiter .api .Test ;
35
35
import org .junit .jupiter .api .extension .ExtendWith ;
36
36
import org .springframework .beans .factory .annotation .Autowired ;
58
58
import org .springframework .transaction .PlatformTransactionManager ;
59
59
import org .springframework .transaction .annotation .Transactional ;
60
60
import org .springframework .util .FileCopyUtils ;
61
- import org .springframework .util .FileSystemUtils ;
62
61
63
62
/**
64
63
* Verify that {@link Meta}-annotated methods properly embed comments into EclipseLink queries.
65
64
*
66
65
* @author Greg Turnquist
66
+ * @author Edoardo Patti
67
67
* @since 3.0
68
68
*/
69
69
@ ExtendWith (SpringExtension .class )
@@ -74,16 +74,19 @@ class EclipseLinkMetaAnnotatedQueryMethodIntegrationTests {
74
74
@ Autowired RoleRepositoryWithMeta repository ;
75
75
76
76
private static final ResourceLoader RESOURCE_LOADER = new DefaultResourceLoader ();
77
- private static final String LOG_FILE = "test-eclipselink-meta.log" ;
77
+ private static String LOG_FILE ;
78
78
79
- @ BeforeEach
80
- void cleanoutLogfile () throws IOException {
81
- new FileOutputStream (LOG_FILE ).close ();
79
+ private static Path logFile ;
80
+
81
+ @ BeforeAll
82
+ static void createLogfile () throws IOException {
83
+ logFile = Files .createTempFile ("test-eclipselink-meta" , ".log" );
84
+ LOG_FILE = logFile .toAbsolutePath ().toString ();
82
85
}
83
86
84
87
@ AfterAll
85
- static void deleteLogfile () throws IOException {
86
- FileSystemUtils . deleteRecursively ( Path . of ( LOG_FILE ) );
88
+ static void deleteLogFile () {
89
+ logFile . toFile (). deleteOnExit ( );
87
90
}
88
91
89
92
@ Test // GH-775
0 commit comments