Does extent report community edition has support for extentx server - extentreports

I am trying to use the extent report with TestNG framework.
I am referring the following page to configure TestNG for extent report.
http://extentreports.com/docs/versions/2/java/#testng-example
This works fine after few changes in the code, and I am able to see the HTML report generated in the directory I have configured.
However, I am not able to figure out how to upload these result to extentx server.
I have configured the server as mentioned below.
http://extentreports.com/docs/extentx/
the problem is, there is no method x on extent object.
private void init() {
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(OUTPUT_FOLDER + FILE_NAME);
htmlReporter.config().setDocumentTitle("ExtentReports - Created by TestNG Listener");
htmlReporter.config().setReportName("ExtentReports - Created by TestNG Listener");
htmlReporter.config().setTestViewChartLocation(ChartLocation.BOTTOM);
htmlReporter.config().setTheme(Theme.STANDARD);
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
extent.setReportUsesManualConfiguration(true);
extent.x("loclahost", "1337"); //No Such Method
}
I am using latest version of extent report 3.0.3
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.3</version>
</dependency>

ExtentXReporter extentxReporter = new ExtentXReporter("localhost", 27017);
extentxReporter.config().setProjectName(suites.get(0).getName());
extentxReporter.config().setReportName("test");
//then add extentx
extent.attachReporter(htmlReporter,extentxReporter);
You also need to have the mongodb running on localhost by default port is 27017

ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(OUTPUT_FOLDER + FILE_NAME);
ExtentXReporter extentxReporter = new ExtentXReporter("mongodb-host", mongodb-port);
ExtentReports extent = new ExtentReports();
extent.attachReporter(htmlReporter,extentxReporter);

Related

Error when using SDK while offline: calculateRoute returns GRAPH_DISCONNECTED

After updating HERE SDK to version 3.12 we started getting a GRAPH_DISCONNECTED error when calling calculateRoute method of CoreRouter class (Wifi and mobile data turned off).
Update
This is how we are creating and using CoreRouter:
val routeOptions = RouteOptions().apply {
transportMode = TransportMode.SCOOTER
routeType = RouteOptions.Type.FASTEST
routeCount = 1
}
val routePlan = RoutePlan()
routePlan.routeOptions = routeOptions
val fromGeoCoordinate = GeoCoordinate(from.latitude, from.longitude)
val destinationGeoCoordinate = GeoCoordinate(destination.latitude, destination.longitude)
routePlan.addWaypoint(RouteWaypoint(fromGeoCoordinate))
routePlan.addWaypoint(RouteWaypoint(destinationGeoCoordinate))
val coreRouter = CoreRouter()
coreRouter.connectivity = CoreRouter.Connectivity.DEFAULT
coreRouter.calculateRoute(
routePlan,
object : Router.Listener<List<RouteResult>, RoutingError> {
override fun onCalculateRouteFinished(routes: List<RouteResult>?, error: RoutingError?){
Log.d(TAG, "onCalculateRouteFinished")
}
override fun onProgress(p0: Int) {
Log.d(TAG, "onProgress")
}
})
Android version: 8.1.0
Currently, we are using version 3.9.0 which works fine in the same scenario.
Is there something else we need to do on our side to get it working with the new version?
In our latest release (3.16), you have to follow these steps to download and preload maps for offline use:
Map Package Download
The second method of getting offline maps capabilities is enabled through the use of MapLoader and its associated objects. The MapLoader class provides a set of APIs that allow manipulation of the map data stored on the device. Operations include:
getMapPackages() - to retrieve the map data state on the device
installMapPackages(List packageIdList) - to download and install new country or region data
checkForMapDataUpdate() - to check whether a new map data version is available
performMapDataUpdate() - to perform a map data version update if available
The complete documentation with snippets are at:
https://developer.here.com/documentation/android-premium/3.16/dev_guide/topics/routing-offline.html

Error Connect Database Sqlite in Mule Connector

I want to connect and select database Sqlite on Mule AnypointStudio. But it error. Please help me. Thanks all.
No suitable driver found for jdbc:sqlite
here my code:
#Processor (name="select" ,friendlyName ="select")
public void select() {
ArrayList<Story> list = new ArrayList<Story>();
String sql = "select * from chat";
try (Connection conn = this.connect();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql)){
// loop through the result set
while (rs.next()) {
Story s = new Story();
s.setStory(rs.getInt("id"), rs.getString("user_chat"),rs.getString("bot_chat"));
list.add(s);
}
} catch (SQLException | ClassNotFoundException e) {
System.out.println(e.getMessage());
}
for (int i =0 ; i < list.size(); i++){
System.out.print(list.get(i).GetID() +"| "+ list.get(i).GetUserChat() + "| "+ list.get(i).GetBotChat() +"\n" );
}
}
private Connection connect() throws ClassNotFoundException {
// SQLite connection string
Class.forName("org.sqlite.JDBC");
String url = "jdbc:sqlite:C:\\data.db";
Connection conn = null;
try {
conn = DriverManager.getConnection(url);
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return conn;
}
}
Make sure You have valid jar/driver in your project classpath.
Open new Mule Project in Studio, and then follow these steps to add/create a datasource in mule flow:
a. Import the driver
b. Create a Datasource,
c. Create a Connector that uses our Datasource, and finally
d. Create a simple flow that uses our connector.
It seems you are missing driver jar in project classpath.
How to Import the Driver?
Once you have the jar file(you can download jar respective to sqllite from some repo ,eg- maven_repo), the next steps are very simple:
In the Package Explorer,
Right-click over the Project folder
Look in the menu for Build Path > Add External Archives…
Look for the jar file in your hard drive and click Open.
Now you should see in the package explorer that the jar file is present in “Referenced Libraries.”
This will allow you to create an insta
nce of the Object driver you will need.
It's probably a classpath issue. If you are using Maven with your project, simply add the dependency in your pom.xml (and right click on your project > Mule > Update project dependencies):
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.20.1</version>
<scope>test</scope>
</dependency>
Make sure you understand how Maven works and how to manipulate your pom.xml file. Maven getting started and POM Introduction might help.
If you are not using Maven, you need to manually import the dependency in your classpath. #Malesh_Loya answer should help.

How to generate swagger.json [duplicate]

This question already has answers here:
How to export swagger.json (or yaml)
(7 answers)
Closed 3 years ago.
I am using java spring boot framework to create REST api for my project and I am using "springfox-swagger2 and springfox-swagger-ui" for generating swagger documentation. I am able to see my documentation using the URL http://localhost:8080/swagger-ui.html.
How can I create or generate swagger.json / spec.json, The documentation should not be with this application, we are using a separate application for listing the API docs.
You can get the url with your swagger-ui html page:
GET http://localhost:8080/v2/api-docs?group=App
And actually you can get all the urls with chrome/firefox develop tools network feature.
If you use Maven, you can generate client and server side documentation (yaml, json and html) by using swagger-maven-plugin
Add this to your pom.xml:
.....
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>com.yourcontrollers.package.v1</locations>
<schemes>http,https</schemes>
<host>localhost:8080</host>
<basePath>/api-doc</basePath>
<info>
<title>Your API name</title>
<version>v1</version>
<description> description of your API</description>
<termsOfService>
http://www.yourterms.com
</termsOfService>
<contact>
<email>your-email#email.com</email>
<name>Your Name</name>
<url>http://www.contact-url.com</url>
</contact>
<license>
<url>http://www.licence-url.com</url>
<name>Commercial</name>
</license>
</info>
<!-- Support classpath or file absolute path here.
1) classpath e.g: "classpath:/markdown.hbs", "classpath:/templates/hello.html"
2) file e.g: "${basedir}/src/main/resources/markdown.hbs",
"${basedir}/src/main/resources/template/hello.html" -->
<templatePath>${basedir}/templates/strapdown.html.hbs</templatePath>
<outputPath>${basedir}/generated/document.html</outputPath>
<swaggerDirectory>generated/swagger-ui</swaggerDirectory>
<securityDefinitions>
<securityDefinition>
<name>basicAuth</name>
<type>basic</type>
</securityDefinition>
</securityDefinitions>
</apiSource>
</apiSources>
</configuration>
</plugin>
........
You can download *.hbs template at this address:
https://github.com/kongchen/swagger-maven-example
Execute mvn swagger:generate
JSon documentation will be generated at your project /generated/swagger/ directory.
Past it on this address :
http://editor.swagger.io
And generate what ever you want ( Server side or Client side API in your preferred technology )
I'm a little late here, but I just figured out that you can open your browser console and find the URL to the GET request that returns the JSON definition for your Swagger docs. The following technique worked for me when mapping my API to AWS API Gateway.
To do this:
Navigate to your Swagger docs endpoint
Open the browser console
Refresh the page
Navigate to the network tab and filter by XHR requests
Right click on the XHR request that ends in ?format=openapi
You can now just copy and paste that into a new JSON file!
I have done this with a small trick
I have added the following code in the end of my home controller test case
import org.springframework.boot.test.web.client.TestRestTemplate;
public class HomeControllerTest extends .... ...... {
#Autowired
private TestRestTemplate restTemplate;
#Test
public void testHome() throws Exception {
//.......
//... my home controller test code
//.....
String swagger = this.restTemplate.getForObject("/v2/api-docs", String.class);
this.writeFile("spec.json", swagger );
}
public void writeFile(String fileName, String content) {
File theDir = new File("swagger");
if (!theDir.exists()) {
try{
theDir.mkdir();
}
catch(SecurityException se){ }
}
BufferedWriter bw = null;
FileWriter fw = null;
try {
fw = new FileWriter("swagger/"+fileName);
bw = new BufferedWriter(fw);
bw.write(content);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
if (fw != null)
fw.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
I don't know this is right way or not But it is working :)
Dependency
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
You should be able to get your swagger.json at
http://localhost:8080/api-docs
assuming your don't have kept the versioning as in the pet store sample application. In that case the URL would be:
http://localhost:8080/v2/api-docs
To get the api json definition for REST API, if swagger is configured properly. you can use directly swagger/docs/v1, this means the complete url will be, if version v1 (or just specify the version)
http://localhost:8080/swagger/docs/v1

Dynamics AX 2012 RegConfig does not work

I'm currently developping a failover service for an environment using Dynamics AX and 2 mirrored SQL servers, and I have some issues getting AX to work the way I expect it to.
I have developped a service which does the following :
- try to connect to the SQL servers instances
- start Dynamics AX using the reachable SQL server.
To do this, I have created 2 AX configuration files (.axc), each one pointing to a SQL server.
But when I try to start the service, no mater which way I use, AX always start using the configuration that is set using the AX server configuration tool.
Here are the command I've tried to start the AX service :
sc start AOS60$01 -regConfig=Config1
net start AOS60$01 /"-regConfig=Config1"
The service always start successfully, but doesn't care about the regConfig parameter.
As anybody an idea about how to solve this issue?
Regards,
Thomas T.
After looking for a while after a way to start the service with the -regConfig parameter, I finally gave up and developped a method which directly edit the Registry key holding the startup configuration value.
private void UpdateRegistry(string parameter)
{
RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\services\\Dynamics Server\\6.0\\01", true);
key.SetValue("Current", parameter, RegistryValueKind.String);
key.Close();
}
public void StartLocalServiceWithCLI(string serviceToStart, string parameter)
{
try
{
UpdateRegistry(parameter);
Process process = new System.Diagnostics.Process();
ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = string.Format("/C sc start {0} ", serviceToStart);
process.StartInfo = startInfo;
process.Start();
logger.WriteInfo(string.Format("Process {0} starting, parameters [{1}]", serviceToStart, parameter));
}
catch (Exception e)
{
logger.WriteError(string.Format("Error starting process {0}, parameters [{1}]\nError details :{2}", serviceToStart, parameter, e.Message));
}
}

Red5: Server application skeleton and helloworld

Can anyone provide an updated application skeleton for a Red5 application? From what I have found the logging system changed from Log4j. I've been looking for some tutorials just to setup everything but can't really find something that simply works.
In addiction, can anyone provide a simple tutorial with a server application and Flex client?
Thanks in advance!
I struggled a lot with that.. This reference worked for me:
http://fossies.org/unix/privat/red5-1.0.0-RC2.tar.gz:a/red5-1.0.0/doc/reference/html/logging-setup.html
The trick was to Remove any log4j.properties or log4j.xml files and Remove any "log4j" listeners from the web.xml
Create a logback-myApp.xml where myApp is the name for your webapp and place it on your webapp classpath (WEB-INF/classes or in your application jar within WEB-INF/lib)
and im my app i did:
import org.slf4j.Logger;
import org.red5.logging.Red5LoggerFactory;
and then:
private static Logger log = Red5LoggerFactory.getLogger(MyClassName.class, "myApp");
the clients actionscript looks like this:
// Initializiing Connection
private function initConnection():void{
nc = new NetConnection();
nc.client = new NetConnectionClient();
nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
nc.connect(rtmpPath.text,true); //Path to FMS Server e.g. rtmp://<hostname>/<application name>
nc.addEventListener("netStatus", publishStream); //Listener to see if connection is successful
}
private function publishStream(event:NetStatusEvent):void{
if(nc.connected){
nsPublish = new NetStream(nc); //Initializing NetStream
nsPublish.attachCamera(Camera.getCamera());
nsPublish.attachAudio(Microphone.getMicrophone()); //Attaching Camera & Microphone
nsPublish.publish(streamName.text,'live'); //Publish stream
mx.controls.Alert.show("Published");
}
else{
mx.controls.Alert.show("Connection Error");
}
}

Resources