Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nelson Tavares de Sousa
TeeTime-Framework
Commits
32c48cbc
Commit
32c48cbc
authored
10 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
switched from readConfig to Files.readLines
parent
07c14928
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java
+7
-14
7 additions, 14 deletions
...st/java/teetime/framework/pipe/PipeFactoryLoaderTest.java
with
7 additions
and
14 deletions
src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java
+
7
−
14
View file @
32c48cbc
...
@@ -13,6 +13,9 @@ import org.junit.Test;
...
@@ -13,6 +13,9 @@ import org.junit.Test;
import
teetime.util.classpath.ClassForNameResolver
;
import
teetime.util.classpath.ClassForNameResolver
;
import
com.google.common.base.Charsets
;
import
com.google.common.io.Files
;
public
class
PipeFactoryLoaderTest
{
public
class
PipeFactoryLoaderTest
{
@Test
@Test
...
@@ -37,8 +40,8 @@ public class PipeFactoryLoaderTest {
...
@@ -37,8 +40,8 @@ public class PipeFactoryLoaderTest {
files
.
add
(
pipeConfig
.
toURI
().
toURL
());
files
.
add
(
pipeConfig
.
toURI
().
toURL
());
List
<
IPipeFactory
>
pipeFactories
=
PipeFactoryLoader
.
mergeFiles
(
files
);
List
<
IPipeFactory
>
pipeFactories
=
PipeFactoryLoader
.
mergeFiles
(
files
);
Array
List
<
String
>
contents
=
readConf
(
pipeConfig
);
List
<
String
>
contents
=
Files
.
readLines
(
pipeConfig
,
Charsets
.
UTF_8
);
contents
.
addAll
(
readConf
(
testConfig
));
contents
.
addAll
(
Files
.
readLines
(
testConfig
,
Charsets
.
UTF_8
));
// Check if all read factories are contained in one of the files
// Check if all read factories are contained in one of the files
for
(
IPipeFactory
iPipeFactory
:
pipeFactories
)
{
for
(
IPipeFactory
iPipeFactory
:
pipeFactories
)
{
...
@@ -50,13 +53,13 @@ public class PipeFactoryLoaderTest {
...
@@ -50,13 +53,13 @@ public class PipeFactoryLoaderTest {
ClassForNameResolver
<
IPipeFactory
>
classResolver
=
new
ClassForNameResolver
<
IPipeFactory
>(
IPipeFactory
.
class
);
ClassForNameResolver
<
IPipeFactory
>
classResolver
=
new
ClassForNameResolver
<
IPipeFactory
>(
IPipeFactory
.
class
);
// Look for the "normal" pipes
// Look for the "normal" pipes
for
(
String
className
:
readConf
(
pipeConfig
))
{
for
(
String
className
:
Files
.
readLines
(
pipeConfig
,
Charsets
.
UTF_8
))
{
IPipeFactory
pipeFactory
=
classResolver
.
classForName
(
className
).
newInstance
();
IPipeFactory
pipeFactory
=
classResolver
.
classForName
(
className
).
newInstance
();
IPipeFactory
returnedFactory
=
pipeRegistry
.
getPipeFactory
(
pipeFactory
.
getThreadCommunication
(),
pipeFactory
.
getOrdering
(),
pipeFactory
.
isGrowable
());
IPipeFactory
returnedFactory
=
pipeRegistry
.
getPipeFactory
(
pipeFactory
.
getThreadCommunication
(),
pipeFactory
.
getOrdering
(),
pipeFactory
.
isGrowable
());
Assert
.
assertEquals
(
pipeFactory
.
getClass
().
getCanonicalName
(),
returnedFactory
.
getClass
().
getCanonicalName
());
Assert
.
assertEquals
(
pipeFactory
.
getClass
().
getCanonicalName
(),
returnedFactory
.
getClass
().
getCanonicalName
());
}
}
// Second "and a half" part
// Second "and a half" part
for
(
String
className
:
readConf
(
testConfig
))
{
for
(
String
className
:
Files
.
readLines
(
testConfig
,
Charsets
.
UTF_8
))
{
IPipeFactory
pipeFactory
=
classResolver
.
classForName
(
className
).
newInstance
();
IPipeFactory
pipeFactory
=
classResolver
.
classForName
(
className
).
newInstance
();
// Still old factory
// Still old factory
IPipeFactory
returnedFactory
=
pipeRegistry
.
getPipeFactory
(
pipeFactory
.
getThreadCommunication
(),
pipeFactory
.
getOrdering
(),
pipeFactory
.
isGrowable
());
IPipeFactory
returnedFactory
=
pipeRegistry
.
getPipeFactory
(
pipeFactory
.
getThreadCommunication
(),
pipeFactory
.
getOrdering
(),
pipeFactory
.
isGrowable
());
...
@@ -81,14 +84,4 @@ public class PipeFactoryLoaderTest {
...
@@ -81,14 +84,4 @@ public class PipeFactoryLoaderTest {
return
lines
;
return
lines
;
}
}
private
ArrayList
<
String
>
readConf
(
final
File
fileName
)
throws
IOException
{
BufferedReader
fileReader
=
new
BufferedReader
(
new
FileReader
(
fileName
));
ArrayList
<
String
>
list
=
new
ArrayList
<
String
>();
String
line
;
while
((
line
=
fileReader
.
readLine
())
!=
null
)
{
list
.
add
(
line
);
}
fileReader
.
close
();
return
list
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment