public void testService( String serviceFolderPath, String overrideServiceName, final int timeoutMins) throws IOException, InterruptedException, RestException, PackagingException, DSLException { LogUtils.log("Reading Service from file : " + serviceFolderPath); Service service = ServiceReader.readService(new File(serviceFolderPath)); LogUtils.log("Succesfully read Service : " + service); serviceName = service.getName(); if (overrideServiceName != null) { LogUtils.log("Overriding service name with " + overrideServiceName); serviceName = overrideServiceName; } installServiceAndWait(serviceFolderPath, serviceName, timeoutMins); String restUrl = getRestUrl(); GSRestClient client = new GSRestClient("", "", new URL(restUrl), PlatformVersion.getVersionNumber()); Map<String, Object> entriesJsonMap = client.getAdminData("ProcessingUnits/Names/default." + serviceName + "/Status"); String serviceStatus = (String) entriesJsonMap.get(STATUS_PROPERTY); AssertUtils.assertTrue("service is not intact", serviceStatus.equalsIgnoreCase("INTACT")); uninstallServiceAndWait(serviceName); }
@Test public void testMissingTemplate() throws IOException, DSLException, PackagingException { Cloud cloud = ServiceReader.readCloud(new File(CLOUD_FILE_PATH)); Service service = ServiceReader.readService(new File(NOT_EXIST_TEMPLATE_SERVICE_GROOVY)); testValidator( cloud, service, service.getCompute().getTemplate(), CloudifyMessageKeys.MISSING_TEMPLATE.getName()); }
/** * *********** Pack a service recipe folder into a zip file. * * @param recipeDirOrFile the recipe directory or recipe file. * @return the packed file. * @throws IOException . * @throws PackagingException . * @throws DSLException . */ public static File pack(final File recipeDirOrFile) throws IOException, PackagingException, DSLException { // Locate recipe file final File recipeFile = recipeDirOrFile.isDirectory() ? DSLReader.findDefaultDSLFile(DSLReader.SERVICE_DSL_FILE_NAME_SUFFIX, recipeDirOrFile) : recipeDirOrFile; // Parse recipe into service final Service service = ServiceReader.readService(recipeFile); return Packager.pack(recipeFile, service); }
@Test public void testNullCompute() throws IOException, DSLException, PackagingException { Service service = ServiceReader.readService(new File(NO_COMPUTE_SERVICE)); testValidator(null, service, null); }