Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
template-engine
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Wulf
template-engine
Commits
f75d4145
Commit
f75d4145
authored
Nov 28, 2012
by
Christian Wulf
Browse files
Options
Downloads
Patches
Plain Diff
fixed isBinaryFile
parent
47971bc8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/de/chw/css/script/ProductLineTemplateEngine.java
+2
-2
2 additions, 2 deletions
src/de/chw/css/script/ProductLineTemplateEngine.java
test/de/chw/css/script/ProductLineTemplateEngineTest.java
+12
-3
12 additions, 3 deletions
test/de/chw/css/script/ProductLineTemplateEngineTest.java
with
14 additions
and
5 deletions
src/de/chw/css/script/ProductLineTemplateEngine.java
+
2
−
2
View file @
f75d4145
...
...
@@ -16,7 +16,7 @@ public class ProductLineTemplateEngine {
// patterns for predicate and corresponding generate methods
private
static
final
String
BINARY_FILENAME_PATTERN
=
"_template_default\\.(\\w+)\\z"
;
private
String
chosenProduct
;
private
final
String
chosenProduct
;
public
ProductLineTemplateEngine
(
String
chosenProduct
)
{
this
.
chosenProduct
=
chosenProduct
;
...
...
@@ -31,7 +31,7 @@ public class ProductLineTemplateEngine {
}
public
boolean
isBinaryFile
(
File
file
)
{
return
file
.
getName
().
matches
(
BINARY_FILENAME_PATTERN
);
return
file
.
getName
().
matches
(
".*"
+
BINARY_FILENAME_PATTERN
);
}
public
void
generateBinaryFile
(
File
file
)
throws
IOException
{
...
...
This diff is collapsed.
Click to expand it.
test/de/chw/css/script/ProductLineTemplateEngineTest.java
+
12
−
3
View file @
f75d4145
package
de.chw.css.script
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
fail
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -9,11 +11,11 @@ import org.junit.Test;
public
class
ProductLineTemplateEngineTest
{
private
void
testGenerateBinaryFile
(
String
filenameToSearchFor
,
String
g
eneratedFilename
)
throws
IOException
{
private
void
testGenerateBinaryFile
(
String
filenameToSearchFor
,
String
expectedG
eneratedFilename
)
throws
IOException
{
ProductLineTemplateEngine
engine
=
new
ProductLineTemplateEngine
(
"fm"
);
engine
.
generateBinaryFile
(
new
File
(
filenameToSearchFor
));
File
generatedFile
=
new
File
(
g
eneratedFilename
);
File
generatedFile
=
new
File
(
expectedG
eneratedFilename
);
assertTrue
(
generatedFile
.
exists
());
// clean up
generatedFile
.
delete
();
...
...
@@ -24,6 +26,13 @@ public class ProductLineTemplateEngineTest {
testGenerateBinaryFile
(
"resource/logo_template_default.png"
,
"resource/logo.png"
);
}
@Test
public
void
testIsBinaryFile
()
throws
IOException
{
ProductLineTemplateEngine
engine
=
new
ProductLineTemplateEngine
(
"fm"
);
assertTrue
(
engine
.
isBinaryFile
(
new
File
(
"resource/logo_template_default.png"
)));
assertFalse
(
engine
.
isBinaryFile
(
new
File
(
"resource/DataSource.groovy"
)));
}
@Test
public
void
testGenerateBuildConfig
()
throws
IOException
{
testGenerateBinaryFile
(
"resource/BootStrap_template_default.groovy"
,
"resource/BootStrap.groovy"
);
...
...
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