@Override
 public void setTemplate(ITemplate template) {
   firePropertyChange(PROPERTY_TEMPLATE, this.template, this.template = template);
   if (template == null) return;
   setParameters(new ArrayList<IParameter>(template.getParameters().values()));
   setItems(template.getItems());
   setLabels(template.getObjectLabels());
 }
 private Map<String, IParameter> givenTheTemplateHasParameters() {
   IParameter param = mock(IParameter.class);
   when(param.getName()).thenReturn("foo");
   when(param.clone()).thenReturn(param);
   Map<String, IParameter> parameters = new HashMap<String, IParameter>();
   parameters.put(param.getName(), param);
   when(template.getParameters()).thenReturn(parameters);
   return parameters;
 }
  @Override
  protected IStatus doRun(IProgressMonitor monitor) {
    template.updateParameterValues(parameters);
    for (Label label : labels) {
      template.addObjectLabel(label.getName(), label.getValue());
    }

    IStatus status =
        project.accept(
            new CapabilityVisitor<IProjectTemplateProcessing, IStatus>() {

              @Override
              public IStatus visit(IProjectTemplateProcessing capability) {

                try {
                  ITemplate processed = capability.process(template);
                  Collection<IResource> existing = findExistingResources(project, processed);
                  if (!existing.isEmpty()) {
                    return createErrorStatusForExistingResources(existing);
                  }
                  parameters = processed.getParameters().values();
                  resources = capability.apply(processed);
                  return handleResponse(resources);
                } catch (OpenShiftException e) {
                  String message = e.getMessage();
                  if (e.getStatus() != null) {
                    message = e.getStatus().getMessage();
                  }
                  return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, -1, message, e);
                }
              }
            },
            new Status(
                IStatus.ERROR,
                OpenShiftUIActivator.PLUGIN_ID,
                "Template processing is unsupported for this client and server combination.",
                null));

    return status;
  }
 private HashMap<String, String> givenTheTemplateHasObjectLabels() {
   HashMap<String, String> labels = new HashMap<String, String>();
   labels.put("abc", "xyz");
   when(template.getObjectLabels()).thenReturn(labels);
   return labels;
 }