Skip to content

Commit

Permalink
Merge pull request #4 from ODMDev/synchro
Browse files Browse the repository at this point in the history
synchro
  • Loading branch information
gaelcrova authored Mar 24, 2022
2 parents f852f72 + c3d925f commit 31126d8
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.ssl.SSLContexts;

public class RESTJSONJavaClient {

Expand All @@ -40,7 +42,13 @@ public class RESTJSONJavaClient {
* @throws Exception
*/
public static synchronized CloseableHttpClient getClient() throws Exception {
CloseableHttpClient client = HttpClients.createDefault();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
SSLContexts.createDefault(),
new String[] { "TLSv1.2" },
null,
SSLConnectionSocketFactory.getDefaultHostnameVerifier());

CloseableHttpClient client = HttpClients.custom().setSSLSocketFactory(sslsf).build();
return client;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ public String validate(JsonObject json) {
String result = "";
String server = json.getString("server");
String ruleset = json.getString("ruleset");
String instanceType = json.getString("instanceType");
String url = "https://" + server +"/odm/" +
instanceType + "/DecisionService/rest/v1/" + ruleset;
String url = server + "/rest/v1/" + ruleset;
boolean showTrace = (boolean) json.getBoolean("showTrace");
result = validateWithJRules(loan, borrower, url, json, showTrace);
System.out.println(result);
Expand Down
97 changes: 46 additions & 51 deletions miniloan-server/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
<body>
<div class="container">
<div class="jumbotron">
<h1>ODM on cloud Sample</h1>
<h1>ODM SaaS Sample</h1>
<p id="sample-name" class="lead">Loan request approval application</p>
<hr class="my-4">
<p>Calls the ODM on cloud execution server to run a decision to approve or not a loan request.</p>
<p>Run a decision to approve or not a loan request through ODM on Cloud or CP4BA aaS Decision Service.</p>
</div>
<div>
<form role="form" action="validate" method="post" class="form-horizontal">
Expand Down Expand Up @@ -169,52 +169,49 @@ <h4>Loan</h4>
</div>
</div>
<!-- Tab -->
<div id="execution" class="tab-pane">
<div id="execution" class="tab-pane" >
<div class="card">
<div class="card-header">
<h4>Rule Execution Server information</h4>
<h4>Decision Service information</h4>
</div>
<div class="card-body">
<div class="row">
<div class="input-group col-md-6 mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Tenant URL</span>
</div>
<input id="server" type="text" class="form-control" id="server" name="server" value="[YourPortal].com" placeholder="Server">
</div>
<div class="input-group col-md-4 mb-3">
<div class="input-group-prepend">
<span class="input-group-text">User name</span>
</div>
<input
id="user" type="text" class="form-control" name="user" placeholder="user" value="user@my_domain.com">
</div>
<div class="form-check col-md-2 mb-3">
<label>
<input type="checkbox" name="trace" id="trace">Trace enabled</label>
</div>
<div class="input-group col-md-6 mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Ruleset</span>
</div>
<input type="text"
class="form-control" id="ruleset" name="ruleset" value="Miniloan/Miniloan_ServiceRuleset" placeholder="Ruleset">
</div>
<div class="input-group col-md-4 mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Password</span>
</div>
<input
id="password" type="password" class="form-control" name="password" placeholder="Password">
</div>

<div id="instanceChoice" class="col-md-2 mb-3>
<label class="radio-inline"> <input checked="checked" type="radio" value="dev" name="instanceType">Dev</label>
<label class="radio-inline"><input type="radio" value="test" name="instanceType">Test</label>
<label class="radio-inline"><input type="radio" value="prod" name="instanceType">Prod</label>
</div>

</div>
<div class="form-group col-md-12">
<div class="row">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Decision Service URL</span>
</div>
<input id="server" type="text" size="50" class="form-control" id="server" name="server" value="https://<hostname>.<domain>/odm/prod/DecisionService" placeholder="Server">
</div>
</div>
<div class="row">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">User name</span>
</div>
<input
id="user" type="text" class="form-control" name="user" placeholder="user" value="user@my_domain.com">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Password</span>
</div>
<input
id="password" type="password" class="form-control" name="password" placeholder="Password">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Ruleset</span>
</div>
<input type="text"
class="form-control" id="ruleset" name="ruleset" value="Miniloan/Miniloan_ServiceRuleset" placeholder="Ruleset">
</div>
<div class="form-check">
<label>
<input type="checkbox" name="trace" id="trace">Trace enabled</label>
</div>
</div>
</div>
</div>
</div>
</div>
Expand All @@ -228,13 +225,11 @@ <h4>Rule Execution Server information</h4>
</div>
</form>
</div>
<div class="row top15">
<div id="info-panel" class="card">
<div id="info-header" class="card-header">Response</div>
<div id="info-text" class="card-body" >nothing for now...</div>
</div>
</div>
<div id="info-panel" class="card">
<div id="info-header" class="card-header">Response</div>
<div id="info-text" class="card-body" >nothing for now...</div>
</div>
</div>

</body>
</html>
</html>
1 change: 0 additions & 1 deletion miniloan-server/src/main/webapp/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ $(document).ready(
'ruleset' : $('input[name=ruleset]').val(),
'user' : $('input[name=user]').val(),
'password' : $('input[name=password]').val(),
'instanceType' : $('input[name=instanceType]:checked', '#instanceChoice').val(),
'yearly-income' : parseInt($('input[name=yearly-income]').val()),
'credit-score' : parseInt($('input[name=credit-score]').val()),
'amount' : parseInt($('input[name=amount]').val()),
Expand Down

0 comments on commit 31126d8

Please sign in to comment.