* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import com.att.eelf.configuration.EELFManager;
import com.att.eelf.i18n.EELFResourceManager;
import java.net.InetAddress;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import java.util.Properties;
-import java.util.TimeZone;
import org.onap.appc.Constants;
import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
/*************************************************/
- private boolean callGraph(Properties props) {
+ protected boolean callGraph(Properties props) {
String moduleName = configuration.getProperty(Constants.PROPERTY_MODULE_NAME);
String methodName = configuration.getProperty(Constants.PROPERTY_TOPOLOGY_METHOD);
String version = configuration.getProperty(Constants.PROPERTY_TOPOLOGY_VERSION);
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications (C) 2019 Ericsson
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.UUID;
import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.common.request.header.CommonRequestHeader;
import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.config.payload.ConfigPayload;
import org.onap.appc.configuration.Configuration;
import org.onap.appc.configuration.ConfigurationFactory;
import org.onap.appc.provider.AppcProvider;
-import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
-import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.internal.verification.VerificationModeFactory.times;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.spy;
-import static org.powermock.api.mockito.PowerMockito.verifyPrivate;
import static org.powermock.api.mockito.PowerMockito.when;
+import java.util.Properties;
@RunWith(PowerMockRunner.class)
-@PrepareForTest({TopologyService.class, ConfigurationFactory.class})
+@PrepareForTest(ConfigurationFactory.class)
public class TopologyServiceTest {
@Mock
private AppcProvider appcProvider;
ConfigPayload configPayload = mock(ConfigPayload.class);
doReturn("url").when(configPayload).getConfigUrl();
doReturn("configJson").when(configPayload).getConfigJson();
- PowerMockito.doReturn(true).when(topologyService, "callGraph", any());
topologyService.modifyConfig(commonRequestHeader, configPayload);
- verifyPrivate(topologyService, times(1)).invoke("callGraph", any());
+ Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class));
}
@Test
UUID uuid = mock(UUID.class);
doReturn("uuid-value").when(uuid).getValue();
doReturn(uuid).when(vnfResource).getVmId();
- PowerMockito.doReturn(true).when(topologyService, "callGraph", any());
topologyService.migrate(commonRequestHeader, vnfResource);
- verifyPrivate(topologyService, times(1)).invoke("callGraph", any());
+ Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class));
}
@Test
UUID uuid = mock(UUID.class);
doReturn("uuid-value").when(uuid).getValue();
doReturn(uuid).when(vnfResource).getVmId();
- PowerMockito.doReturn(true).when(topologyService, "callGraph", any());
topologyService.restart(commonRequestHeader, vnfResource);
- verifyPrivate(topologyService, times(1)).invoke("callGraph", any());
+ Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class));
}
@Test
UUID uuid = mock(UUID.class);
doReturn("uuid-value").when(uuid).getValue();
doReturn(uuid).when(vnfResource).getVmId();
- PowerMockito.doReturn(true).when(topologyService, "callGraph", any());
topologyService.rebuild(commonRequestHeader, vnfResource);
- verifyPrivate(topologyService, times(1)).invoke("callGraph", any());
+ Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class));
}
@Test
UUID uuid = mock(UUID.class);
doReturn("uuid-value").when(uuid).getValue();
doReturn(uuid).when(vnfResource).getVmId();
- PowerMockito.doReturn(true).when(topologyService, "callGraph", any());
topologyService.snapshot(commonRequestHeader, vnfResource);
- verifyPrivate(topologyService, times(1)).invoke("callGraph", any());
+ Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class));
}
@Test
UUID uuid = mock(UUID.class);
doReturn("uuid-value").when(uuid).getValue();
doReturn(uuid).when(vnfResource).getVmId();
- PowerMockito.doReturn(true).when(topologyService, "callGraph", any());
topologyService.vmstatuscheck(commonRequestHeader, vnfResource);
- verifyPrivate(topologyService, times(1)).invoke("callGraph", any());
+ Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class));
}
}
\ No newline at end of file