Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Currently, my code uses an implementation of slf4j. The logger is fetched using a url (wsdl). Due to this, I am unable to test my code in a stand alone dev env, unless I bring up the giant server which hosts the service. Other than commenting the relevant code, does anyone know of a way I could make my eclipse ignore the usage of org.slf4j,impl.LoggingService in a class? I think an annotation like #Ignore which takes class params would have been fantastic. This could help someone pass those classes as params which being called in code need to be ignored. I am open to writing my own annotation implementations for it. Thank you
SLF4J seperates out the logging API from the underlying implementation, you should be able to switch out the implementation at runtime by selecting a different logging implementation. So for example slf4j-noop.jar that ignores all logging requests.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
The specific problem encountered is mocking context, state stores, and window objects pass into the function process.
Looks like all the examples, e.g., here and here are unit tests at the stream level (e.g., mockStreams, or using EmbeddedKafkaCluster).
If you're looking to test a single processor implementation, and need to mock context, state stores, etc, I would just use whatever testing tools you ordinarily use to mock things (Mockito, CGLIB, etc).
Beyond the scope of your question, there is also the ProcessorTopologyTestDriver. Posting in case you missed it. Kafka Streams is getting new/improved testing functionality in an upcoming version.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Is there a way to add custom rules to languageTool java API just by appending rules to grammar.xml and keeping it external to the java project?
I want to deploy my java project only once, but keep updating the grammar rules whenever required. I would like to keep the xml file (say grammar.xml) separately from the project, and access it through java code.
Thanks !
It should be possible to load XML rules with PatternRuleLoader and then activate them using JLanguageTool.addRule(). I'm not sure what will happen when you insert the same rule (i.e. a rule with the same id) more than once.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working on a Java application and I have a requirement to connect my application to an Elasticsearch Server.
I am new to both Java and Elasticsearch, and am unsure how to proceed. I couldn't find any documentation that made sense.
Can anybody please guide me. Thanks in advance.
Elasticsearch is itself written in Java, and has a Java Native Client.
It also has a REST API that allows any language to interact with it (which is more commonly used, and how I connect to it from Java and Python). You will need to use something like the Apache HTTP Components to make the REST calls.
There is another project, Jest, that adds a more Java OO layer on top of the REST calls.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
We wanted to provide the security for the class file in the war file, beuase if you share the war file to customer he can open and see our code by using some de-compiler available in the market. So i want to restrict that, how can i encrypt that class or any some other way to avoid that lap. And that new war(After enabling the security), it should be executed by the web/application server.
Kindly help me.
Honestly though, what makes you think the client will care enough to use man hours to start going through decompiled code?
They buy a licence from you to use your product, they get support from you, they're happy. They're probably not going to be interested in going through the WAR. Your product may seem extra special to you, but trust me, it's not to other people.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am kind of stuck in a dilemma. I want to create a tool that would generate code on the fly by taking various parameters from the user. The codes have a few similar features and few things need to be altered from one code to other to other. Based on the parameters, I can have 15 different codes. Till now I have been using file handling in Java to implement this as I have the created codes in different files but this doesn't seem to be a great method. Can you please suggest something that is better than this??
Since Java 1.6 you can compile in memory whatever you want. Take a look at this code:
http://code.google.com/p/cachos/source/browse/trunk/cachos/src/com/peyrona/cachos/InMemoryCompiler.java
http://code.google.com/p/cachos/source/browse/trunk/cachos/src/com/peyrona/cachos/InMemoryExecutor.java
In this example you can see how you can compile a source code stored in a String in memory, without using the disk.
Source (Spanish): http://www.javahispano.org/portada/2011/12/12/compilar-y-ejecutar-codigo-java-en-memoria.html
I think this is what you're looking for.