Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
synergy-api-util
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raimbek Egemberdiev
synergy-api-util
Commits
7592ec7c
Commit
7592ec7c
authored
Nov 12, 2016
by
Abzal Kultayev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TASK #CMER] Запись УРЛ файла в реестр
parent
47582db0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
src/main/java/kz/arta/synergy/api/services/StorageService.java
...ain/java/kz/arta/synergy/api/services/StorageService.java
+37
-0
src/test/java/kz/arta/synergy/api/services/StorageServiceTest.java
...java/kz/arta/synergy/api/services/StorageServiceTest.java
+21
-0
No files found.
src/main/java/kz/arta/synergy/api/services/StorageService.java
0 → 100644
View file @
7592ec7c
package
kz.arta.synergy.api.services
;
import
kz.arta.synergy.api.JsonUtils
;
import
kz.arta.synergy.api.Query
;
import
kz.arta.synergy.api.QueryContext
;
import
kz.arta.synergy.api.RestHttpQuery
;
import
java.io.IOException
;
/**
* Created by: Abzal Kultayev
* Date: 12.11.16
* Time: 16:37
*/
public
class
StorageService
{
private
final
RestHttpQuery
restHttpQuery
;
private
StorageService
(
QueryContext
context
)
{
this
.
restHttpQuery
=
new
RestHttpQuery
(
context
);
}
public
static
StorageService
newInstance
(
QueryContext
context
)
{
return
new
StorageService
(
context
);
}
/**
* Создает временный файл на сервере
* @return Возвращает путь временного файла на сервере
* @throws IOException
*/
public
String
startUploadFile
()
throws
IOException
{
Query
query
=
Query
.
newInstance
().
url
(
"/rest/api/storage/start_upload"
);
String
result
=
restHttpQuery
.
doQuery
(
query
);
return
JsonUtils
.
getValueByKey
(
result
,
"file"
);
}
}
src/test/java/kz/arta/synergy/api/services/StorageServiceTest.java
0 → 100644
View file @
7592ec7c
package
kz.arta.synergy.api.services
;
import
kz.arta.synergy.api.QueryContext
;
import
org.testng.annotations.Test
;
import
static
org
.
testng
.
Assert
.*;
/**
* Created by: Abzal Kultayev
* Date: 12.11.16
* Time: 16:56
*/
public
class
StorageServiceTest
{
StorageService
service
=
StorageService
.
newInstance
(
new
QueryContext
(
"http://192.168.3.233:8080/Synergy"
,
"NppAdmin"
,
"123456"
));
@Test
public
void
testStartUploadFile
()
throws
Exception
{
String
tempFileName
=
service
.
startUploadFile
();
assertNotNull
(
tempFileName
);
}
}
\ 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