Conditional tests and undeploy correction

Conditional tests added at stop-undeploy-deploy-start execution, and corrected the undeploy $artifact to $filename which is equal $(basename $artifact).