/** * Finds the test class for the specification referenced by the given href, relative to the * resource. * * @param resource the current resource * @param href the specification to find the test class for * @return test class * @throws ClassNotFoundException if test class not found */ protected Class<?> findTestClass(Resource resource, String href) throws ClassNotFoundException { Resource hrefResource = resource.getParent().getRelativeResource(href); return FixtureSpecificationMapper.findFixtureClass(hrefResource); }
/** * Finds the test class for the specification referenced by the given href, relative to the * resource. * * @param resource the current resource * @param href the specification to find the test class for * @return test class * @throws ClassNotFoundException if test class not found */ protected Class<?> findTestClass(Resource resource, String href) throws ClassNotFoundException { Resource hrefResource = resource.getParent().getRelativeResource(href); return FixtureSpecificationMapper.findFixtureClass(hrefResource); }
public RunnerResult execute(Resource resource, String href) throws Exception { Resource hrefResource = resource.getParent().getRelativeResource(href); String name = hrefResource.getPath().replaceFirst("/", "").replace("/", ".").replaceAll("\\.html$", ""); Class<?> concordionClass; try { concordionClass = Class.forName(name); } catch (ClassNotFoundException e) { concordionClass = Class.forName(name + "Test"); } ResultSummary resultSummary = new ConcordionBuilder() .build() .process(hrefResource, concordionClass.newInstance()); Result result = Result.SUCCESS; if (resultSummary.getFailureCount() > 0) { result = Result.FAILURE; } if (resultSummary.getExceptionCount() > 0) { result = Result.EXCEPTION; } return new RunnerResult(result); } }
public String getPath(String resourcePath, String relativePath) { return new Resource(resourcePath).getRelativeResource(relativePath).getPath(); } }
private String getResourceRelativeTo(String resourcePath, String relativePath) { return new Resource(resourcePath).getRelativeResource(relativePath).getPath(); }
private void appendBreadcrumbsTo(Element breadcrumbSpan, Resource documentResource) { Resource packageResource = documentResource.getParent(); while (packageResource != null) { for (SpecificationType specificationType : specificationTypes) { Resource indexPageResource = packageResource.getRelativeResource(getIndexPageName(packageResource, specificationType.getTypeSuffix())); if (!indexPageResource.equals(documentResource) && specificationSource.canFind(indexPageResource)) { try { prependBreadcrumb(breadcrumbSpan, createBreadcrumbElement(documentResource, indexPageResource, specificationType.getConverter())); } catch (Exception e) { System.err.println("Failed to generate breadcrumb: " + e.getMessage()); } break; } } packageResource = packageResource.getParent(); } }
private void appendBreadcrumbsTo(Element breadcrumbSpan, Resource documentResource) { Resource packageResource = documentResource.getParent(); while (packageResource != null) { for (SpecificationType specificationType : specificationTypes) { Resource indexPageResource = packageResource.getRelativeResource(getIndexPageName(packageResource, specificationType.getTypeSuffix())); if (!indexPageResource.equals(documentResource) && specificationSource.canFind(indexPageResource)) { try { prependBreadcrumb(breadcrumbSpan, createBreadcrumbElement(documentResource, indexPageResource, specificationType.getConverter())); } catch (Exception e) { System.err.println("Failed to generate breadcrumb: " + e.getMessage()); } break; } } packageResource = packageResource.getParent(); } }