Class MockResourceStorage

  • All Implemented Interfaces:
    ResourceStorage

    public class MockResourceStorage
    extends Object
    implements ResourceStorage
    Mock for the ResourceStorage based on a HashMap
    Author:
    https://github.com/mcweba [Marc-Andre Weber]
    • Constructor Detail

      • MockResourceStorage

        public MockResourceStorage()
      • MockResourceStorage

        public MockResourceStorage​(Map<String,​String> initalMockData)
    • Method Detail

      • putMockData

        public void putMockData​(String key,
                                String value)
      • failPutWith

        public void failPutWith​(Integer value)
      • failDeleteWith

        public void failDeleteWith​(Integer value)
      • getMockData

        public Map<String,​String> getMockData()
        Synchronous access to the mocked data
      • get

        public void get​(String path,
                        io.vertx.core.Handler<io.vertx.core.buffer.Buffer> bodyHandler)
        Specified by:
        get in interface ResourceStorage
      • put

        public void put​(String uri,
                        io.vertx.core.MultiMap headers,
                        io.vertx.core.buffer.Buffer buffer,
                        io.vertx.core.Handler<Integer> doneHandler)
        Description copied from interface: ResourceStorage

        Under normal operation 'doneHandler' is called with the result. BUT: There are some impl which sometimes call it with 'null' as its value. It looks like this indicates that there was some kind of error. Most of the time impl knows exactly what the error was. But there is no way that it would report it to the caller (because this API does not provide a way to do so).

        There is yet another special case: Some impls in some cases do NOT call 'doneHandler' at all. So there is no way to know what happened behind the scene.

        Specified by:
        put in interface ResourceStorage
      • put

        public void put​(String uri,
                        io.vertx.core.buffer.Buffer buffer,
                        io.vertx.core.Handler<Integer> doneHandler)
        Specified by:
        put in interface ResourceStorage