Is there any C# client anyone know about that we can use to run queries against SumoLogic? I see they have a Java Client but cannot find a corresponding C# client.
You can use SumoLogicMessageSender class.
You can find using this class here.
But, I don't recommend to use GetResult() like it writes in original code :
// this maintains synchronous behavior for single event scenarios.
this.SumoLogicMessageSender
.TrySend(bodyBuilder.ToString(), this.SourceName, this.SourceCategory, this.SourceHost)
.GetAwaiter()
.GetResult();
Related
We have a requirement where we need to send .avro file as an input request to our API's. Really stuck at this point. If any detail example provided would be more appreciated.
Just use Java interop: https://github.com/intuit/karate#calling-java
You need to write a helper (start with a static method) to convert JSON to Avro and vice versa. I know teams using this for gRPC. Read this thread for tips: https://github.com/intuit/karate/issues/412
Also there is even a "karate-grpc" project: https://github.com/pecker-io/karate-grpc
Also see:
https://twitter.com/KarateDSL/status/1128170638223364097
https://twitter.com/KarateDSL/status/1417023536082812935
Besides REST-API Calls, I need to call my own Java-Class, which basically does something, which I want to confirm later in the test via REST-API-Calls.
When calling my Java-Class, there is an expected behavior: It may fail or not fail, depending on the actual Test-Case.
Is there any chance to code this expectation this into my test-class:
java("com.org.xyz.App").method("run").methodArgs(args).build();
As this is the Main-Class, which should be executed later in a automated fashion, I would prefer to validate the Return-Code.
However, I'm looking for any possible way (Exception-Assertion, Stdout-Check, ..) to verify the status of the program.
As you are using the Java DSL to write test cases I would suggest to go with custom test action implementation and/or initializing your custom class directly in the test method and call the method as you would do with any other API.
You can wrap the custom code in a custom AbstractTestAction implementation as you then have access to the TestContext and your custom code is integrated into the test action sequence.
The java("com.org.xyz.App").method("run").methodArgs(args) API is just for compliance to the XML DSL where you do not have the opportunity to initialize own Java class instances. Way too complicated for your requirement in my opinion.
As of Retrofit2 2.3.0 there seems to be no built in functionality to execute a JSON Patch Request (as defined in RFC 6902. Also, see http://jsonpatch.com/ for some examples).
Using the available #PATCH annotation, the full blown object is sent with the request (as if I would send a PUT request, which is not what I'm looking for)
public interface MyService {
#PATCH("example/{id}")
Call<Example> patchExample(#Path("id") String id, #Body Example example);
}
After a first glance at the Retrofit documentation, there seems to be no clean and easy way to introduce a custom annotation (e.g. #JSONPATCH) to have my own implementation working.
The only related information I was able to find regarding this requirement was this experimental (as he calls it himself --> this is very experimental but it does the job currently) approach at https://medium.com/#andretietz/custom-annotations-with-retrofit-2-8701ca7ce102. I didn't give this example a try, but the complexity seems a little bit out of scale for this simple requirement.
Maybe I'm missing something and there is an easy solution for this?
I am creating HTTP request using Apache HTTP Client version 4.3.4. I see there are some classes like HttpGet,... and there is also a class BasicHttpRequest. I am not sure which one to use.
Whats the difference and which one should be used in which condition ?
BasicHttpRequest is provided by the core library. As its name suggests it is pretty basic: it enforces no particular method name or type, nor does it attempt to validate the request URI. The URI parameter can be any arbitrary garbage. HttpClient will dutifully transmit it to server as is, if it is unable to parse it to a valid URI.
HttpUriRequest variety on the other hand will enforce specific method type and will require a valid URI. Another important feature is that HttpUriRequest can be aborted at any point of their execution.
You should always be using classes that implement HttpUriRequest per default.
I was just browsing the 4.3.6 javadoc attempting to locate your BasicHttpRequest and was unable to find it. Do you have a reference to the javadoc of this class?
I would be under the impression that BasicHttpRequest would be a base class providing operations and attributes common to more than one HttpRequest. It may be extremely generic for extension purposes.
To the first part of your question, use HttpGet, HttpPost etc for their specific operations. If you only need to HTTP/GET information then use HttpGet, if you need to post a form or document body, then use HttpPost. If you are attempting to use things like the Head, Put, Delete method, then use the correspoding HttpXXX class.
Is there an easy way to use SerializationStreamWriter for custom purposes without writing an own generator?
(for example html5 storage)
The javadoc of GWT tells very little.
We are writing an implementation for our current project, which does exactly what you want do: serialize an custom object into string and save it into the localstorage, deserialize the string into an object...
So, for me, it is possbile, to use SerializationStreamWriter for serialization, and use SerializationStreamReader for deserialization in CLIENT SIDE.
To realize this,
you don't need a generator for SerializationStreamWriter/SerializationStreamReader, but a generator for TypeSerializer (which implements com.google.gwt.user.client.rpc.impl.SerializerBase). And this is quiet simple, take a look at com.google.gwt.user.rebind.rpc.TypeSerializerCreator, and use it in your generator. OR, if all your custom objects are referenced in one RPC service, you can just use the generated rpc service's TypeSerializer.
And you must write a proper implementation of SerializationStreamWriter OR SerializationStreamReader. Because there has two serialized string formats(request used format and response used format):
IN GWT, you have
ClientSerializationStreamWriter, ClientSerializationStreamReader for client side serialization/deserialization;
ServerSerializationStreamWriter, ServerSerializationStreamReader for server side serialization/deserialization;
Client SerializationStream Writer will serialize the object into FORMAT_1, and only Server SerializationStream Reader can read it (deserialize it into object).
Server SerializationStream Writer will serialize the object into FORMAT_2, and only Client SerializationStream Reader can read it (deserialize it into object).
so what you need to do, if you want to use ClientSerializationStreamWriter to serialize your object, then write a similar implementation of ServerSerializationStreamReader for client side. Or if you want to use ClientSerializationStreamWriter to deserialize the string, then write a similar implementation of ServerSerializationStreamWriter in client side. This is not difficult, because the difference between FORMAT_1 and FORMAT_2 is just the order.
No.
Because the GWT-RPC serialization is asymmetric, it cannot be used for local storage: the server understands what the client sent, the client understands what the server sent, but they won't understand what they themselves wrote.