Compare commits
32 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a2fc218e1d | ||
![]() |
2fbfb9e218 | ||
![]() |
457c245fe5 | ||
![]() |
1ca0ea5069 | ||
![]() |
05b1827450 | ||
![]() |
c663dd5050 | ||
![]() |
2ede4c231c | ||
![]() |
584349e931 | ||
![]() |
5b66b6723c | ||
![]() |
6f88238309 | ||
![]() |
23e8ef5b1f | ||
![]() |
8bee24167c | ||
![]() |
199d122038 | ||
![]() |
4c7a65816d | ||
![]() |
f51df72704 | ||
![]() |
4f794b5bca | ||
![]() |
a50e07535c | ||
![]() |
618fa237d0 | ||
![]() |
75ba178cee | ||
![]() |
cdaf81b99d | ||
![]() |
80328999bc | ||
![]() |
2c5ef6ce29 | ||
![]() |
097d6f2d4e | ||
![]() |
18f679ff6e | ||
![]() |
501b0e4760 | ||
![]() |
f8308dff09 | ||
![]() |
217e70403b | ||
![]() |
c604474acf | ||
![]() |
2d51032d0f | ||
![]() |
04ee63a569 | ||
![]() |
82e362cacd | ||
![]() |
08d9db12aa |
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -80,4 +80,5 @@ fabric.properties
|
|||
.idea/sonarlint
|
||||
|
||||
|
||||
# End of https://www.gitignore.io/api/intellij
|
||||
# End of https://www.gitignore.io/api/intellij
|
||||
target/
|
||||
|
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
1064
.idea/workspace.xml
Normal file
1064
.idea/workspace.xml
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
30
pom.xml
30
pom.xml
|
@ -8,6 +8,8 @@
|
|||
<artifactId>java-api</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
|
@ -34,6 +36,10 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</dependency>
|
||||
<!-- ***** -->
|
||||
|
||||
<!-- LOGGER AND TEST DEPENDENCIES -->
|
||||
|
@ -56,8 +62,29 @@
|
|||
<version>1.60</version>
|
||||
</dependency>
|
||||
<!-- ***** -->
|
||||
|
||||
<!-- ORMLITE - POSTGRE -->
|
||||
<dependency>
|
||||
<groupId>com.j256.ormlite</groupId>
|
||||
<artifactId>ormlite-core</artifactId>
|
||||
<version>5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.j256.ormlite</groupId>
|
||||
<artifactId>ormlite-jdbc</artifactId>
|
||||
<version>5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.5</version>
|
||||
</dependency>
|
||||
<!-- ***** -->
|
||||
</dependencies>
|
||||
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
@ -67,6 +94,9 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<executable>true</executable>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
387
postman/JAVA-API.postman_collection.json
Normal file
387
postman/JAVA-API.postman_collection.json
Normal file
|
@ -0,0 +1,387 @@
|
|||
{
|
||||
"info": {
|
||||
"_postman_id": "6f868823-1ce1-4139-ba21-60eca129d008",
|
||||
"name": "JAVA-API",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||
},
|
||||
"item": [
|
||||
{
|
||||
"name": "Transaction",
|
||||
"item": [
|
||||
{
|
||||
"name": "getTransaction",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/transaction/get?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG&transactionHash=TESTGFJDOOJI3285941981FDSDSFSSDGxxdsfz",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"get"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
},
|
||||
{
|
||||
"key": "transactionHash",
|
||||
"value": "TESTGFJDOOJI3285941981FDSDSFSSDGxxdsfz"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "getLatestTransaction",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/transaction/getLatest?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"getLatest"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "getAllTransaction",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/transaction/getAll?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"getAll"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "saveTransaction",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\r\n\t\"transactionFrom\":\"$2a$10$jviPGl4mc1nGOp4hZUyOmeFqFWlQB7mvFToWPGUiq8W5Z1LZP3e4C\",\r\n\t\"transactionTo\":\"$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG\",\r\n\t\"transactionHash\":\"TESTGFJDOOJI3285941981FDSDSFSSDGxxdsfz\",\r\n\t\"transactionAmount\":1.50,\r\n\t\"transactionUnit\":\"Gonettes\"\r\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/transaction/save",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"save"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "sentTransactions",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/transaction/sent?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"sent"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "receivedTransaction",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/transaction/received?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"received"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Server",
|
||||
"item": [
|
||||
{
|
||||
"name": "get sent transactions",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://37.187.101.44:10053/api/rest/transaction/sent?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"37",
|
||||
"187",
|
||||
"101",
|
||||
"44"
|
||||
],
|
||||
"port": "10053",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"transaction",
|
||||
"sent"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FirstTest",
|
||||
"item": [
|
||||
{
|
||||
"name": "getBalance",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": ""
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:10053/api/rest/query/balance?userHash=$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "10053",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"query",
|
||||
"balance"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "userHash",
|
||||
"value": "$2a$10$tEogSW32MJQGqt1qO8MZB.rONrEDjKD9u8szelMpZSAUzlt7rEYOG"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Login",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n\t\"email\":\"thomas.marshal@gmal.com\",\n\t\"password\":\"newPassword\"\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:10053/api/rest/user/login",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "10053",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"user",
|
||||
"login"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "Register",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n\t\"name\":\"Clara\",\n\t\"firstname\":\"Sophie\",\n\t\"email\":\"sophie.clara@gmail.com\",\n\t\"password\":\"sophieClara\"\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/user/save",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"user",
|
||||
"save"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "getUser",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"header": [
|
||||
{
|
||||
"key": "Content-Type",
|
||||
"name": "Content-Type",
|
||||
"value": "application/json",
|
||||
"type": "text"
|
||||
}
|
||||
],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\n\t\"email\":\"thomas.marshal@gmail.com\",\n\t\"password\":\"newPassword\"\n}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "http://localhost:8083/api/rest/user/get",
|
||||
"protocol": "http",
|
||||
"host": [
|
||||
"localhost"
|
||||
],
|
||||
"port": "8083",
|
||||
"path": [
|
||||
"api",
|
||||
"rest",
|
||||
"user",
|
||||
"get"
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package Application;
|
||||
package application;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
@ -9,11 +9,11 @@ import org.springframework.context.annotation.Bean;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = {"restService"})
|
||||
public class App {
|
||||
public static void main(String [ ] args){
|
||||
SpringApplication app = new SpringApplication(App.class);
|
||||
app.setDefaultProperties(Collections.singletonMap("server.port","8083"));
|
||||
app.setDefaultProperties(Collections.singletonMap("server.port","10053"));
|
||||
app.run(args);
|
||||
}
|
||||
|
|
@ -56,7 +56,9 @@ public class ChannelClientWrapper {
|
|||
|
||||
channel = channelClientWrapper.getChannel();
|
||||
Peer peer = fabricClientWrapper.getClient().newPeer(Config.ORG1_PEER_0,Config.ORG1_PEER_0_URL);
|
||||
EventHub eventHub = fabricClientWrapper.getClient().newEventHub("eventhub01", "grpc://vps577432.ovh.net:8053");
|
||||
//EventHub eventHub = fabricClientWrapper.getClient().newEventHub("eventhub01", "grpc://vps577432.ovh.net:8053");
|
||||
EventHub eventHub = fabricClientWrapper.getClient().newEventHub("eventhub01", "grpc://93.30.148.59:7051");
|
||||
//EventHub eventHub = fabricClientWrapper.getClient().newEventHub("eventhub01", "grpc://vps592802.ovh.net:7053");
|
||||
Orderer orderer = fabricClientWrapper.getClient().newOrderer(Config.ORDERER_NAME,Config.ORDERER_URL);
|
||||
channel.addPeer(peer);
|
||||
channel.addEventHub(eventHub);
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package blockchain.configuration;
|
||||
|
||||
public class Config {
|
||||
//TEST
|
||||
public static final String u2 = "woEXRrZdwXiu";
|
||||
|
||||
//ORGANIZATION
|
||||
public static final String ORG1_MSP = "Org1MSP";
|
||||
|
||||
public static final String ORG1 = "org1";
|
||||
public static final String ORG1 = "Org1";
|
||||
|
||||
//ADMIN
|
||||
public static final String ADMIN = "admin";
|
||||
|
@ -13,25 +15,38 @@ public class Config {
|
|||
public static final String ADMIN_PASSWORD = "adminpw";
|
||||
|
||||
//USER
|
||||
public static final String UserPWD = "ZIidLJHQbLcC";
|
||||
//public static final String UserPWD = "ZIidLJHQbLcC";
|
||||
public static final String UserPWD = "OelXVCdHnYPe";
|
||||
|
||||
|
||||
|
||||
//CA
|
||||
public static final String CA_ORG1_URL = "http://vps577432.ovh.net:7054";
|
||||
//public static final String CA_ORG1_URL = "http://vps577432.ovh.net:7054";
|
||||
public static final String CA_ORG1_URL = "http://93.30.148.59:7054";
|
||||
//public static final String CA_ORG1_URL = "http://vps592802.ovh.net:7054";
|
||||
|
||||
//ORDERER
|
||||
public static final String ORDERER_URL = "grpc://vps577432.ovh.net:7050";
|
||||
//public static final String ORDERER_URL = "grpc://vps577432.ovh.net:7050";
|
||||
public static final String ORDERER_URL = "grpc://93.30.148.59:7050";
|
||||
//public static final String ORDERER_URL = "grpc://vps592802.ovh.net:7050";
|
||||
|
||||
public static final String ORDERER_NAME = "orderer.example.com";
|
||||
|
||||
//CHANNEL - CHAINCODE
|
||||
public static final String CHANNEL_NAME = "mychannel";
|
||||
|
||||
public static final String CHAINCODE_NAME = "mycc";
|
||||
//public static final String CHAINCODE_NAME = "mycc";
|
||||
public static final String CHAINCODE_NAME = "monnethic";
|
||||
//public static final String CHAINCODE_NAME = "monnethic-dev-4";
|
||||
|
||||
//PEER 0
|
||||
public static final String ORG1_PEER_0 = "peer0.org1.example.com";
|
||||
|
||||
public static final String ORG1_PEER_0_URL = "grpc://vps577432.ovh.net:8051";
|
||||
//public static final String ORG1_PEER_0_URL = "grpc://vps577432.ovh.net:8051";
|
||||
public static final String ORG1_PEER_0_URL = "grpc://93.30.148.59:7051";
|
||||
//public static final String ORG1_PEER_0_URL = "grpc://93.30.148.59:8051";
|
||||
//ublic static final String ORG1_PEER_0_URL = "grpc://vps592802.ovh.net:7051";
|
||||
|
||||
|
||||
//PEER 1
|
||||
public static final String ORG_PEER = "peer1.org1.example.com";
|
||||
|
|
|
@ -29,6 +29,7 @@ public class TransactionWrapper {
|
|||
tpr.setArgs(new String[]{from,to,amount});
|
||||
|
||||
Collection<ProposalResponse> responses = channelClientWrapper.sendTransactionProposal(tpr);
|
||||
System.out.println("VERIFY HERE, TRY TO SEND TRANSACTION");
|
||||
BlockEvent.TransactionEvent event = channelClientWrapper.sendTransaction(responses);
|
||||
|
||||
return event.getTransactionID();
|
||||
|
|
20
src/main/java/database/DatabaseHelper.java
Normal file
20
src/main/java/database/DatabaseHelper.java
Normal file
|
@ -0,0 +1,20 @@
|
|||
package database;
|
||||
|
||||
import com.j256.ormlite.jdbc.JdbcConnectionSource;
|
||||
import com.j256.ormlite.support.ConnectionSource;
|
||||
|
||||
public class DatabaseHelper {
|
||||
private static final String DATABASE_NAME = "monnethic";
|
||||
private static final String DATABASE_USER = "postgres";
|
||||
private static final String DATABASE_PWD = "L-*q~Ytaha{;u+7yJ8";
|
||||
private final static String DATABASE_URL = "jdbc:postgresql://37.187.101.44:5432/"+DATABASE_NAME;
|
||||
|
||||
public ConnectionSource setupDatabaseConnection(){
|
||||
try{
|
||||
return new JdbcConnectionSource(DATABASE_URL, DATABASE_USER, DATABASE_PWD);
|
||||
}catch (Exception e){
|
||||
System.out.print("\n"+e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
38
src/main/java/database/DatabaseTest.java
Normal file
38
src/main/java/database/DatabaseTest.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package database;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
@DatabaseTable(tableName = "T_TEST")
|
||||
public class DatabaseTest {
|
||||
private static final String NAME_FIELD_NAME = "name";
|
||||
private static final String ID_FIELD_NAME = "id";
|
||||
|
||||
@DatabaseField(columnName = ID_FIELD_NAME, id = true)
|
||||
private int id;
|
||||
@DatabaseField(columnName = NAME_FIELD_NAME, canBeNull = false)
|
||||
private String name;
|
||||
|
||||
public DatabaseTest(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public DatabaseTest() { }
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
106
src/main/java/database/transaction/Transaction.java
Normal file
106
src/main/java/database/transaction/Transaction.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package database.transaction;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
@DatabaseTable(tableName = "T_TRANSACTION")
|
||||
public class Transaction {
|
||||
@DatabaseField(generatedId = true)
|
||||
private int transactionId;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private long transactionDate;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String transactionFrom;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String transactionTo;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String transactionHash;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private Double transactionAmount;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String transactionUnit;
|
||||
|
||||
public Transaction() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Transaction(long transactionDate, String transactionFrom, String transactionTo, String transactionHash, Double transactionAmount, String transactionUnit) {
|
||||
super();
|
||||
this.transactionDate = transactionDate;
|
||||
this.transactionFrom = transactionFrom;
|
||||
this.transactionTo = transactionTo;
|
||||
this.transactionHash = transactionHash;
|
||||
this.transactionAmount = transactionAmount;
|
||||
this.transactionUnit = transactionUnit;
|
||||
}
|
||||
|
||||
public String getTransactionFrom() {
|
||||
return transactionFrom;
|
||||
}
|
||||
|
||||
public void setTransactionFrom(String transactionFrom) {
|
||||
this.transactionFrom = transactionFrom;
|
||||
}
|
||||
|
||||
public String getTransactionTo() {
|
||||
return transactionTo;
|
||||
}
|
||||
|
||||
public void setTransactionTo(String transactionTo) {
|
||||
this.transactionTo = transactionTo;
|
||||
}
|
||||
|
||||
public String getTransactionHash() {
|
||||
return transactionHash;
|
||||
}
|
||||
|
||||
public void setTransactionHash(String transactionHash) {
|
||||
this.transactionHash = transactionHash;
|
||||
}
|
||||
|
||||
public Double getTransactionAmount() {
|
||||
return transactionAmount;
|
||||
}
|
||||
|
||||
public void setTransactionAmount(Double transactionAmount) {
|
||||
this.transactionAmount = transactionAmount;
|
||||
}
|
||||
|
||||
public int getTransactionId() {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
public void setTransactionId(int id) {
|
||||
this.transactionId = transactionId;
|
||||
}
|
||||
|
||||
|
||||
public long getTransactionDate() {
|
||||
return transactionDate;
|
||||
}
|
||||
|
||||
public void setTransactionDate(long transactionDate) {
|
||||
this.transactionDate = transactionDate;
|
||||
}
|
||||
|
||||
public String getTransactionUnit() {
|
||||
return transactionUnit;
|
||||
}
|
||||
|
||||
public void setTransactionUnit(String transactionUnit) {
|
||||
this.transactionUnit = transactionUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Transaction{" +
|
||||
"transactionId=" + transactionId +
|
||||
", transactionDate=" + transactionDate +
|
||||
", transactionFrom='" + transactionFrom + '\'' +
|
||||
", transactionTo='" + transactionTo + '\'' +
|
||||
", transactionHash='" + transactionHash + '\'' +
|
||||
", transactionAmount=" + transactionAmount +
|
||||
", transactionUnit='" + transactionUnit + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
75
src/main/java/database/transaction/TransactionDao.java
Normal file
75
src/main/java/database/transaction/TransactionDao.java
Normal file
|
@ -0,0 +1,75 @@
|
|||
package database.transaction;
|
||||
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.dao.DaoManager;
|
||||
import com.j256.ormlite.stmt.PreparedQuery;
|
||||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import database.DatabaseHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TransactionDao {
|
||||
private DatabaseHelper dbh = new DatabaseHelper();
|
||||
private Dao<Transaction, String> transactionDao;
|
||||
|
||||
private Dao createTransactionDaoConnection(){
|
||||
try {
|
||||
return DaoManager.createDao(dbh.setupDatabaseConnection(),Transaction.class);
|
||||
}catch (Exception e){
|
||||
System.out.println(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addTransaction(Transaction transaction)throws Exception{
|
||||
transactionDao = createTransactionDaoConnection();
|
||||
transactionDao.create(transaction);
|
||||
}
|
||||
|
||||
public List<Transaction> getUserTransactions(String userHash)throws Exception{
|
||||
transactionDao = createTransactionDaoConnection();
|
||||
QueryBuilder<Transaction, String> queryBuilder = transactionDao.queryBuilder();
|
||||
queryBuilder.where().eq("transactionFrom",userHash).or().eq("transactionTo",userHash);
|
||||
queryBuilder.orderBy("transactionDate",false);
|
||||
PreparedQuery<Transaction> preparedQuery = queryBuilder.prepare();
|
||||
return transactionDao.query(preparedQuery);
|
||||
}
|
||||
|
||||
public List<Transaction> getTenLastUserTransactions(String userHash)throws Exception{
|
||||
transactionDao = createTransactionDaoConnection();
|
||||
QueryBuilder<Transaction, String> queryBuilder = transactionDao.queryBuilder();
|
||||
queryBuilder.where().eq("transactionFrom",userHash).or().eq("transactionTo",userHash);
|
||||
queryBuilder.limit(new Long(10));
|
||||
queryBuilder.orderBy("transactionDate",false);
|
||||
PreparedQuery<Transaction> preparedQuery = queryBuilder.prepare();
|
||||
return transactionDao.query(preparedQuery);
|
||||
}
|
||||
|
||||
public Transaction getTransaction(String userHash, String transactionHash)throws Exception{
|
||||
transactionDao = createTransactionDaoConnection();
|
||||
QueryBuilder<Transaction, String> queryBuilder = transactionDao.queryBuilder();
|
||||
queryBuilder.where().eq("transactionTo",userHash).or().eq("transactionFrom",userHash).and().eq("transactionHash",transactionHash);
|
||||
PreparedQuery<Transaction> preparedQuery = queryBuilder.prepare();
|
||||
return transactionDao.queryForFirst(preparedQuery);
|
||||
}
|
||||
|
||||
public List<Transaction> getUserSentTransaction(String userHash)throws Exception{
|
||||
transactionDao = createTransactionDaoConnection();
|
||||
QueryBuilder<Transaction, String> queryBuilder = transactionDao.queryBuilder();
|
||||
queryBuilder.where().eq("transactionFrom",userHash);
|
||||
queryBuilder.orderBy("transactionDate",false);
|
||||
PreparedQuery<Transaction> preparedQuery = queryBuilder.prepare();
|
||||
return transactionDao.query(preparedQuery);
|
||||
}
|
||||
|
||||
public List<Transaction> getUserReceivedTransaction(String userHash)throws Exception{
|
||||
transactionDao = createTransactionDaoConnection();
|
||||
QueryBuilder<Transaction, String> queryBuilder = transactionDao.queryBuilder();
|
||||
queryBuilder.where().eq("transactionTo",userHash);
|
||||
queryBuilder.orderBy("transactionDate",false);
|
||||
PreparedQuery<Transaction> preparedQuery = queryBuilder.prepare();
|
||||
return transactionDao.query(preparedQuery);
|
||||
}
|
||||
|
||||
|
||||
}
|
145
src/main/java/database/user/User.java
Normal file
145
src/main/java/database/user/User.java
Normal file
|
@ -0,0 +1,145 @@
|
|||
package database.user;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
//Class User which represent an User in the postgresDB
|
||||
@DatabaseTable(tableName = "T_USER")
|
||||
public class User {
|
||||
@DatabaseField(generatedId = true)
|
||||
private int userId;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String name;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String firstname;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String email;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String password;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private long creation_date;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private long modification_date;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private boolean verified;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private boolean approved;
|
||||
@DatabaseField(canBeNull = false)
|
||||
private String user_hash;
|
||||
|
||||
//Constructors
|
||||
//Default constructor for ORMLite
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(String name, String firstname, String email, String password) {
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public User(String name, String firstname,String user_hash, String email, String password, long creation_date, long modification_date, boolean verified, boolean approved) {
|
||||
this.name = name;
|
||||
this.firstname = firstname;
|
||||
this.user_hash = user_hash;
|
||||
this.email = email;
|
||||
this.password = password;
|
||||
this.creation_date = creation_date;
|
||||
this.modification_date = modification_date;
|
||||
this.verified = verified;
|
||||
this.approved = approved;
|
||||
}
|
||||
|
||||
|
||||
//Getters and Setters
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {this.userId = userId;}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setUser_hash(String user_hash){this.user_hash = user_hash;}
|
||||
|
||||
public String getUser_hash(){return user_hash;}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
public void setFirstname(String firstname) {
|
||||
this.firstname = firstname;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public long getCreation_date() {
|
||||
return creation_date;
|
||||
}
|
||||
|
||||
public void setCreation_date(long creation_date) {
|
||||
this.creation_date = creation_date;
|
||||
}
|
||||
|
||||
public long getModification_date() {
|
||||
return modification_date;
|
||||
}
|
||||
|
||||
public void setModification_date(long modification_date) {
|
||||
this.modification_date = modification_date;
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
return verified;
|
||||
}
|
||||
|
||||
public void setVerified(boolean verified) {
|
||||
this.verified = verified;
|
||||
}
|
||||
|
||||
public boolean isApproved() {
|
||||
return approved;
|
||||
}
|
||||
|
||||
public void setApproved(boolean approved) {
|
||||
this.approved = approved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"userId=" + userId +
|
||||
", name='" + name + '\'' +
|
||||
", firstname='" + firstname + '\'' +
|
||||
", email='" + email + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", creation_date=" + creation_date +
|
||||
", modification_date=" + modification_date +
|
||||
", verified=" + verified +
|
||||
", approved=" + approved +
|
||||
", user_hash='" + user_hash + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
120
src/main/java/database/user/UserDao.java
Normal file
120
src/main/java/database/user/UserDao.java
Normal file
|
@ -0,0 +1,120 @@
|
|||
package database.user;
|
||||
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.dao.DaoManager;
|
||||
import com.j256.ormlite.stmt.PreparedQuery;
|
||||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import com.j256.ormlite.stmt.UpdateBuilder;
|
||||
import database.DatabaseHelper;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
//Class to communicate with database with ORMLite
|
||||
public class UserDao {
|
||||
private DatabaseHelper dbh = new DatabaseHelper();
|
||||
private Dao<User, String> userDao;
|
||||
|
||||
private Dao createUserDaoConnection(){
|
||||
try {
|
||||
return DaoManager.createDao(dbh.setupDatabaseConnection(),User.class);
|
||||
}catch (Exception e){
|
||||
System.out.println(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addUser(User user)throws Exception {
|
||||
userDao = createUserDaoConnection();
|
||||
userDao.create(user);
|
||||
}
|
||||
|
||||
public boolean checkApprovedUser(String email) throws Exception {
|
||||
userDao = createUserDaoConnection();
|
||||
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||
queryBuilder.where().eq("email",email);
|
||||
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||
User user = userDao.queryForFirst(preparedQuery);
|
||||
return user.isApproved();
|
||||
}
|
||||
|
||||
public boolean checkVerifiedUser(String email) throws Exception {
|
||||
userDao = createUserDaoConnection();
|
||||
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||
queryBuilder.where().eq("email",email);
|
||||
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||
User user = userDao.queryForFirst(preparedQuery);
|
||||
return user.isVerified();
|
||||
}
|
||||
|
||||
public boolean updateUserPassword(String email, String password) throws Exception {
|
||||
userDao = createUserDaoConnection();
|
||||
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("password",password);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
updateBuilder.where().eq("email",email);
|
||||
updateBuilder.update();
|
||||
|
||||
if(checkUserPassword(email, password)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean verifyUserExist(String email) throws Exception {
|
||||
userDao = createUserDaoConnection();
|
||||
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||
queryBuilder.where().eq("email",email);
|
||||
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||
User user = userDao.queryForFirst(preparedQuery);
|
||||
|
||||
if(user==null){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkUserPassword(String email, String password) throws Exception {
|
||||
User user = getUser(email);
|
||||
if(password.equals(user.getPassword())){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public User getUser(String email) throws Exception {
|
||||
if(!verifyUserExist(email)){
|
||||
return null;
|
||||
}else{
|
||||
userDao = createUserDaoConnection();
|
||||
QueryBuilder<User, String> queryBuilder = userDao.queryBuilder();
|
||||
queryBuilder.where().eq("email",email);
|
||||
PreparedQuery<User> preparedQuery = queryBuilder.prepare();
|
||||
return userDao.queryForFirst(preparedQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void approveUser (String email) throws Exception{
|
||||
userDao = createUserDaoConnection();
|
||||
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("approved",true);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
updateBuilder.where().eq("email",email);
|
||||
updateBuilder.update();
|
||||
}
|
||||
|
||||
public void verifyUser (String email) throws Exception{
|
||||
userDao = createUserDaoConnection();
|
||||
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("verified",true);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
updateBuilder.where().eq("email",email);
|
||||
updateBuilder.update();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package restImplementation;
|
||||
|
||||
import blockchain.query.QueryWrapper;
|
||||
|
||||
public class BlockchainQueryImplementation {
|
||||
|
||||
public Double getUserBalance(String userHash){
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
String result = queryWrapper.getUserBalance(userHash);
|
||||
Double balance = Double.parseDouble(result);
|
||||
return balance;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package restImplementation;
|
||||
|
||||
import database.transaction.Transaction;
|
||||
import database.transaction.TransactionDao;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
public class DatabaseTransactionImplementation {
|
||||
|
||||
public void saveTransaction(Transaction transaction) throws Exception{
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
long now = Instant.now().toEpochMilli();
|
||||
transaction.setTransactionDate(now);
|
||||
transactionDao.addTransaction(transaction);
|
||||
}
|
||||
|
||||
public Transaction getUserTransaction(String userHash, String transactionHash)throws Exception{
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
Transaction tx = transactionDao.getTransaction(userHash,transactionHash);
|
||||
if(tx != null){
|
||||
return tx;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Transaction> getAllUserTransactions(String userHash)throws Exception{
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
return transactionDao.getUserTransactions(userHash);
|
||||
}
|
||||
|
||||
public List<Transaction> getLastTenTransactions(String userHash)throws Exception{
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
return transactionDao.getTenLastUserTransactions(userHash);
|
||||
}
|
||||
|
||||
public List<Transaction> getSentTransaction(String userHash)throws Exception{
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
return transactionDao.getUserSentTransaction(userHash);
|
||||
}
|
||||
|
||||
public List<Transaction> getReceivedTransaction(String userHash)throws Exception{
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
return transactionDao.getUserReceivedTransaction(userHash);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package restImplementation;
|
||||
|
||||
import database.user.User;
|
||||
import database.user.UserDao;
|
||||
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DatabaseUserImplementation {
|
||||
|
||||
public Map<String,String> saveUser(User user) throws Exception {
|
||||
UserDao userDao = new UserDao();
|
||||
Map<String,String> response = new HashMap<String, String>();
|
||||
|
||||
User dbUser = userDao.getUser(user.getEmail());
|
||||
if(dbUser != null){
|
||||
response.put("response","false");
|
||||
return response;
|
||||
}else {
|
||||
user.setPassword(hashPassword(user.getPassword()));
|
||||
long now = Instant.now().toEpochMilli();
|
||||
user.setCreation_date(now);
|
||||
user.setModification_date(now);
|
||||
user.setVerified(true);
|
||||
user.setApproved(true);
|
||||
|
||||
//TEMPORARY USER HASH IS
|
||||
//name+email+password
|
||||
user.setUser_hash(hashPassword(user.getName()+user.getEmail()+user.getPassword()));
|
||||
userDao.addUser(user);
|
||||
response.put("userHash",user.getUser_hash());
|
||||
response.put("response","true");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public User getUser(String email, String password) throws Exception{
|
||||
UserDao userDao = new UserDao();
|
||||
User user1 = userDao.getUser(email);
|
||||
if(user1 != null){
|
||||
String hash = user1.getPassword();
|
||||
if(BCrypt.checkpw(password, hash)){
|
||||
return user1;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> userLogger(User user) throws Exception {
|
||||
UserDao userDao = new UserDao();
|
||||
Map<String,String> response = new HashMap<String, String>();
|
||||
|
||||
User user1 = userDao.getUser(user.getEmail());
|
||||
if(user1 != null){
|
||||
String hash = user1.getPassword();
|
||||
|
||||
if(!BCrypt.checkpw(user.getPassword(), hash)){
|
||||
response.put("response","Not Allowed");
|
||||
}else{
|
||||
response.put("response","Ok");
|
||||
response.put("userHash",user1.getUser_hash());
|
||||
}
|
||||
} else {
|
||||
response.put("response","Not Exist");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
private String hashPassword(String plainTextPassword){
|
||||
return BCrypt.hashpw(plainTextPassword,BCrypt.gensalt());
|
||||
}
|
||||
}
|
28
src/main/java/restService/BlockchainQueryResource.java
Normal file
28
src/main/java/restService/BlockchainQueryResource.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package restService;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import restImplementation.BlockchainQueryImplementation;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/rest/query")
|
||||
public class BlockchainQueryResource {
|
||||
|
||||
@RequestMapping(value = "/balance", method = RequestMethod.GET ,params = {"userHash"},produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<StringResponse> getUserBalance(@RequestParam(value = "userHash") String userHash){
|
||||
try{
|
||||
BlockchainQueryImplementation blockchainQueryImplementation = new BlockchainQueryImplementation();
|
||||
Double result = blockchainQueryImplementation.getUserBalance(userHash);
|
||||
StringResponse response = new StringResponse("Ok",result);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||
}catch (Exception e){
|
||||
StringResponse response = new StringResponse("Error");
|
||||
return ResponseEntity.status(HttpStatus.OK).body(response);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
110
src/main/java/restService/DatabaseTransactionResource.java
Normal file
110
src/main/java/restService/DatabaseTransactionResource.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
package restService;
|
||||
|
||||
import database.transaction.Transaction;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import restImplementation.DatabaseTransactionImplementation;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/rest/transaction")
|
||||
public class DatabaseTransactionResource {
|
||||
|
||||
@PostMapping("/save")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public ResponseEntity<String> saveTransaction(@Valid @RequestBody Transaction transaction){
|
||||
try{
|
||||
DatabaseTransactionImplementation databaseTransactionImplementation = new DatabaseTransactionImplementation();
|
||||
databaseTransactionImplementation.saveTransaction(transaction);
|
||||
return ResponseEntity.status(HttpStatus.OK).body("");
|
||||
}catch (Exception e){
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get", method = RequestMethod.GET, params = {"userHash","transactionHash"}, produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<Transaction> getTransaction(@RequestParam(value = "userHash") String userHash, @RequestParam(value = "transactionHash") String transactionHash){
|
||||
try{
|
||||
DatabaseTransactionImplementation databaseTransactionImplementation = new DatabaseTransactionImplementation();
|
||||
Transaction tx = databaseTransactionImplementation.getUserTransaction(userHash,transactionHash);
|
||||
if(tx != null){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(tx);
|
||||
}else {
|
||||
return new ResponseEntity("Error", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getLatest", method = RequestMethod.GET, params = {"userHash"}, produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<List<Transaction>> getLatestTransactions(@RequestParam(value = "userHash") String userHash){
|
||||
try{
|
||||
DatabaseTransactionImplementation databaseTransactionImplementation = new DatabaseTransactionImplementation();
|
||||
List<Transaction> transactionList = databaseTransactionImplementation.getLastTenTransactions(userHash);
|
||||
if(!transactionList.isEmpty()){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(transactionList);
|
||||
}else {
|
||||
return new ResponseEntity("Error", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/getAll", method = RequestMethod.GET, params = {"userHash"}, produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<List<Transaction>> getAllTransactions(@RequestParam(value = "userHash") String userHash){
|
||||
try{
|
||||
DatabaseTransactionImplementation databaseTransactionImplementation = new DatabaseTransactionImplementation();
|
||||
List<Transaction> transactionList = databaseTransactionImplementation.getAllUserTransactions(userHash);
|
||||
if(!transactionList.isEmpty()){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(transactionList);
|
||||
}else {
|
||||
return new ResponseEntity("Error", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/sent", method = RequestMethod.GET, params = {"userHash"}, produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<List<Transaction>> getSentTransactions(@RequestParam(value = "userHash") String userHash){
|
||||
try {
|
||||
DatabaseTransactionImplementation databaseTransactionImplementation = new DatabaseTransactionImplementation();
|
||||
List<Transaction> transactionList = databaseTransactionImplementation.getSentTransaction(userHash);
|
||||
if(!transactionList.isEmpty()){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(transactionList);
|
||||
}else {
|
||||
return new ResponseEntity("Error", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/received", method = RequestMethod.GET, params = {"userHash"}, produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<List<Transaction>> getReceivedTransactions(@RequestParam(value = "userHash") String userHash){
|
||||
try {
|
||||
DatabaseTransactionImplementation databaseTransactionImplementation = new DatabaseTransactionImplementation();
|
||||
List<Transaction> transactionList = databaseTransactionImplementation.getReceivedTransaction(userHash);
|
||||
if(!transactionList.isEmpty()){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(transactionList);
|
||||
}else {
|
||||
return new ResponseEntity("Error", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity(e.getMessage(), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
97
src/main/java/restService/DatabaseUserResource.java
Normal file
97
src/main/java/restService/DatabaseUserResource.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
package restService;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import database.user.User;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import restImplementation.DatabaseUserImplementation;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/rest/user")
|
||||
public class DatabaseUserResource {
|
||||
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST,produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public ResponseEntity<StringResponse> saveUser(@Valid @RequestBody User user){
|
||||
try{
|
||||
DatabaseUserImplementation databaseUserImplementation = new DatabaseUserImplementation();
|
||||
Map<String,String> response = databaseUserImplementation.saveUser(user);
|
||||
if(Boolean.parseBoolean(response.get("response"))){
|
||||
StringResponse responseS = new StringResponse("Ok",response.get("userHash"));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(responseS);
|
||||
}else {
|
||||
StringResponse responseS = new StringResponse("User already exist");
|
||||
return ResponseEntity.status(HttpStatus.FOUND).body(responseS);
|
||||
}
|
||||
}catch (Exception e){
|
||||
StringResponse responseS = new StringResponse(e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST,produces = "application/json")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity<StringResponse> login(@Valid @RequestBody User user){
|
||||
try{
|
||||
DatabaseUserImplementation databaseUserImplementation = new DatabaseUserImplementation();
|
||||
Map<String,String> response = databaseUserImplementation.userLogger(user);
|
||||
switch (response.get("response")){
|
||||
case "Not Exist" : {
|
||||
StringResponse responseS = new StringResponse("User Not Found");
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseS);
|
||||
}
|
||||
case "Not Allowed" :{
|
||||
StringResponse responseS = new StringResponse("Wrong Password!");
|
||||
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(responseS);
|
||||
}
|
||||
case "" :{
|
||||
StringResponse responseS = new StringResponse("Error");
|
||||
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
||||
}
|
||||
case "Ok":{
|
||||
StringResponse responseS = new StringResponse("Ok",response.get("userHash"));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(responseS);
|
||||
}
|
||||
default:{
|
||||
StringResponse responseS = new StringResponse("Error");
|
||||
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
StringResponse responseS = new StringResponse(e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.CONFLICT).body(responseS);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/get", produces = "application/json")
|
||||
@ResponseBody
|
||||
public ResponseEntity<User> getUser(@RequestBody User user){
|
||||
try{
|
||||
DatabaseUserImplementation databaseUserImplementation = new DatabaseUserImplementation();
|
||||
User response = databaseUserImplementation.getUser(user.getEmail(), user.getPassword());
|
||||
if(response != null){
|
||||
User userResponse = new User();
|
||||
userResponse.setUser_hash(response.getUser_hash());
|
||||
userResponse.setUserId(response.getUserId());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(userResponse);
|
||||
}else{
|
||||
return new ResponseEntity("Error", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}catch (Exception e){
|
||||
return new ResponseEntity(e.getMessage(), HttpStatus.CONFLICT);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public ResponseEntity updateUser(@RequestBody User user){
|
||||
return new ResponseEntity(null, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
41
src/main/java/restService/StringResponse.java
Normal file
41
src/main/java/restService/StringResponse.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package restService;
|
||||
|
||||
public class StringResponse {
|
||||
private String response;
|
||||
private String userHash;
|
||||
private Double userBalance;
|
||||
|
||||
public StringResponse(String response){
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public StringResponse(String response, Double userBalance){
|
||||
this.response=response;
|
||||
this.userBalance=userBalance;
|
||||
}
|
||||
|
||||
public StringResponse(String response, String userHash){
|
||||
this.response=response;
|
||||
this.userHash=userHash;
|
||||
}
|
||||
|
||||
public String getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(String response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public String getUserHash() {
|
||||
return userHash;
|
||||
}
|
||||
|
||||
public void setUserHash(String userHash) {
|
||||
this.userHash = userHash;
|
||||
}
|
||||
|
||||
public Double getUserBalance(){return userBalance;}
|
||||
|
||||
public void setUserBalance(Double userBalance){this.userBalance=userBalance;}
|
||||
}
|
|
@ -4,7 +4,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class WelcomeController {
|
||||
public class WelcomeResource {
|
||||
|
||||
@RequestMapping("/")
|
||||
public String index(){return "Welcome from Monnethic !";}
|
|
@ -3,11 +3,13 @@ package blockchain.client;
|
|||
import blockchain.configuration.Config;
|
||||
import blockchain.user.UserContext;
|
||||
import org.hyperledger.fabric.sdk.Enrollment;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
//Test to enroll Admin
|
||||
@Ignore
|
||||
public class TestEnrollAdmin {
|
||||
@Test
|
||||
public void TestAEnrollAdmin(){
|
||||
|
|
|
@ -4,9 +4,11 @@ import blockchain.configuration.Config;
|
|||
import blockchain.user.UserContext;
|
||||
import blockchain.utility.Util;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
//Test to register and enroll user
|
||||
@Ignore
|
||||
public class TestRegisterEnrollUser {
|
||||
private static Logger logger = Logger.getLogger(TestRegisterEnrollUser.class);
|
||||
//Success
|
||||
|
|
|
@ -8,6 +8,7 @@ import blockchain.utility.Util;
|
|||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.*;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -18,6 +19,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
//Test for transaction
|
||||
@Ignore
|
||||
public class ChaincodeTransactionTest {
|
||||
private static Logger logger = Logger.getLogger(ChaincodeTransactionTest.class);
|
||||
@Test
|
||||
|
@ -53,7 +55,7 @@ public class ChaincodeTransactionTest {
|
|||
ChaincodeID cid = ChaincodeID.newBuilder().setName(Config.CHAINCODE_NAME).build();
|
||||
tpr.setChaincodeID(cid);
|
||||
tpr.setFcn("invoke");
|
||||
tpr.setArgs(new String[]{"a","b","20"}); //send 20 from a to b
|
||||
tpr.setArgs(new String[]{"b","a","25"}); //send 20 from a to b
|
||||
|
||||
Collection<ProposalResponse> responses = channel.sendTransactionProposal(tpr);
|
||||
List<ProposalResponse> invalid = responses.stream().filter(r -> r.isInvalid()).collect(Collectors.toList());
|
||||
|
@ -65,6 +67,7 @@ public class ChaincodeTransactionTest {
|
|||
}
|
||||
|
||||
|
||||
logger.info("SEND TRANSACTION");
|
||||
BlockEvent.TransactionEvent event = channel.sendTransaction(responses).get();
|
||||
logger.info("Event transaction id : "+event.getTransactionID()); //print transaction id
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import blockchain.utility.Util;
|
|||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.*;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -15,6 +16,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
//Test to create user on chaincode -> don't work, can't use function "Init"
|
||||
@Ignore
|
||||
public class CreateChaincodeUserTest {
|
||||
private static Logger logger = Logger.getLogger(QueryTest.class);
|
||||
|
||||
|
|
|
@ -7,18 +7,20 @@ import blockchain.utility.Util;
|
|||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.Peer;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
//Test to show channels on a node
|
||||
@Ignore
|
||||
public class QueryChannelTest {
|
||||
private static Logger logger = Logger.getLogger(QueryTest.class);
|
||||
|
||||
@Test
|
||||
public void testQ(){
|
||||
BasicConfigurator.configure();
|
||||
UserContext userContext = Util.readUserContext(Config.ORG1,"User-org1");
|
||||
UserContext userContext = Util.readUserContext(Config.ORG1,"admin");
|
||||
|
||||
try{
|
||||
FabricClientWrapper fabricClientWrapper = new FabricClientWrapper(userContext);
|
||||
|
|
|
@ -8,20 +8,22 @@ import blockchain.utility.Util;
|
|||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.*;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
//Test to get balance of a User
|
||||
@Ignore
|
||||
public class QueryTest {
|
||||
private static Logger logger = Logger.getLogger(QueryTest.class);
|
||||
|
||||
@Test
|
||||
public void TestAQueryChannels() {
|
||||
public void TestAQuery() {
|
||||
BasicConfigurator.configure();
|
||||
|
||||
//UserContext user = Util.readUserContext(Config.ORG1,Config.ADMIN);
|
||||
UserContext user = Util.readUserContext(Config.ORG1,"User-org1");
|
||||
UserContext user = Util.readUserContext(Config.ORG1,"admin");
|
||||
|
||||
try{
|
||||
String chaincode = Config.CHAINCODE_NAME;
|
||||
|
@ -29,7 +31,10 @@ public class QueryTest {
|
|||
|
||||
ChannelClientWrapper channelClientWrapper = ChannelClientWrapper.setupChannel(fabricClientWrapper);
|
||||
|
||||
String[] args1 = {"a"};
|
||||
//String[] args1 = {"a"};
|
||||
String[] args1 = {"chef"};
|
||||
//String[] args1 = {"bitman"};
|
||||
//String[] args1 = {"user_test"};
|
||||
|
||||
Collection<ProposalResponse> responseQuery = channelClientWrapper.queryByChainCode(chaincode,"query",args1);
|
||||
for(ProposalResponse pres : responseQuery){
|
||||
|
|
53
src/test/java/blockchain/query/User/ReadUserTest.java
Normal file
53
src/test/java/blockchain/query/User/ReadUserTest.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package blockchain.query.User;
|
||||
|
||||
import blockchain.client.ChannelClientWrapper;
|
||||
import blockchain.client.FabricClientWrapper;
|
||||
import blockchain.configuration.Config;
|
||||
import blockchain.query.QueryTest;
|
||||
import blockchain.user.UserContext;
|
||||
import blockchain.utility.Util;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.ChaincodeResponse;
|
||||
import org.hyperledger.fabric.sdk.ProposalResponse;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@Ignore
|
||||
public class ReadUserTest {
|
||||
private static Logger logger = Logger.getLogger(QueryTest.class);
|
||||
|
||||
@Test
|
||||
public void TestQueryReadUser() {
|
||||
BasicConfigurator.configure();
|
||||
UserContext user = Util.readUserContext(Config.ORG1,"admin");
|
||||
|
||||
try{
|
||||
String chaincode = Config.CHAINCODE_NAME;
|
||||
FabricClientWrapper fabricClientWrapper = new FabricClientWrapper(user);
|
||||
|
||||
ChannelClientWrapper channelClientWrapper = ChannelClientWrapper.setupChannel(fabricClientWrapper);
|
||||
|
||||
//String[] args1 = {"chef"};
|
||||
String[] args1 = {"user_test"};
|
||||
|
||||
Collection<ProposalResponse> responseQuery = channelClientWrapper.queryByChainCode(chaincode,"readUser",args1);
|
||||
logger.info("RESPONSE : "+responseQuery);
|
||||
logger.info("RESPONSE : "+responseQuery.size());
|
||||
for(ProposalResponse pres : responseQuery){
|
||||
ChaincodeResponse.Status status = pres.getStatus();
|
||||
if(status.getStatus()!=200){
|
||||
throw new Exception(pres.getMessage());
|
||||
}
|
||||
String stringResponse = new String(pres.getChaincodeActionResponsePayload());
|
||||
logger.info("RESPONSE : "+stringResponse);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
67
src/test/java/blockchain/query/User/RegisterUserTest.java
Normal file
67
src/test/java/blockchain/query/User/RegisterUserTest.java
Normal file
|
@ -0,0 +1,67 @@
|
|||
package blockchain.query.User;
|
||||
|
||||
import blockchain.client.ChannelClientWrapper;
|
||||
import blockchain.client.FabricClientWrapper;
|
||||
import blockchain.configuration.Config;
|
||||
import blockchain.user.UserContext;
|
||||
import blockchain.utility.Util;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.*;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
//Test to get balance of a User
|
||||
@Ignore
|
||||
public class RegisterUserTest {
|
||||
private static Logger logger = Logger.getLogger(RegisterUserTest.class);
|
||||
|
||||
@Test
|
||||
public void TestARegisterUser() {
|
||||
BasicConfigurator.configure();
|
||||
|
||||
UserContext user = Util.readUserContext(Config.ORG1,"admin");
|
||||
try{
|
||||
|
||||
String chaincode = Config.CHAINCODE_NAME;
|
||||
FabricClientWrapper fabricClientWrapper = new FabricClientWrapper(user);
|
||||
ChannelClientWrapper channelClientWrapper = fabricClientWrapper.createChannelClient(Config.CHANNEL_NAME);
|
||||
|
||||
Channel channel = channelClientWrapper.getChannel();
|
||||
Peer peer = fabricClientWrapper.getClient().newPeer(Config.ORG1_PEER_0,Config.ORG1_PEER_0_URL);
|
||||
EventHub eventHub = fabricClientWrapper.getClient().newEventHub("eventhub01", "grpc://93.30.148.59:7051");
|
||||
Orderer orderer = fabricClientWrapper.getClient().newOrderer(Config.ORDERER_NAME,Config.ORDERER_URL);
|
||||
channel.addPeer(peer);
|
||||
channel.addEventHub(eventHub);
|
||||
channel.addOrderer(orderer);
|
||||
channel.initialize();
|
||||
|
||||
TransactionProposalRequest tpr = fabricClientWrapper.getClient().newTransactionProposalRequest();
|
||||
ChaincodeID cid = ChaincodeID.newBuilder().setName(Config.CHAINCODE_NAME).build();
|
||||
tpr.setChaincodeID(cid);
|
||||
tpr.setFcn("register");
|
||||
tpr.setArgs(new String[]{"user_test","100"}); //register user_test with 100
|
||||
|
||||
Collection<ProposalResponse> responses = channel.sendTransactionProposal(tpr);
|
||||
List<ProposalResponse> invalid = responses.stream().filter(r -> r.isInvalid()).collect(Collectors.toList());
|
||||
|
||||
if (!invalid.isEmpty()) {
|
||||
invalid.forEach(response -> {
|
||||
logger.error(response.getMessage());
|
||||
});
|
||||
}
|
||||
|
||||
logger.info("SEND REQUEST");
|
||||
BlockEvent.TransactionEvent event = channel.sendTransaction(responses).get();
|
||||
logger.info("Event id : "+event.getTransactionID()); //print transaction id
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package blockchain.query.Wallet;
|
||||
|
||||
import blockchain.client.ChannelClientWrapper;
|
||||
import blockchain.client.FabricClientWrapper;
|
||||
import blockchain.configuration.Config;
|
||||
import blockchain.query.QueryTest;
|
||||
import blockchain.user.UserContext;
|
||||
import blockchain.utility.Util;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.ChaincodeResponse;
|
||||
import org.hyperledger.fabric.sdk.ProposalResponse;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@Ignore
|
||||
public class QueryWalletByOwnerTest {
|
||||
private static Logger logger = Logger.getLogger(QueryTest.class);
|
||||
|
||||
@Test
|
||||
public void TestQueryWallet() {
|
||||
BasicConfigurator.configure();
|
||||
UserContext user = Util.readUserContext(Config.ORG1,"admin");
|
||||
|
||||
try{
|
||||
String chaincode = Config.CHAINCODE_NAME;
|
||||
FabricClientWrapper fabricClientWrapper = new FabricClientWrapper(user);
|
||||
|
||||
ChannelClientWrapper channelClientWrapper = ChannelClientWrapper.setupChannel(fabricClientWrapper);
|
||||
|
||||
String[] args1 = {"chef"};
|
||||
Collection<ProposalResponse> responseQuery = channelClientWrapper.queryByChainCode(chaincode,"queryWalletsByOwner",args1);
|
||||
|
||||
for(ProposalResponse pres : responseQuery){
|
||||
ChaincodeResponse.Status status = pres.getStatus();
|
||||
if(status.getStatus()!=200){
|
||||
throw new Exception(pres.getMessage());
|
||||
}
|
||||
String stringResponse = new String(pres.getChaincodeActionResponsePayload());
|
||||
logger.info("RESPONSE : "+stringResponse);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package blockchain.query.Wallet;
|
||||
|
||||
import blockchain.client.ChannelClientWrapper;
|
||||
import blockchain.client.FabricClientWrapper;
|
||||
import blockchain.configuration.Config;
|
||||
import blockchain.query.QueryTest;
|
||||
import blockchain.user.UserContext;
|
||||
import blockchain.utility.Util;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hyperledger.fabric.sdk.*;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Ignore
|
||||
public class QueryWalletByOwnerTrTest {
|
||||
private static Logger logger = Logger.getLogger(QueryTest.class);
|
||||
|
||||
@Test
|
||||
public void TestQueryWallet() {
|
||||
BasicConfigurator.configure();
|
||||
|
||||
UserContext user = Util.readUserContext(Config.ORG1,Config.ADMIN);
|
||||
try{
|
||||
String chaincode = Config.CHAINCODE_NAME;
|
||||
FabricClientWrapper fabricClientWrapper = new FabricClientWrapper(user);
|
||||
ChannelClientWrapper channelClientWrapper = fabricClientWrapper.createChannelClient(Config.CHANNEL_NAME);
|
||||
|
||||
Channel channel = channelClientWrapper.getChannel();
|
||||
Peer peer = fabricClientWrapper.getClient().newPeer(Config.ORG1_PEER_0,Config.ORG1_PEER_0_URL);
|
||||
EventHub eventHub = fabricClientWrapper.getClient().newEventHub("eventhub01", "grpc://93.30.148.59:87051");
|
||||
Orderer orderer = fabricClientWrapper.getClient().newOrderer(Config.ORDERER_NAME,Config.ORDERER_URL);
|
||||
channel.addPeer(peer);
|
||||
channel.addEventHub(eventHub);
|
||||
channel.addOrderer(orderer);
|
||||
channel.initialize();
|
||||
|
||||
TransactionProposalRequest tpr = fabricClientWrapper.getClient().newTransactionProposalRequest();
|
||||
ChaincodeID cid = ChaincodeID.newBuilder().setName(Config.CHAINCODE_NAME).build();
|
||||
tpr.setChaincodeID(cid);
|
||||
tpr.setFcn("queryWalletsByOwner");
|
||||
tpr.setArgs(new String[]{"chef"});
|
||||
|
||||
Collection<ProposalResponse> responses = channel.sendTransactionProposal(tpr);
|
||||
List<ProposalResponse> invalid = responses.stream().filter(r -> r.isInvalid()).collect(Collectors.toList());
|
||||
|
||||
if (!invalid.isEmpty()) {
|
||||
invalid.forEach(response -> {
|
||||
logger.error(response.getMessage());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
logger.info("SEND TRANSACTION");
|
||||
BlockEvent.TransactionEvent event = channel.sendTransaction(responses).get();
|
||||
logger.info("Event transaction id : "+event.getTransactionID()); //print transaction id
|
||||
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -3,8 +3,10 @@ package blockchain.queryWrapper;
|
|||
import blockchain.query.QueryWrapper;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@Ignore
|
||||
public class QueryWrapperTest {
|
||||
private static Logger logger = Logger.getLogger(QueryWrapperTest.class);
|
||||
@Test
|
||||
|
|
|
@ -4,8 +4,10 @@ import blockchain.query.QueryWrapper;
|
|||
import blockchain.query.TransactionWrapper;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@Ignore
|
||||
public class TransactionWrapperTest {
|
||||
private static Logger logger = Logger.getLogger(TransactionWrapperTest.class);
|
||||
|
||||
|
@ -14,7 +16,7 @@ public class TransactionWrapperTest {
|
|||
BasicConfigurator.configure();
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
||||
String responseTransaction = transactionWrapper.sendTransaction("a","b","15"); //do transaction
|
||||
String responseTransaction = transactionWrapper.sendTransaction("b","a","150"); //do transaction
|
||||
logger.info("TRANSACTION ID : "+responseTransaction);
|
||||
|
||||
String responseUserB = queryWrapper.getUserBalance("b"); //check new balance of user b
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package blockchain.user;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
//Test to create a User
|
||||
@Ignore
|
||||
public class UserContextTest {
|
||||
@Test
|
||||
public void TestACreateUser(){
|
||||
|
|
|
@ -2,14 +2,16 @@ package blockchain.utility;
|
|||
|
||||
import blockchain.configuration.Config;
|
||||
import blockchain.user.UserContext;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
//Test to Read User
|
||||
@Ignore
|
||||
public class ReadUserTest {
|
||||
@Test
|
||||
public void testReadUserOrg1(){
|
||||
try{
|
||||
UserContext userContext = Util.readUserContext(Config.ORG1, "User-org1");
|
||||
UserContext userContext = Util.readUserContext(Config.ORG1, "User2-org1");
|
||||
System.out.println(userContext.getAffiliation());
|
||||
System.out.println(userContext.getMspId());
|
||||
System.out.println(userContext.getEnrollment().getCert());
|
||||
|
|
|
@ -4,10 +4,12 @@ import blockchain.user.UserContext;
|
|||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
//Test to Read and Write user from files
|
||||
@Ignore
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class UtilTest {
|
||||
private static Logger logger = Logger.getLogger(UtilTest.class);
|
||||
|
|
23
src/test/java/crypto/CryptoTest.java
Normal file
23
src/test/java/crypto/CryptoTest.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package crypto;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.crypto.bcrypt.BCrypt;
|
||||
|
||||
import java.time.Instant;
|
||||
@Ignore
|
||||
public class CryptoTest {
|
||||
|
||||
@Test
|
||||
public void testHash(){
|
||||
String password = "newPassword";
|
||||
System.out.println(hashPassword(password));
|
||||
|
||||
long now = Instant.now().toEpochMilli();
|
||||
System.out.println(now);
|
||||
}
|
||||
|
||||
private String hashPassword(String plainTextPassword) {
|
||||
return BCrypt.hashpw(plainTextPassword, BCrypt.gensalt());
|
||||
}
|
||||
}
|
28
src/test/java/database/DatabaseHelperTest.java
Normal file
28
src/test/java/database/DatabaseHelperTest.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package database;
|
||||
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.dao.DaoManager;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
//Testing class for postgresql connection
|
||||
@Ignore
|
||||
public class DatabaseHelperTest {
|
||||
private DatabaseHelper dbh = new DatabaseHelper();
|
||||
|
||||
//Test connection by getting existing data in T_TEST
|
||||
@Test
|
||||
public void TestConnection(){
|
||||
Dao<DatabaseTest, Integer> testDao;
|
||||
try{
|
||||
testDao = DaoManager.createDao(dbh.setupDatabaseConnection(),DatabaseTest.class);
|
||||
DatabaseTest dbt = testDao.queryForId(1);
|
||||
System.out.println(dbt.getName());
|
||||
assert dbt != null;
|
||||
assert "thomas".equals(dbt.getName());
|
||||
}catch (Exception e){
|
||||
System.out.println("\n"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
23
src/test/java/database/DatabaseUserImplementationTest.java
Normal file
23
src/test/java/database/DatabaseUserImplementationTest.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package database;
|
||||
|
||||
import database.user.User;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import restImplementation.DatabaseUserImplementation;
|
||||
|
||||
@Ignore
|
||||
public class DatabaseUserImplementationTest {
|
||||
@Test
|
||||
public void TestUser(){
|
||||
try {
|
||||
//String email = "null";
|
||||
String email = "thomas.marshal@gmail.com";
|
||||
String password = "null";
|
||||
DatabaseUserImplementation databaseUserImplementation = new DatabaseUserImplementation();
|
||||
User response = databaseUserImplementation.getUser(email, password);
|
||||
System.out.println(response);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
25
src/test/java/restImplementation/UserLoggerTest.java
Normal file
25
src/test/java/restImplementation/UserLoggerTest.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package restImplementation;
|
||||
|
||||
import database.user.User;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Ignore
|
||||
public class UserLoggerTest {
|
||||
@Test
|
||||
public void testLoggerUser(){
|
||||
try{
|
||||
User user = new User();
|
||||
user.setPassword("newPassword");
|
||||
user.setEmail("thomas.marshal@gmail.com");
|
||||
|
||||
DatabaseUserImplementation databaseUserImplementation = new DatabaseUserImplementation();
|
||||
Map<String, String> res = databaseUserImplementation.userLogger(user);
|
||||
System.out.println(res);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,11 +0,0 @@
|
|||
restService\WelcomeController.class
|
||||
blockchain\user\UserContext.class
|
||||
blockchain\client\CAClientWrapper.class
|
||||
blockchain\utility\Util.class
|
||||
blockchain\client\ChannelClientWrapper.class
|
||||
blockchain\user\CAEnrollement.class
|
||||
Application\App.class
|
||||
blockchain\configuration\Config.class
|
||||
blockchain\query\QueryWrapper.class
|
||||
blockchain\query\TransactionWrapper.class
|
||||
blockchain\client\FabricClientWrapper.class
|
|
@ -1,11 +0,0 @@
|
|||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\client\ChannelClientWrapper.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\client\FabricClientWrapper.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\user\CAEnrollement.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\client\CAClientWrapper.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\query\QueryWrapper.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\restService\WelcomeController.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\Application\App.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\configuration\Config.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\query\TransactionWrapper.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\user\UserContext.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\main\java\blockchain\utility\Util.java
|
|
@ -1,11 +0,0 @@
|
|||
blockchain\query\QueryTest.class
|
||||
blockchain\queryWrapper\QueryWrapperTest.class
|
||||
blockchain\query\QueryChannelTest.class
|
||||
blockchain\queryWrapper\TransactionWrapperTest.class
|
||||
blockchain\utility\UtilTest.class
|
||||
blockchain\client\TestEnrollAdmin.class
|
||||
blockchain\query\ChaincodeTransactionTest.class
|
||||
blockchain\utility\ReadUserTest.class
|
||||
blockchain\client\TestRegisterEnrollUser.class
|
||||
blockchain\query\CreateChaincodeUserTest.class
|
||||
blockchain\user\UserContextTest.class
|
|
@ -1,11 +0,0 @@
|
|||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\client\TestRegisterEnrollUser.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\query\QueryTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\client\TestEnrollAdmin.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\query\CreateChaincodeUserTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\queryWrapper\TransactionWrapperTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\utility\UtilTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\query\QueryChannelTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\query\ChaincodeTransactionTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\utility\ReadUserTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\queryWrapper\QueryWrapperTest.java
|
||||
B:\SCIENCES U\GroupProject\java-api\src\test\java\blockchain\user\UserContextTest.java
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue