#!/usr/bin/python # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pexpect import os import sys import time import re def syscall(c): if os.system(c) != 0: raise Exception("Sys call failed: " + c) baseDir=os.getcwd() os.system("rm -fr results") SMX4_DIR=os.getenv("SMX4_DIR") SOAPUI_DIR=os.getenv("SOAPUI_DIR") os.chdir(SMX4_DIR) os.system("rm -fr data") os.system("rm -f hise*") child = pexpect.spawn("bin/servicemix", timeout=90) child.logfile = sys.stdout child.expect("karaf.*>") time.sleep(3) child.sendline("features:addUrl mvn:org.apache.hise/hise-karaf/1.0.0-SNAPSHOT/xml/features"); child.expect("karaf.*>") child.sendline("features:install hise-h2-test-example-osgi") child.expect("karaf.*>") time.sleep(3) rep=0 while True: child.sendline("osgi:list|grep -i hise-test-example-osgi") l=child.readline() l=child.readline() if re.match(".*Started", l) != None: break time.sleep(1) child.expect("karaf.*>") rep=rep+1 if rep>30: raise Exception("Bundle not installed") os.chdir(baseDir) for i in os.listdir("."): if i[-4:] == '.xml': syscall(SOAPUI_DIR + "/bin/testrunner.sh -j -f results " + i) child.sendline("shutdown") time.sleep(3)