-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It is finally working including all tests and azure function
- Loading branch information
Jan Philip
authored and
Jan Philip
committed
Oct 19, 2021
1 parent
21e57bb
commit 0d201f9
Showing
6 changed files
with
83 additions
and
40 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
springBootService/src/main/java/de/hswhameln/isbnvalidator/IsbnvalidatorApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
springBootService/src/main/java/de/hswhameln/isbnvalidator/dto/ValidationRequest.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
springBootService/src/main/java/de/hswhameln/isbnvalidator/dto/ValidationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package de.hswhameln.isbnvalidator.dto; | ||
|
||
public class ValidationResponse { | ||
private String isbn; | ||
|
||
|
||
private boolean valid; | ||
private String message; | ||
|
||
public ValidationResponse() { | ||
|
||
} | ||
|
||
public ValidationResponse(String isbn, boolean valid, String message) { | ||
this.isbn = isbn; | ||
this.valid = valid; | ||
this.message = message; | ||
} | ||
|
||
public String getIsbn() { | ||
return isbn; | ||
} | ||
|
||
public void setIsbn(String isbn) { | ||
this.isbn = isbn; | ||
} | ||
|
||
public boolean isValid() { | ||
return valid; | ||
} | ||
|
||
public void setValid(boolean valid) { | ||
this.valid = valid; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
} |
18 changes: 11 additions & 7 deletions
18
springBootService/src/main/java/de/hswhameln/isbnvalidator/utils/ISBNAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
package de.hswhameln.isbnvalidator.utils; | ||
|
||
import de.hswhameln.isbnvalidator.dto.ValidationResponse; | ||
import de.hswhameln.isbnvalidator.exceptions.ISBNValidatorNotAccessibleException; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ISBNAPI { | ||
private static final Logger logger = LoggerFactory.getLogger(ISBNAPI.class); | ||
|
||
public static boolean validateISBN(String isbn) { | ||
logger.info("Start Rest-call to validateISBN for isbn: " + isbn); | ||
RestConsumer isbnValidator = RestConsumer.getInstance(); | ||
JSONObject response = isbnValidator.getRequest("/ValidateISBN", isbn); | ||
try { | ||
return response.getBoolean("valid"); | ||
} catch (JSONException e) { | ||
throw new ISBNValidatorNotAccessibleException(); | ||
} | ||
ValidationResponse response = isbnValidator.getRequest("/ValidateISBN", isbn); | ||
return response.isValid(); | ||
} | ||
|
||
/* | ||
public static int getCheckDigit(String isbn) { | ||
logger.info("Start Rest-call getCheckDigit for isbn: " + isbn); | ||
RestConsumer isbnValidator = RestConsumer.getInstance(); | ||
JSONObject response = isbnValidator.getRequest("/checkDigit", isbn); | ||
ValidationRe response = isbnValidator.getRequest("/checkDigit", isbn); | ||
try { | ||
return response.getInt("checkDigit"); | ||
} catch (JSONException e) { | ||
throw new ISBNValidatorNotAccessibleException(); | ||
} | ||
} | ||
*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters