Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aliyun-oss-uploader
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
aliyun-oss-uploader
Commits
0f0f47e0
Unverified
Commit
0f0f47e0
authored
Jun 08, 2019
by
raylax
Committed by
GitHub
Jun 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete OSSPublisherTest.java
parent
fb1a65a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
90 deletions
+0
-90
src/test/java/org/inurl/jenkins/plugin/OSSPublisherTest.java
src/test/java/org/inurl/jenkins/plugin/OSSPublisherTest.java
+0
-90
No files found.
src/test/java/org/inurl/jenkins/plugin/OSSPublisherTest.java
deleted
100644 → 0
View file @
fb1a65a1
package
org.inurl.jenkins.plugin
;
import
com.aliyun.oss.OSSClient
;
import
hudson.model.FreeStyleBuild
;
import
hudson.model.FreeStyleProject
;
import
hudson.tasks.Shell
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.jvnet.hudson.test.JenkinsRule
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
class
OSSPublisherTest
{
@Rule
public
JenkinsRule
jenkins
=
new
JenkinsRule
();
private
final
String
name
=
"Test"
;
private
final
String
endpoint
=
System
.
getenv
(
"OSS_ENDPOINT"
);
private
final
String
accessKeyId
=
System
.
getenv
(
"OSS_ACCESS_KEY_ID"
);
private
final
String
accessKeySecret
=
System
.
getenv
(
"OSS_ACCESS_KEY_SECRET"
);
private
final
String
bucketName
=
System
.
getenv
(
"OSS_BUCKET_NAME"
);
private
final
String
maxRetries
=
"10"
;
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
System
.
getenv
(
"os"
).
contains
(
"Windows"
));
}
@Test
public
void
testOSS
()
{
OSSClient
client
=
new
OSSClient
(
endpoint
,
accessKeyId
,
accessKeySecret
);
client
.
getBucketInfo
(
bucketName
);
assertTrue
(
true
);
}
@Test
public
void
testConfigRoundtrip
()
throws
Exception
{
FreeStyleProject
project
=
jenkins
.
createFreeStyleProject
(
name
);
String
localPath
=
"/"
;
String
remotePath
=
"/"
;
project
.
getPublishersList
().
add
(
new
OSSPublisher
(
endpoint
,
accessKeyId
,
accessKeySecret
,
bucketName
,
localPath
,
remotePath
,
maxRetries
));
project
=
jenkins
.
configRoundtrip
(
project
);
jenkins
.
assertEqualDataBoundBeans
(
new
OSSPublisher
(
endpoint
,
accessKeyId
,
accessKeySecret
,
bucketName
,
localPath
,
remotePath
,
maxRetries
),
project
.
getPublishersList
().
get
(
0
));
}
@Test
public
void
testBuildDir
()
throws
Exception
{
FreeStyleProject
project
=
jenkins
.
createFreeStyleProject
(
name
);
Shell
shell
=
createFileShell
();
project
.
getBuildersList
().
add
(
shell
);
project
.
getPublishersList
().
add
(
new
OSSPublisher
(
endpoint
,
accessKeyId
,
accessKeySecret
,
bucketName
,
"/"
,
"/"
,
maxRetries
));
FreeStyleBuild
build
=
jenkins
.
buildAndAssertSuccess
(
project
);
jenkins
.
assertLogContains
(
"upload dir success"
,
build
);
}
@Test
public
void
testBuildFile
()
throws
Exception
{
FreeStyleProject
project
=
jenkins
.
createFreeStyleProject
(
name
);
project
.
getPublishersList
().
add
(
new
OSSPublisher
(
endpoint
,
accessKeyId
,
accessKeySecret
,
bucketName
,
"/n/3"
,
"/remoteFile"
,
maxRetries
));
FreeStyleBuild
build
=
jenkins
.
buildAndAssertSuccess
(
project
);
jenkins
.
assertLogContains
(
"upload file success"
,
build
);
}
private
static
Shell
createFileShell
()
{
//language=Bash
String
del
=
"if [[ -e \"a\" ]];then rm -f a fi\n"
+
"if [[ -e \"b\" ]];then rm -f b fi\n"
+
"if [[ -e \"c\" ]];then rm -f c fi\n"
+
"if [[ -e \"n/1\" ]];then rm -f n/1 fi\n"
+
"if [[ -e \"n/2\" ]];then rm -f n/2 fi\n"
+
"if [[ -e \"n/3\" ]];then rm -f n/3 fi\n"
;
//language=Bash
String
create
=
"echo a > a\n"
+
"echo b > b\n"
+
"echo c > c\n"
+
"mkdir n\n"
+
"echo 1 > n/1\n"
+
"echo 2 > n/2\n"
+
"echo 3 > n/3"
;
return
new
Shell
(
del
+
"\n"
+
create
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment