@Override protected String asynchronousDelayErrorMessage() { return String.format("Error waiting for template resources to deploy from class %s method %s", testClass.getName(), testMethod.getName()); }
private String createFileName(String phaseSuffix) { return String.format(FILENAME_PATTERN, System.currentTimeMillis(), this.testClass.getName(), this.testMethod.getName(), phaseSuffix); }
private static String getFinalVideoName(After afterTestMethod) { final String className = afterTestMethod.getTestClass().getName().replace('.', '_'); final String methodName = afterTestMethod.getTestMethod().getName(); return className + "_" + methodName + ".flv"; } }
private static String getFinalVideoName(After afterTestMethod) { final String className = afterTestMethod.getTestClass().getName().replace('.', '_'); final String methodName = afterTestMethod.getTestMethod().getName(); return className + "_" + methodName + ".flv"; } }
/** * removes test class from web archive (test class will be replaced by transformed assertions) */ private void removeTestClassFromDeployment(Archive<?> archive, TestClass testClass) { for (ArchivePath archivePath : archive.getContent().keySet()) { String path = archivePath.get(); String classPath = testClass.getName().replace(".", "/"); // remove TestClass and its anonymous classes - do not remove static inner classes if (path.matches("/WEB-INF/classes/" + classPath + "(\\$[0-9]*)?\\.class")) { archive.delete(archivePath); } } }
public void removeKubernetesResourcesAtClassScope(@Observes(precedence = -10) AfterClass afterClass, final KubernetesClient kubernetesClient) { final TestClass testClass = afterClass.getTestClass(); log.info(String.format("Deleting environment for %s", testClass.getName())); deleteResources(testClass.getJavaClass().getName(), kubernetesClient); }
public void removeKubernetesResourcesAtClassScope(@Observes(precedence = -10) AfterClass afterClass, final KubernetesClient kubernetesClient) { final TestClass testClass = afterClass.getTestClass(); log.info(String.format("Deleting environment for %s", testClass.getName())); deleteResources(testClass.getJavaClass().getName(), kubernetesClient); }
public void applyKubernetesResourcesAtClassScope(@Observes(precedence = 10) BeforeClass beforeClass, final KubernetesClient kubernetesClient) { final TestClass testClass = beforeClass.getTestClass(); final KubernetesResource[] kubernetesResources = findAnnotations(testClass); log.info(String.format("Creating environment for %s", testClass.getName())); createResources(testClass.getJavaClass().getName(), kubernetesClient, kubernetesResources); }
public void applyKubernetesResourcesAtClassScope(@Observes(precedence = 10) BeforeClass beforeClass, final KubernetesClient kubernetesClient) { final TestClass testClass = beforeClass.getTestClass(); final KubernetesResource[] kubernetesResources = findAnnotations(testClass); log.info(String.format("Creating environment for %s", testClass.getName())); createResources(testClass.getJavaClass().getName(), kubernetesClient, kubernetesResources); }
public void removeKubernetesResourcesAtMethodScope(@Observes(precedence = -10) After afterMethod, final KubernetesClient kubernetesClient) { final TestClass testClass = afterMethod.getTestClass(); final Method testMethod = afterMethod.getTestMethod(); log.info(String.format("Deleting environment for %s method %s", testClass.getName(), testMethod.getName())); deleteResources(createResourceKey(testClass.getJavaClass(), testMethod), kubernetesClient); }
public void applyIstioResourcesAtMethodScope(@Observes(precedence = -20) Before beforeMethod, final IstioClient istioClient) { final TestClass testClass = beforeMethod.getTestClass(); final Method testMethod = beforeMethod.getTestMethod(); log.info(String.format("Creating Istio resource for %s method %s", testClass.getName(), testMethod.getName())); createResources(createResourceKey(testMethod), istioClient, findAnnotations(testMethod)); }
public void applyIstioResourcesAtClassScope(@Observes(precedence = -20) BeforeClass beforeClass, final IstioClient istioClient) { final TestClass testClass = beforeClass.getTestClass(); log.info(String.format("Creating Istio resource for %s", testClass.getName())); createResources(createResourceKey(testClass), istioClient, findAnnotations(testClass)); }
public void removeIstioResourcesAtClassScope(@Observes(precedence = 20) AfterClass afterClass, final IstioClient istioClient) { final TestClass testClass = afterClass.getTestClass(); log.info(String.format("Deleting Istio resource for %s", testClass.getName())); deleteResources(createResourceKey(testClass), istioClient, findRestoreAnnotations(testClass)); }
public void removeIstioResourcesAtMethodScope(@Observes(precedence = 20) After afterMethod, final IstioClient istioClient) { final TestClass testClass = afterMethod.getTestClass(); final Method testMethod = afterMethod.getTestMethod(); log.info(String.format("Deleting Istio resource for %s method %s", testClass.getName(), testMethod.getName())); deleteResources(createResourceKey(testMethod), istioClient, findRestoreAnnotations(testMethod)); }
public void removeKubernetesResourcesAtMethodScope(@Observes(precedence = -10) After afterMethod, final KubernetesClient kubernetesClient) { final TestClass testClass = afterMethod.getTestClass(); final Method testMethod = afterMethod.getTestMethod(); log.info(String.format("Deleting environment for %s method %s", testClass.getName(), testMethod.getName())); deleteResources(createResourceKey(testClass.getJavaClass(), testMethod), kubernetesClient); }
public void applyKubernetesResourcesAtMethodScope(@Observes(precedence = 10) Before beforeMethod, final KubernetesClient kubernetesClient) { final TestClass testClass = beforeMethod.getTestClass(); final Method testMethod = beforeMethod.getTestMethod(); final KubernetesResource[] kubernetesResources = findAnnotations(testMethod); log.info(String.format("Creating environment for %s method %s", testClass.getName(), testMethod.getName())); createResources(createResourceKey(testClass.getJavaClass(), testMethod), kubernetesClient, kubernetesResources); }
public void applyKubernetesResourcesAtMethodScope(@Observes(precedence = 10) Before beforeMethod, final KubernetesClient kubernetesClient) { final TestClass testClass = beforeMethod.getTestClass(); final Method testMethod = beforeMethod.getTestMethod(); final KubernetesResource[] kubernetesResources = findAnnotations(testMethod); log.info(String.format("Creating environment for %s method %s", testClass.getName(), testMethod.getName())); createResources(createResourceKey(testClass.getJavaClass(), testMethod), kubernetesClient, kubernetesResources); }
public void deleteOpenShiftResource(@Observes(precedence = -10) After event, OpenShiftAdapter client, CubeOpenShiftConfiguration cubeOpenShiftConfiguration) throws Exception { final TestClass testClass = event.getTestClass(); final Method testMethod = event.getTestMethod(); final Class<?> javaClass = testClass.getJavaClass(); final String templateKeyPrefix = createResourceKey(javaClass, testMethod); log.info(String.format("Deleting environment for %s method %s", testClass.getName(), testMethod.getName())); OpenShiftResourceFactory.deleteResources(javaClass, testMethod, client); OpenShiftResourceFactory.deleteTemplates(templateKeyPrefix, methodTemplateProcessor.getTemplates(), client, cubeOpenShiftConfiguration); }
public void createOpenShiftResource(@Observes(precedence = 10) Before event, OpenShiftAdapter client, CubeOpenShiftConfiguration cubeOpenShiftConfiguration) { final TestClass testClass = event.getTestClass(); final Method testMethod = event.getTestMethod(); log.info(String.format("Creating environment for %s method %s", testClass.getName(), testMethod)); OpenShiftResourceFactory.createResources(testClass.getJavaClass(), client, testMethod, cubeOpenShiftConfiguration.getProperties()); methodTemplateProcessor = new MethodTemplateProcessor(client, cubeOpenShiftConfiguration, testClass, testMethod); methodTemplateProcessor.processTemplateResources(); }
public void observeBeforeClass(@Observes(precedence = Integer.MAX_VALUE) BeforeClass event) { TestClassReport testClassReport = new TestClassReport(); testClassReport.setTestClassName(event.getTestClass().getName()); testClassReport.setRunAsClient(event.getTestClass().isAnnotationPresent(RunAsClient.class)); testClassReport.setReportMessage(ReportMessageParser.parseTestClassReportMessage(event.getTestClass().getJavaClass())); reporter.get().getLastTestSuiteReport().getTestClassReports().add(testClassReport); reporter.get().setTestClassReport(testClassReport); }