Tips for creating a script that is compatible with both Java and C++

We currently offer both Java and C++ versions of our distributed messaging system product.

I am in the process of developing a framework to conduct system testing across multiple servers. In order to accomplish this, I need a "test coordinator" process that can send instructions to each server, specifying tasks such as sending a certain number of sample messages or waiting for a specific message.

My idea is to send a script to each server that contains its set of instructions. This way, the test servers can be kept simple, with all the necessary intelligence embedded within the test instructions.

If all our servers were Java-based, I would consider using Groovy or a similar language for this purpose. However, since we also have a C++ implementation, I am exploring the possibility of using Javascript to invoke Java/C++ classes in order to send messages and perform other tasks.

Do you have any suggestions on an effective way to achieve this?

If all else fails, I may resort to creating an XML format to encapsulate the test parameters in a declarative manner, rather than embedding the test instructions imperatively. However, I would prefer not to burden the test servers with additional test-specific logic.

Any guidance you can provide would be greatly appreciated.

Answer №1

If you're interested, you might want to explore LUA. It has strong support in C++ and there are indications of support for Java too (refer to this discussion)

Answer №2

While there are JavaScript parsers available for C++ and Java, it may not be the best idea to use them. The JavaScript code may interact with your Java and C++ code, but if you want the JavaScript code to be ignorant of the underlying language, calling Java/C++ may not make sense as it is language-specific.

Instead of XML, consider using JSON for data exchange, as it is well-supported in Java and C++.

For the most effective solution, consider developing your own domain-specific language and parsers for it in both C++ and Java, although this may require more effort.

Answer №3

The original intention behind WSDL was to promote seamless inter-operability. It seems redundant to create an XML format when SOAP is already capable of fulfilling the same purpose. Introducing another programming language as a bridge between the two systems only adds unnecessary complexity.

My approach would be:

  1. Establish a language-agnostic interface
  2. Develop implementations in both Java and C++

If sending commands to servers is the goal, considering utilizing the Command pattern to encapsulate known commands. Batch Commands using Composite can also be helpful.

The "Test Coordinator" would then construct a batch command, dispatch it to the desired server using the specified service, and the implementations can interpret these commands in language-specific methods. Depending on the commands at hand, it might be suitable for each implementation to utilize tools like Ant or Make.

Answer №4

Have you thought about using CORBA as well? It could be a great solution for your needs!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Mapping YAML file to a Java Map without using a custom deserializer

I have a YAML file that I want to load into a Map instance without having to define a custom deserializer. Is there a way to achieve this using annotations or any other method? Below is an example of the YAML file: - site: First Site url: some_url us ...

"Optimizing the Placement of jPlayer for Your Website

Struggling to properly position jPlayer on my webpage. After consulting jPlayer's documentation, I learned that it is supposed to be absolutely positioned by default. However, it seems to be flowing with the rest of the page content rather than being ...

The Nodejs function exits before the internal function finishes executing

Currently, I am facing an issue where despite MongoDB returning the correct number of users (more than 0) when running console.log within collection.find(), the function userExists always returns false (0). I'm seeking guidance on how to ensure that ...

Creating a banner using four grid elements, with each element containing four child elements, is a simple process that can

Can you assist me in recreating my idea from an image? I am having trouble understanding how to select and place other elements, and then return them to their original positions after deselecting... I attempted to use a grid but it did not work properly. ...

What is the best location for implementing role-based authentication in a MeanJS application?

I am working with a meanJS starter template that includes a yeoman generator. I'm trying to figure out where I can add specific permissions to my modules. For example, 'use strict'; // Configuring the Articles module angular.module(' ...

What is the method for gaining access to variables and functions within bundle.js?

Hello, I am trying to figure out how to access variables in bundle.js. I want to experiment with variables and functions on the client side using JavaScript, but I'm having trouble calling them in index.html or the Chrome console. I use browserify to ...

Prevent a <span> element from affecting the linking functionality of an <a> tag

Is it possible to make a hyperlink clickable without including the <span> tags within it and instead attaching a jQuery event to those tags? This is the code I'm using. It utilizes bootstrap's list-group for a navigation element: <ul cl ...

What could be causing the "Error - Only secure origins are permitted" message to appear for my service worker?

Whenever I attempt to implement a service worker on my progressive web application page, why does the browser console display this specific error message? ERROR "Uncaught (in promise) DOMException: Only secure origins are allowed JavaScript Code: ...

Looking to improve query performance on MongoDB using mongoskin - should you use a single query or

this relates to mongodb {cod_com:'WWWOAN', cod_prod[{prod:'proda',info:'hello world'},{prod:'pacda',info:'hello world'},{prod:'prcdb',info:'hello world'}] } {cod_com:'WWWOA2&a ...

Exploring the integration of methods in Vue.js components

Within my Vuejs project, I developed a new form component and integrated it into the main index component. This new component needs to validate certain fields, with validation methods already created in the parent component. However, I am facing difficulti ...

The issue with Jquery Ajax is that it fails to properly update MySQL values

Greetings, I am currently attempting to utilize AJAX to update data from a modal form. Although I submit the data successfully, it does not reflect the changes in the database. Here is my JavaScript code: <script> jQuery(document).ready(functio ...

Node.js's module-only scope concept allows variables and functions defined within

Currently, I am attempting to create a function that can set a variable at the top-level scope of a module without it leaking into the global scope. Initially, I believed that implicit variable declarations within a module would remain confined to the modu ...

Attempt to generate a function in JavaScript that mirrors an existing one

How can I create a javascript function similar to loadAllOriginal, but with the value of the variable allEmployees being a list of employee objects (ID, FirstName, LastName)? I am attempting to implement this method in combination with autocomplete from ...

Challenges related to urlmon.h in Windows Phone Silverlight 8.1 Runtime Component

I am attempting to utilize the UrlMkSetSessionOption method from the urlmon library in a Windows Phone Silverlight 8.1 application to customize the browser's User Agent string. It appears that Windows Phone Silverlight does not support PInvoke, which ...

When an Ajax post request is made, the data being sent is appended to the JSON response

Having a dilemma with my ajax call: $.ajax({ url: '/assets/functions.php', type: 'POST', data: { "functionCall": "get-uploads", "type": type }, dataType: 'json', success: function (data ...

Although JavaScript Handlebars does not show any errors, it fails to function properly

I've been attempting to update text on my page using handlebars, but unfortunately, it's not functioning correctly and there are no error messages being displayed. The code below is triggered once the user clicks the submit button <button ty ...

Implementing automatic token refreshing and automatic logout features in Vue

I am a novice web developer looking to enhance my skills. For my initial project, I decided to incorporate Laravel and Vue. My main objectives are to: Implement an auto-logout feature after 3 minutes of user inactivity Create an automatic ping to my token ...

Using Javascript to Swap the Content of an Element

Recently, I've been delving into the world of javascript and have hit a roadblock. I understand how to instruct javascript to set a specific value for an ID, but now I have a new challenge: I want to create javascript code that can retrieve informati ...

Setting up Npm Sequelize Package Installation

Could use some help with setting up Sequelize. Here's the current status: https://i.sstatic.net/MQH1I.jpg ...

Error message: "No active session found in Selenium on a linux

Running selenium tests created on a Windows machine, but switching to the linux version of the driver and adding it to the PATH resulted in an org.selenium.NoSUchSessionException error every time. Using the latest browser with the latest driver installed. ...