Specifying the helmet interface with Vorto - bosch-iot-suite

how to simply do the smoke test with vorto?
use vorto to integrate ditto and devices
in the topo, device-hono-vorto-ditto, we want the simplist way to test the workflow, is there any method?

I assume you are using the Vorto Semantic Middleware between Eclipse Hono and Eclipse Ditto, similar to https://github.com/eclipse/vorto-examples/tree/master/vorto-dashboard/docs/AssetTracking.md
The following tutorial, it is described how to set up the pipeline as well as to test it: https://github.com/eclipse/vorto/blob/development/docs/tutorials/create_mapping_pipeline.md
This tutorial does not mention Eclipse Ditto as a consumer of the pipeline, because it is important that the basic (Device-Hono-Vorto) pipeline works first before adding Eclipse Ditto in the equation.
Does your mapped / semantic data of the helmet appear in the middleware logs correctly ?

Related

Which kind of test should I use for a library?

I'm developing a PHP library that I'd like to use in different projects. The library uses a REST-like service in the background. I don't want to write tests for the service API, but for the library.
Would I need to write unit tests? Or functional tests? Since it is a library I won't write acceptance test - I hope this is correct.
I don't know if this is important for the issue, but the library needs to login into the service API and uses an API-key for the next operations. Also, when the library gets tested, the operations before are important. It is a designer tool and I have operations like 'move rectangle', 'rotate rectangle' and so on and I would like to test several operations in a sequence that should bring a certain result.
I think that this is a kind of functional test. Or do I need both? Can unit tests work with a service in the background?

What's the correct way to observe on the UI thread

I'm building observables over the Geolocator and events must be subscribed on the UI thread.
Is ObserveOnDispatcher deprecated?
ObserveOnDispatcher() is not deprecated, but as Paul says it's generally better to provide an explicit scheduler so you can inject a TestScheduler for unit testing.
DispatcherScheduler.Current can be used to obtain the current DispatcherScheduler - not .Instance, which makes sense since there can actually be more than one - although most people shouldn't need to go down that particular road!
ObserveOnDispatcher() and DispatcherScheduler are present in the Windows Phone 8 Rx build. They are in the rx-xaml nuget package which contains xaml platform specific elements - you would have missed this if you just included rx-main.
Specifically, they are located in the System.Reactive.Windows.Threading.dll assembly. ObserveOnDispatcher() is on the System.Reactive.Linq.DispatcherObservable type, and the assembly also has System.Reactive.Concurrency.DispatcherScheduler.
I usually write:
.ObserveOn(DispatcherScheduler.Instance)
if I'm not using ReactiveUI. If I am, it's
.ObserveOn(RxApp.MainThreadScheduler)
The difference being, that in a unit test runner, RxApp.MainThreadScheduler is automatically rigged to be CurrentThread, so your unit tests pass - otherwise they'll all hang.

Inject CDI bean in a Junit test script

I have an application running on JBoss AS 7.1.1. This app uses some resources of CDI specification as interceptors, injection, etc. The architecture of my app is very simple with the structure below:
view (xhtml and facelets)
controller (managed beans with #Named, except in the ViewScoped)
model (divided in two layers, service and dao)
service (with #Stateless annotation, here I use an interceptor that I created to manage the transactions with database, because I use native JDBC)
dao
I need to create some scripts to test the application service layer, injecting the service implementation and invoking the business methods.
I believe that this architecture is very common. I'm sorry for my english.
Can someone help me, please?
Thanks!
If you want to test your full container, you probably want Arquillian. If you want to do Unit testing with mocks, start a standalone weld container in your test using weld-se.
new Weld().initialize().instance().select(YourClassName.class).get();
You can substitute your mock objects by using alternatives in your beans.xml. You can also use CDI-Unit which simplifies the process a bit.

What makes up the "standard jmock libraries"?

I'm following this guide http://javaeenotes.blogspot.com/2011/06/short-introduction-to-jmock.html
I've received the error
java.lang.SecurityException: class "org.hamcrest.TypeSafeMatcher"'s signer information does not match signer information of other classes in the same package.
In the guide the author says:
The solution is make sure the jMock libraries are included before the
standard jUnit libraries in the build path.
What makes up the "standard jmock libraries" and the "junit libraries"?
Junit only has one jar so that's easy, but jmock comes with over 10 different jars.
I've been using: j-unit4.10, jmock-2.5, hamrest-core and hamcrest-library
What are the hamcrest core and library classes for?
i'm a committer on both libraries. JMock depends on hamcrest to help it decide whether an call to an object is expected. I suggest just using the hamcrest-all jar. The split between hamcrest core and library was to separate the fundamental behaviour of matching and reporting differences from a convenient implementations of the most common cases.
Finally, if you're using hamcrest, I suggest you use the junit-dep jar to avoid clashes with some features of hamcrest that are included in the junit.jar
JUnit is used to do Unit test in order to test your methods. JMock is used to test your program inside a context, You will have to know what you are expecting to send to the context (ENV) and what will answer the context.
JMock use JUnit, that is why, in order to avoid dependency conflicts, you need to include it before JUnit.
The 10 libraries of JMock are kind of add-ons if you need to use JMock script or any other functionnality not available in the JMock core.
You don't need to know about Hamcrest-core library to use JMock. Just follows the guide on the web site (don't use version 1 of JMock) and Organize your libraries in the correct order (JUnit should be last in order to avoid your error)
mock frameworks licke jmock do some black magic behind the scenes
( including, but not limited to runtime byte code manipulation )
to provide mock methods classes and whatever. To be able to do this,
some tweaks in basic junit classes are necessary, and the only way to do this is to
register itself as java agent before JU classes are loaded.
Also, put your mock framework before junit in classpath

How to do integration testing?

There is so much written about unit testing but I have hardly found any books/blogs about integration testing? Could you please suggest me something to read on this topic?
What tests to write when doing integration testing?
what makes a good integration test?
etc etc
Thanks
Anything written by Kent Beck, father of both JUnit and SUnit, is a great place to start (for unit tests / test writing in general). I'm assuming that you don't mean "continuous integration," which is a process-based build approach (very cool, when you get it working).
In my own experience, integration tests look very similar to regular unit tests, simply at a higher level. More mock objects. More state initialization.
I believe that integration tests are like onions. They have layers.
Some people prefer to "integrate" all of their components and test the "whole" product as an the "integration" test. You can certainly do this, but I prefer a more incremental approach. If you start low-level and then keep testing at higher composition layers, then you will achieve integration testing.
Maybe it is generally harder to find information on integration testing because it is much more specific to the actual application and its business use. Nevertheless, here's my take on it.
What applies to unit-tests also applies to integration tests: modules should have an easy way to mock their externals inputs (files, DB, time...), so that they can be tested together with the other unit-tests.
But what I've found extremely useful, at least for data-oriented applications, is to be able to create a "console" version of the application that takes input files that fully determine its state (no dependencies on databases, network resources...), and outputs the result as another file. One can then maintain pairs of inputs / expected results files, and test for regressions as part of nightly builds, for example. Having this console version allows for easier scripting, and makes debugging incredibly easier as one can rely on a very stable environment, where it is easy to reproduce bugs and to run the debugger.
J.B. Rainsberger has written about them. Here's a link to an InfoQ article with more info.
http://www.infoq.com/news/2009/04/jbrains-integration-test-scam