* ============LICENSE_END=========================================================
*/
-package org.openecomp.appc.adapter.iaas.provider.operation.impl.base;
+package org.onap.appc.adapter.iaas.provider.operation.impl.base;
-import org.openecomp.appc.Constants;
-import org.openecomp.appc.adapter.iaas.impl.RequestContext;
-import org.openecomp.appc.adapter.iaas.impl.RequestFailedException;
-import org.openecomp.appc.adapter.openstack.heat.StackResource;
-import org.openecomp.appc.i18n.Msg;
+import org.onap.appc.Constants;
+import org.onap.appc.adapter.iaas.impl.RequestContext;
+import org.onap.appc.adapter.iaas.impl.RequestFailedException;
+import org.onap.appc.adapter.openstack.heat.StackResource;
+import org.onap.appc.i18n.Msg;
import com.att.cdp.exceptions.ContextConnectionException;
import com.att.cdp.exceptions.ResourceNotFoundException;
import com.att.cdp.exceptions.TimeoutException;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.att.eelf.i18n.EELFResourceManager;
-import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import com.woorea.openstack.base.client.OpenStackBaseException;
import org.glassfish.grizzly.http.util.HttpStatus;
-
import java.util.List;
-/**
- * @since September 29, 2016
- */
-public abstract class ProviderStackOperation extends ProviderOperation{
+public abstract class ProviderStackOperation extends ProviderOperation {
private static final EELFLogger logger = EELFManager.getInstance().getLogger(ProviderStackOperation.class);
protected void trackRequest(Context context, AbstractService.State... states) {
RequestState.clear();
- if (null == states) return;
+ if (null == states)
+ return;
for (AbstractService.State state : states) {
RequestState.put(state.getName(), state.getValue());
}
StackTraceElement element;
for (; index < stack.length; index++) {
element = stack[index];
- if ("trackRequest".equals(element.getMethodName())) { //$NON-NLS-1$
+ if ("trackRequest".equals(element.getMethodName())) { //$NON-NLS-1$
break;
}
}
}
}
- private boolean checkStatus(String expectedStatus, int pollInterval, String actualStatus) {
+ /*
+ * Changed the 'pollInterval' type as long. Thread.sleep method needs 'long millis' as an argument
+ */
+ private boolean checkStatus(String expectedStatus, long pollInterval, String actualStatus) {
if (actualStatus.toUpperCase().equals(expectedStatus)) {
return true;
} else {
while (System.currentTimeMillis() < maxTimeToWait) {
String stackStatus = stackResource.show(stack.getName(), stack.getId()).execute().getStackStatus();
logger.debug("Stack status : " + stackStatus);
- if (stackStatus.toUpperCase().contains("FAILED")) return false;
- if(checkStatus(expectedStatus, pollInterval, stackStatus)) return true;
+ if (stackStatus.toUpperCase().contains("FAILED"))
+ return false;
+ if (checkStatus(expectedStatus, pollInterval, stackStatus))
+ return true;
}
throw new TimeoutException("Timeout waiting for stack status change");
}
}
- protected boolean waitForStackStatus(RequestContext rc, Stack stack, Stack.Status expectedStatus) throws ZoneException, RequestFailedException {
+ protected boolean waitForStackStatus(RequestContext rc, Stack stack, Stack.Status expectedStatus)
+ throws ZoneException, RequestFailedException {
SvcLogicContext ctx = rc.getSvcLogicContext();
Context context = stack.getContext();
StackService stackService = context.getStackService();
-
- int pollInterval = configuration.getIntegerProperty(Constants.PROPERTY_OPENSTACK_POLL_INTERVAL);
+ /*
+ * Changed the 'pollInterval' type as long. Thread.sleep method needs 'long millis' as an argument
+ */
+ long pollInterval = configuration.getIntegerProperty(Constants.PROPERTY_OPENSTACK_POLL_INTERVAL);
int timeout = configuration.getIntegerProperty(Constants.PROPERTY_STACK_STATE_CHANGE_TIMEOUT);
long maxTimeToWait = System.currentTimeMillis() + (long) timeout * 1000;
Stack.Status stackStatus;