AbstractModel { protected String determineImagePullPolicy(ImagePullPolicy requestedImagePullPolicy, String image) { if (requestedImagePullPolicy != null) { return requestedImagePullPolicy.toString(); } if (image.toLowerCase(Locale.ENGLISH).contains(":latest")) { return ImagePullPolicy.ALWAYS.toString(); } else { return ImagePullPolicy.IFNOTPRESENT.toString(); } } protected  AbstractModel(HasMetadata resource, String applicationName); int getReplicas(); void setReplicas(int replicas); String getName(); String getServiceName(); String getHeadlessServiceName(); Labels getSelectorLabels(); boolean isMetricsEnabled(); OrderedProperties getDefaultLogConfig(); static OrderedProperties getOrderedProperties(String configFileName); String createLog4jProperties(OrderedProperties properties); Logging getLogging(); String parseLogging(Logging logging, ConfigMap externalCm); ConfigMap generateMetricsAndLogConfigMap(ConfigMap externalConfigMap); String getAncillaryConfigMapName(); Storage getStorage(); AbstractConfiguration getConfiguration(); String getImage(); String getCluster(); String getPodName(int podId); List<Toleration> getTolerations(); void setTolerations(List<Toleration> tolerations); static Map<String, String> containerEnvVars(Container container); Labels getLabels(); void setLabels(Labels labels); void setResources(ResourceRequirements resources); ResourceRequirements getResources(); void setJvmOptions(JvmOptions jvmOptions); JvmOptions getJvmOptions(); String getAncillaryConfigMapKeyLogConfig(); static String clusterCaCertSecretName(String cluster); static String clusterCaKeySecretName(String cluster); ServiceAccount generateServiceAccount(); static String initContainerClusterRoleBindingName(String namespace, String cluster); void addWarningCondition(Condition warning); List<Condition> getWarningConditions(); static final String STRIMZI_CLUSTER_OPERATOR_NAME; static final String ANCILLARY_CM_KEY_METRICS; static final String ANCILLARY_CM_KEY_LOG_CONFIG; static final String NETWORK_POLICY_KEY_SUFFIX; static final String ENV_VAR_DYNAMIC_HEAP_FRACTION; static final String ENV_VAR_KAFKA_HEAP_OPTS; static final String ENV_VAR_KAFKA_JVM_PERFORMANCE_OPTS; static final String ENV_VAR_DYNAMIC_HEAP_MAX; static final String ENV_VAR_STRIMZI_KAFKA_GC_LOG_ENABLED; static final String ENV_VAR_STRIMZI_JAVA_SYSTEM_PROPERTIES; static final String ENV_VAR_STRIMZI_JAVA_OPTS; static final String ENV_VAR_STRIMZI_GC_LOG_ENABLED; static final String ANNO_STRIMZI_IO_STORAGE; static final String ANNO_STRIMZI_IO_DELETE_CLAIM; @Deprecated
    static final String ANNO_CO_STRIMZI_IO_DELETE_CLAIM; static final String VOLUME_NAME; }
@Test public void testDetermineImagePullPolicy() { Kafka kafka = new KafkaBuilder() .withNewMetadata() .withName("my-cluster") .withNamespace("my-namespace") .endMetadata() .build(); AbstractModel am = new Model(kafka); am.setLabels(Labels.forStrimziCluster("foo")); assertThat(am.determineImagePullPolicy(ImagePullPolicy.ALWAYS, "docker.io/repo/image:tag"), is(ImagePullPolicy.ALWAYS.toString())); assertThat(am.determineImagePullPolicy(ImagePullPolicy.IFNOTPRESENT, "docker.io/repo/image:tag"), is(ImagePullPolicy.IFNOTPRESENT.toString())); assertThat(am.determineImagePullPolicy(ImagePullPolicy.IFNOTPRESENT, "docker.io/repo/image:latest"), is(ImagePullPolicy.IFNOTPRESENT.toString())); assertThat(am.determineImagePullPolicy(ImagePullPolicy.NEVER, "docker.io/repo/image:tag"), is(ImagePullPolicy.NEVER.toString())); assertThat(am.determineImagePullPolicy(ImagePullPolicy.NEVER, "docker.io/repo/image:latest-kafka-2.6.0"), is(ImagePullPolicy.NEVER.toString())); assertThat(am.determineImagePullPolicy(null, "docker.io/repo/image:latest"), is(ImagePullPolicy.ALWAYS.toString())); assertThat(am.determineImagePullPolicy(null, "docker.io/repo/image:not-so-latest"), is(ImagePullPolicy.IFNOTPRESENT.toString())); assertThat(am.determineImagePullPolicy(null, "docker.io/repo/image:latest-kafka-2.6.0"), is(ImagePullPolicy.ALWAYS.toString())); }