summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreResourceRequestHandlerFactorySpec.groovy
blob: 3f7a8a5ce207eb1e3fa8ddc45cd515bf8fd04ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package org.onap.cps.ncmp.rest.controller.handlers

import spock.lang.Specification

class NcmpDatastoreResourceRequestHandlerFactorySpec extends Specification {

    def objectUnderTest = new NcmpDatastoreResourceRequestHandlerFactory(null, null)

    def 'Creating ncmp datastore request handlers.'() {
        when: 'a ncmp datastore request handler is created for #datastoreType'
            def result = objectUnderTest.getNcmpDatastoreResourceRequestHandler(datastoreType)
        then: 'the result is of the expected class'
            result.class == expectedClass
        where: 'the following type of datastore is used'
            datastoreType                         || expectedClass
            DatastoreType.OPERATIONAL             || NcmpDatastoreOperationalResourceRequestHandler
            DatastoreType.PASSTHROUGH_OPERATIONAL || NcmpDatastorePassthroughOperationalResourceRequestHandler
            DatastoreType.PASSTHROUGH_RUNNING     || NcmpDatastorePassthroughRunningResourceRequestHandler
    }
}