Skip to content

Commit

Permalink
[Rahul] | Changes to test what the understand is
Browse files Browse the repository at this point in the history
  • Loading branch information
rahu1ramesh authored Dec 1, 2023
1 parent 1798255 commit e7eb4ca
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- master
- 'release-*'
- 'velocity-issue-test'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
paths-ignore:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ FeedClient getAtomFeedClient(FeedURI jobName, FeedClientFactory feedClientFactor
AllMarkers allMarkers = new AllMarkersJdbcImpl(transactionManager);
AllFailedEvents allFailedEvents = new AllFailedEventsJdbcImpl(transactionManager);
String isRestEnabled = environment.getProperty(AtomfeedServiceConstants.IS_REST_ENABLED.getAtomfeedServiceConstants());
System.out.println("*******************************************************************");
System.out.println("The Sync will start now for Odoo"+isRestEnabled?"16":"10");
boolean isRestEnabledValue = Boolean.parseBoolean(isRestEnabled);
OpenERPContext openERPContext = isRestEnabledValue ? new OpenERPContext(odooRESTClient) : new OpenERPContext(openERPXMLClient);
return feedClientFactory.getFeedClient(atomFeedProperties, transactionManager, openERPContext, allFeeds, allMarkers, allFailedEvents, jobName, isRestEnabledValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ public OdooRESTClient(OpenERPProperties openERPProperties) {

@Override
public Object execute(OpenERPRequest openERPRequest, String URI) {
System.out.println("-------------REQUEST EXECUTION STARTED-----------------");
String requestBody = RequestBuilder.buildNewRestRequest(openERPRequest, UUID.randomUUID().toString());
System.out.println("Request Body : "+requestBody);
System.out.println("-------------REQUEST EXECUTION ENDED-----------------");
return restClient.post(URI, requestBody);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,30 @@ public OpenERPXMLClient(XMLClient xmlClient, OpenERPProperties openERPProperties

private void login() {
if (id == null) {
System.out.println("-------------LOGIN STARTED-----------------");
XmlRpcClient loginRpcClient = xmlRpcClient(XML_RPC_COMMON_ENDPOINT);

Vector<String> params = new Vector<String>();
params.addElement(database);
params.addElement(user);
params.addElement(password);

Object loginId = executeRPC(loginRpcClient, params, "login");
if(loginId == null || loginId.getClass() != Integer.class)
throw new OpenERPException(String.format("Failed to login. The login id is : %s", loginId));
id = loginId;
System.out.println("-------------LOGIN ENDED-----------------");
}
}

@Override
public Object execute(OpenERPRequest openERPRequest, String URI) {
login();
System.out.println("-------------REQUEST EXECUTION STARTED-----------------");
String request = RequestBuilder.buildNewXMLRequest(openERPRequest, id, database, password);
System.out.println("Request Body : "+request);
String response = httpClient().post("http://" + host + ":" + port + XML_RPC_OBJECT_ENDPOINT, request);
new OpenERPResponseErrorValidator().checkForError(response);
System.out.println("Response Body : "+response);
System.out.println("-------------REQUEST EXECUTION ENDED-----------------");
return response;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ public static String buildNewXMLRequest(OpenERPRequest openERPRequest, Object id
context.put("password", password);
context.put("resource", openERPRequest.getResource());
context.put("operation", openERPRequest.getOperation());

System.out.println("------------------------------");
System.out.println(template.getName());
System.out.println("Context Parameters " + context.get("parametersList"));
System.out.println("Context id " + context.get("id"));
System.out.println("Context database " + context.get("database"));
System.out.println("Context password " + context.get("password"));
System.out.println("Context resource " + context.get("resource"));
System.out.println("Context operation " + context.get("operation"));
StringWriter writer = new StringWriter();
template.merge(context, writer);
System.out.println("writer.toString() = \n" + writer);
System.out.println("------------------------------");
return writer.toString();
} catch (Exception e) {
throw new OpenERPException(e);
Expand All @@ -51,6 +60,9 @@ public static String buildNewRestRequest(OpenERPRequest openERPRequest, String i
context.put("id", id);
StringWriter writer = new StringWriter();
template.merge(context, writer);
System.out.println("------------------------------");
System.out.println("writer.toString() = \n" + writer);
System.out.println("------------------------------");
return writer.toString();
} catch (Exception e) {
throw new OpenERPException(e);
Expand Down

0 comments on commit e7eb4ca

Please sign in to comment.