@Test public void testSecureDynamicOpenShiftResource() throws Exception { OpenShiftResourceFactory.createResources("key", adapter, SecureOpenShiftDynamicImageStreamResourceExample.class, configuration.getProperties()); ArgumentCaptor<ByteArrayInputStream> captor = ArgumentCaptor.forClass(ByteArrayInputStream.class); verify(adapter, times(1)).createResource(eq("key"), captor.capture()); assertEquals("{\"metadata\":{\"name\":\"stream-1.0\",\"annotations\":{\"openshift.io\\/image.insecureRepository\":false}},\"apiVersion\":\"v1\",\"kind\":\"ImageStream\",\"spec\":{\"tags\":[{\"importPolicy\":{\"insecure\":false},\"name\":\"1.0\",\"annotations\":{\"version\":\"1.0\"},\"from\":{\"kind\":\"DockerImage\",\"name\":\"registry.host.com\\/imageFamily\\/imageName\"}}]}}", IOUtil.asString(captor.getValue())); }
public static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties) { try { final StringResolver resolver = Strings.createStringResolver(properties); List<OpenShiftDynamicImageStreamResource> openShiftDynamicImageStreamResources = new ArrayList<>(); OSISR_FINDER.findAnnotations(openShiftDynamicImageStreamResources, testClass); createDynamicOpenShiftImageStreamResources(resourcesKey, adapter, testClass, resolver, openShiftDynamicImageStreamResources); List<OpenShiftResource> openShiftResources = new ArrayList<>(); OSR_FINDER.findAnnotations(openShiftResources, testClass); createOpenShiftResources(resourcesKey, adapter, testClass, resolver, openShiftResources); List<RoleBinding> roleBindings = new ArrayList<>(); RB_FINDER.findAnnotations(roleBindings, testClass); createRoleBindings(resourcesKey, adapter, resolver, roleBindings); List<AddRoleToServiceAccount> arsaBindings = new ArrayList<>(); ARSA_FINDER.findAnnotations(arsaBindings, testClass); createRolesToServiceAccounts(resourcesKey, adapter, resolver, arsaBindings); } catch (Exception e) { throw new IllegalStateException(e); } }
OpenShiftResourceFactory { public static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties) { try { final StringResolver resolver = Strings.createStringResolver(properties); List<OpenShiftDynamicImageStreamResource> openShiftDynamicImageStreamResources = new ArrayList<>(); OSISR_FINDER.findAnnotations(openShiftDynamicImageStreamResources, testClass); createDynamicOpenShiftImageStreamResources(resourcesKey, adapter, testClass, resolver, openShiftDynamicImageStreamResources); List<OpenShiftResource> openShiftResources = new ArrayList<>(); OSR_FINDER.findAnnotations(openShiftResources, testClass); createOpenShiftResources(resourcesKey, adapter, testClass, resolver, openShiftResources); List<RoleBinding> roleBindings = new ArrayList<>(); RB_FINDER.findAnnotations(roleBindings, testClass); createRoleBindings(resourcesKey, adapter, resolver, roleBindings); List<AddRoleToServiceAccount> arsaBindings = new ArrayList<>(); ARSA_FINDER.findAnnotations(arsaBindings, testClass); createRolesToServiceAccounts(resourcesKey, adapter, resolver, arsaBindings); } catch (Exception e) { throw new IllegalStateException(e); } } }
OpenShiftResourceFactory { public static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties) { try { final StringResolver resolver = Strings.createStringResolver(properties); List<OpenShiftDynamicImageStreamResource> openShiftDynamicImageStreamResources = new ArrayList<>(); OSISR_FINDER.findAnnotations(openShiftDynamicImageStreamResources, testClass); createDynamicOpenShiftImageStreamResources(resourcesKey, adapter, testClass, resolver, openShiftDynamicImageStreamResources); List<OpenShiftResource> openShiftResources = new ArrayList<>(); OSR_FINDER.findAnnotations(openShiftResources, testClass); createOpenShiftResources(resourcesKey, adapter, testClass, resolver, openShiftResources); List<RoleBinding> roleBindings = new ArrayList<>(); RB_FINDER.findAnnotations(roleBindings, testClass); createRoleBindings(resourcesKey, adapter, resolver, roleBindings); List<AddRoleToServiceAccount> arsaBindings = new ArrayList<>(); ARSA_FINDER.findAnnotations(arsaBindings, testClass); createRolesToServiceAccounts(resourcesKey, adapter, resolver, arsaBindings); } catch (Exception e) { throw new IllegalStateException(e); } }  }
OpenShiftResourceFactory { public static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties) { try { final StringResolver resolver = Strings.createStringResolver(properties); List<OpenShiftDynamicImageStreamResource> openShiftDynamicImageStreamResources = new ArrayList<>(); OSISR_FINDER.findAnnotations(openShiftDynamicImageStreamResources, testClass); createDynamicOpenShiftImageStreamResources(resourcesKey, adapter, testClass, resolver, openShiftDynamicImageStreamResources); List<OpenShiftResource> openShiftResources = new ArrayList<>(); OSR_FINDER.findAnnotations(openShiftResources, testClass); createOpenShiftResources(resourcesKey, adapter, testClass, resolver, openShiftResources); List<RoleBinding> roleBindings = new ArrayList<>(); RB_FINDER.findAnnotations(roleBindings, testClass); createRoleBindings(resourcesKey, adapter, resolver, roleBindings); List<AddRoleToServiceAccount> arsaBindings = new ArrayList<>(); ARSA_FINDER.findAnnotations(arsaBindings, testClass); createRolesToServiceAccounts(resourcesKey, adapter, resolver, arsaBindings); } catch (Exception e) { throw new IllegalStateException(e); } }  static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties); static void createResources(Class<?> testClass, OpenShiftAdapter client, Method testMethod, Properties properties); static void deleteTemplates(final String templateKeyPrefix, List<Template> templates,
                                       OpenShiftAdapter openshiftAdapter, CubeOpenShiftConfiguration configuration); static void deleteResources(Class<?> testClass, Method testMethod, OpenShiftAdapter client); static void deleteEnvironment(final TestClass testClass, OpenShiftAdapter client,
                                         CubeOpenShiftConfiguration configuration, List<Template> templates); static String createResourceKey(Class<?> testClass, Method testMethod); }
OpenShiftResourceFactory { public static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties) { try { final StringResolver resolver = Strings.createStringResolver(properties); List<OpenShiftDynamicImageStreamResource> openShiftDynamicImageStreamResources = new ArrayList<>(); OSISR_FINDER.findAnnotations(openShiftDynamicImageStreamResources, testClass); createDynamicOpenShiftImageStreamResources(resourcesKey, adapter, testClass, resolver, openShiftDynamicImageStreamResources); List<OpenShiftResource> openShiftResources = new ArrayList<>(); OSR_FINDER.findAnnotations(openShiftResources, testClass); createOpenShiftResources(resourcesKey, adapter, testClass, resolver, openShiftResources); List<RoleBinding> roleBindings = new ArrayList<>(); RB_FINDER.findAnnotations(roleBindings, testClass); createRoleBindings(resourcesKey, adapter, resolver, roleBindings); List<AddRoleToServiceAccount> arsaBindings = new ArrayList<>(); ARSA_FINDER.findAnnotations(arsaBindings, testClass); createRolesToServiceAccounts(resourcesKey, adapter, resolver, arsaBindings); } catch (Exception e) { throw new IllegalStateException(e); } }  static void createResources(String resourcesKey, OpenShiftAdapter adapter, Class<?> testClass, Properties properties); static void createResources(Class<?> testClass, OpenShiftAdapter client, Method testMethod, Properties properties); static void deleteTemplates(final String templateKeyPrefix, List<Template> templates,
                                       OpenShiftAdapter openshiftAdapter, CubeOpenShiftConfiguration configuration); static void deleteResources(Class<?> testClass, Method testMethod, OpenShiftAdapter client); static void deleteEnvironment(final TestClass testClass, OpenShiftAdapter client,
                                         CubeOpenShiftConfiguration configuration, List<Template> templates); static String createResourceKey(Class<?> testClass, Method testMethod);  }