@Test public void checkIfAppTermsApplyTest() { assertNull(SLATemplateCreator.checkIfAppTermsApply("Whatever", null)); SLAApplicationTerms applicationTerms = new SLAApplicationTerms(); assertNull(SLATemplateCreator.checkIfAppTermsApply("Whatever", applicationTerms)); SLAInfoTerm infoTerm1 = new SLAInfoTerm(); infoTerm1.setSlaTerm("Term1"); SLAInfoTerm infoTerm2 = new SLAInfoTerm(); infoTerm2.setSlaTerm("Term2"); List<SLAInfoTerm> infoTerms = new ArrayList<SLAInfoTerm>(); infoTerms.add(infoTerm1); infoTerms.add(infoTerm2); applicationTerms.setSlaInfoTerms(infoTerms); assertNull(SLATemplateCreator.checkIfAppTermsApply("Whatever", applicationTerms)); SLAInfoTerm infoTerm3 = new SLAInfoTerm(); infoTerm3.setSlaTerm("Whatever"); infoTerms.add(infoTerm3); assertEquals(infoTerm3, SLATemplateCreator.checkIfAppTermsApply("Whatever", applicationTerms)); }
protected static SLAInfoTerm checkIfAppTermsApply(String ovfTerm, SLAApplicationTerms appTerms) { if(appTerms == null) { return null; } else if(appTerms.getSlaInfoTerms() == null) { return null; } else { for(SLAInfoTerm infoTerm : appTerms.getSlaInfoTerms()) { if(infoTerm.getSlaTerm().equals(ovfTerm)) { return infoTerm; } } return null; } }
SLATemplateCreator { protected static SLAInfoTerm checkIfAppTermsApply(String ovfTerm, SLAApplicationTerms appTerms) { if(appTerms == null) { return null; } else if(appTerms.getSlaInfoTerms() == null) { return null; } else { for(SLAInfoTerm infoTerm : appTerms.getSlaInfoTerms()) { if(infoTerm.getSlaTerm().equals(ovfTerm)) { return infoTerm; } } return null; } } }
SLATemplateCreator { protected static SLAInfoTerm checkIfAppTermsApply(String ovfTerm, SLAApplicationTerms appTerms) { if(appTerms == null) { return null; } else if(appTerms.getSlaInfoTerms() == null) { return null; } else { for(SLAInfoTerm infoTerm : appTerms.getSlaInfoTerms()) { if(infoTerm.getSlaTerm().equals(ovfTerm)) { return infoTerm; } } return null; } }  }
SLATemplateCreator { protected static SLAInfoTerm checkIfAppTermsApply(String ovfTerm, SLAApplicationTerms appTerms) { if(appTerms == null) { return null; } else if(appTerms.getSlaInfoTerms() == null) { return null; } else { for(SLAInfoTerm infoTerm : appTerms.getSlaInfoTerms()) { if(infoTerm.getSlaTerm().equals(ovfTerm)) { return infoTerm; } } return null; } }  static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms); }
SLATemplateCreator { protected static SLAInfoTerm checkIfAppTermsApply(String ovfTerm, SLAApplicationTerms appTerms) { if(appTerms == null) { return null; } else if(appTerms.getSlaInfoTerms() == null) { return null; } else { for(SLAInfoTerm infoTerm : appTerms.getSlaInfoTerms()) { if(infoTerm.getSlaTerm().equals(ovfTerm)) { return infoTerm; } } return null; } }  static SLATemplate generateSLATemplate(OvfDefinition ovf, String ovfURL, SLAApplicationTerms appTerms);  }