This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
ae882025
Commit
ae882025
authored
2 years ago
by
Daniel Crazzolara
Browse files
Options
Downloads
Patches
Plain Diff
Fixed previous tests
parent
b8079128
2 merge requests
!110
HotFix Artemis
,
!109
Bugfix: Fix Sharing import/export with Artemis
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/at/ac/uibk/gitsearch/service/ExerciseServiceIT.java
+10
-9
10 additions, 9 deletions
.../java/at/ac/uibk/gitsearch/service/ExerciseServiceIT.java
with
10 additions
and
9 deletions
src/test/java/at/ac/uibk/gitsearch/service/ExerciseServiceIT.java
+
10
−
9
View file @
ae882025
...
@@ -12,6 +12,7 @@ import java.io.FileWriter;
...
@@ -12,6 +12,7 @@ import java.io.FileWriter;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FileUtils
;
...
@@ -58,8 +59,8 @@ public class ExerciseServiceIT {
...
@@ -58,8 +59,8 @@ public class ExerciseServiceIT {
@After
@After
public
void
cleanUp
()
throws
IOException
{
public
void
cleanUp
()
throws
IOException
{
if
(
new
File
(
"tmp-import/"
,
token
).
exists
())
{
if
(
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)
,
token
).
exists
())
{
FileUtils
.
deleteDirectory
(
new
File
(
"tmp-import/"
+
token
));
FileUtils
.
deleteDirectory
(
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)
+
token
));
}
}
}
}
...
@@ -67,29 +68,29 @@ public class ExerciseServiceIT {
...
@@ -67,29 +68,29 @@ public class ExerciseServiceIT {
public
void
testImportExercise
()
throws
Exception
{
public
void
testImportExercise
()
throws
Exception
{
int
gitlabGroup
=
1
;
int
gitlabGroup
=
1
;
File
metadata
=
new
File
(
"tmp-import/"
+
token
,
"Exercise-Details-something.json"
);
File
metadata
=
Paths
.
get
(
System
.
getProperty
(
"java.io.tmpdir"
),
token
,
"Exercise-Details-something.json"
)
.
toFile
()
;
metadata
.
getParentFile
().
mkdirs
();
metadata
.
getParentFile
().
mkdirs
();
metadata
.
createNewFile
();
metadata
.
createNewFile
();
Group
group
=
new
Group
();
Group
group
=
new
Group
();
Repository
jgitRepo
=
FileRepositoryBuilder
.
create
(
new
File
(
"tmp-import/"
+
token
,
".git"
));
Repository
jgitRepo
=
FileRepositoryBuilder
.
create
(
Paths
.
get
(
System
.
getProperty
(
"java.io.tmpdir"
),
token
,
".git"
)
.
toFile
()
);
// mocks
// mocks
doNothing
().
when
(
gitlabService
).
setJGitDefaultAuth
();
doNothing
().
when
(
gitlabService
).
setJGitDefaultAuth
();
doReturn
(
group
).
when
(
gitlabService
).
getGroupById
(
gitlabGroup
);
doReturn
(
group
).
when
(
gitlabService
).
getGroupById
(
gitlabGroup
);
doReturn
(
"repoUrl"
).
when
(
gitlabService
).
createRepository
(
group
,
artemisExerciseInfo
.
getTitle
());
doReturn
(
"repoUrl"
).
when
(
gitlabService
).
createRepository
(
group
,
artemisExerciseInfo
.
getTitle
());
doReturn
(
jgitRepo
).
when
(
gitlabService
).
checkoutRepo
(
"repoUrl"
);
doReturn
(
jgitRepo
).
when
(
gitlabService
).
checkoutRepo
(
"repoUrl"
);
doNothing
().
when
(
gitlabService
).
commitAndPushToRepo
(
jgitRepo
,
new
File
(
"tmp-import"
,
token
));
doNothing
().
when
(
gitlabService
).
commitAndPushToRepo
(
jgitRepo
,
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)
,
token
));
exerciseService
.
importExercise
(
artemisExerciseInfo
,
token
,
gitlabGroup
);
exerciseService
.
importExercise
(
artemisExerciseInfo
,
token
,
gitlabGroup
);
// asserts
// asserts
verify
(
gitlabService
,
times
(
1
)).
createRepository
(
group
,
artemisExerciseInfo
.
getTitle
());
verify
(
gitlabService
,
times
(
1
)).
createRepository
(
group
,
artemisExerciseInfo
.
getTitle
());
verify
(
gitlabService
,
times
(
1
)).
commitAndPushToRepo
(
jgitRepo
,
new
File
(
"tmp-import"
,
token
));
verify
(
gitlabService
,
times
(
1
)).
commitAndPushToRepo
(
jgitRepo
,
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)
,
token
));
}
}
@Test
@Test
public
void
testApplyExerciseInfoChanges
()
throws
Exception
{
public
void
testApplyExerciseInfoChanges
()
throws
Exception
{
File
metadata
=
new
File
(
"tmp-import/"
+
token
,
"metadata.yaml"
);
File
metadata
=
Paths
.
get
(
System
.
getProperty
(
"java.io.tmpdir"
),
token
,
"metadata.yaml"
)
.
toFile
()
;
metadata
.
getParentFile
().
mkdirs
();
metadata
.
getParentFile
().
mkdirs
();
metadata
.
createNewFile
();
metadata
.
createNewFile
();
...
@@ -103,7 +104,7 @@ public class ExerciseServiceIT {
...
@@ -103,7 +104,7 @@ public class ExerciseServiceIT {
@Test
@Test
public
void
testGetArtemisExerciseInfo
()
throws
Exception
{
public
void
testGetArtemisExerciseInfo
()
throws
Exception
{
File
metadata
=
new
File
(
"tmp-import/"
+
token
,
"Exercise-Details-something.json"
);
File
metadata
=
Paths
.
get
(
System
.
getProperty
(
"java.io.tmpdir"
),
token
,
"Exercise-Details-something.json"
)
.
toFile
()
;
metadata
.
getParentFile
().
mkdirs
();
metadata
.
getParentFile
().
mkdirs
();
metadata
.
createNewFile
();
metadata
.
createNewFile
();
FileWriter
writer
=
new
FileWriter
(
metadata
,
StandardCharsets
.
UTF_8
);
FileWriter
writer
=
new
FileWriter
(
metadata
,
StandardCharsets
.
UTF_8
);
...
@@ -145,7 +146,7 @@ public class ExerciseServiceIT {
...
@@ -145,7 +146,7 @@ public class ExerciseServiceIT {
@Test
@Test
public
void
testGetArtemisExerciseInfo_onlyMetadata
()
throws
Exception
{
public
void
testGetArtemisExerciseInfo_onlyMetadata
()
throws
Exception
{
File
metadata
=
new
File
(
"tmp-import/"
+
token
,
"Exercise-Details-something.json"
);
File
metadata
=
Paths
.
get
(
System
.
getProperty
(
"java.io.tmpdir"
),
token
,
"Exercise-Details-something.json"
)
.
toFile
()
;
metadata
.
getParentFile
().
mkdirs
();
metadata
.
getParentFile
().
mkdirs
();
metadata
.
createNewFile
();
metadata
.
createNewFile
();
FileWriter
writer
=
new
FileWriter
(
metadata
,
StandardCharsets
.
UTF_8
);
FileWriter
writer
=
new
FileWriter
(
metadata
,
StandardCharsets
.
UTF_8
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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