1 package org.onap.appc.data.services.node;
3 import static org.mockito.Matchers.any;
4 import static org.mockito.Matchers.anyString;
5 import static org.mockito.Matchers.eq;
6 import static org.mockito.Mockito.doReturn;
7 import static org.mockito.Mockito.mock;
8 import org.onap.appc.data.services.db.DGGeneralDBService;
9 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
10 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
11 import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
13 class MockDbServiceBuilder {
15 private final DGGeneralDBService dbServiceMock;
17 MockDbServiceBuilder() throws SvcLogicException {
18 dbServiceMock = mock(DGGeneralDBService.class);
20 doReturn(SvcLogicResource.QueryStatus.SUCCESS)
22 .getConfigFileReferenceByFileTypeNVnfType(any(SvcLogicContext.class), anyString(), anyString());
25 MockDbServiceBuilder getConfigFileReferenceByFileTypeNVnfType(String prefix, String fileType, SvcLogicResource.QueryStatus status) throws SvcLogicException {
28 .getConfigFileReferenceByFileTypeNVnfType(any(SvcLogicContext.class), eq(prefix), eq(fileType));
33 public MockDbServiceBuilder getDeviceProtocolByVnfType(String prefix, SvcLogicResource.QueryStatus status) throws SvcLogicException {
36 .getDeviceProtocolByVnfType(any(SvcLogicContext.class), eq(prefix));
41 public MockDbServiceBuilder getConfigureActionDGByVnfTypeNAction(String prefix, SvcLogicResource.QueryStatus status) throws SvcLogicException {
44 .getConfigureActionDGByVnfTypeNAction(any(SvcLogicContext.class), eq(prefix));
49 public MockDbServiceBuilder getConfigureActionDGByVnfType(String prefix, SvcLogicResource.QueryStatus status) throws SvcLogicException {
52 .getConfigureActionDGByVnfType(any(SvcLogicContext.class), eq(prefix));
57 public MockDbServiceBuilder getTemplate(String prefix, String fileCategory, SvcLogicResource.QueryStatus status) throws SvcLogicException {
60 .getTemplate(any(SvcLogicContext.class), eq(prefix), eq(fileCategory));
65 public MockDbServiceBuilder getTemplateByVnfTypeNAction(String prefix, String fileCategory, SvcLogicResource.QueryStatus status) throws SvcLogicException {
68 .getTemplateByVnfTypeNAction(any(SvcLogicContext.class), eq(prefix), eq(fileCategory));
73 public MockDbServiceBuilder getTemplateByTemplateName(String prefix, String fileCategory, SvcLogicResource.QueryStatus status) throws SvcLogicException {
76 .getTemplateByTemplateName(any(SvcLogicContext.class), eq(prefix), eq(fileCategory));
81 public MockDbServiceBuilder saveConfigFiles(String prefix, SvcLogicResource.QueryStatus status) throws SvcLogicException {
84 .saveConfigFiles(any(SvcLogicContext.class), eq(prefix));
89 public MockDbServiceBuilder getMaxConfigFileId(String prefix, String fileCategory, SvcLogicResource.QueryStatus status) throws SvcLogicException {
92 .getMaxConfigFileId(any(SvcLogicContext.class), eq(prefix), eq(fileCategory));
97 public MockDbServiceBuilder savePrepareRelationship(String prefix, String field, String sdnc, SvcLogicResource.QueryStatus status) throws SvcLogicException {
100 .savePrepareRelationship(any(SvcLogicContext.class), eq(prefix), eq(field), eq(sdnc));
105 DGGeneralDBService build() {
106 return dbServiceMock;