TemplateManagerImpl extends ManagerBase implements TemplateManager, TemplateApiService, Configurable { void verifyTemplateId(final Long id) { if (id.equals(Long.valueOf(1))) { final InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id"); ex.addProxyObject(String.valueOf(id), "templateId"); throw ex; } } protected  TemplateManagerImpl(); @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_CREATE, eventDescription = "creating iso") VirtualMachineTemplate registerIso(final RegisterIsoCmd cmd); @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template") VirtualMachineTemplate registerTemplate(final RegisterTemplateCmd cmd); @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating post upload template") GetUploadParamsResponse registerTemplateForPostUpload(final GetUploadParamsForTemplateCmd cmd); @Override DataStore getImageStore(final String storeUuid, final Long zoneId); @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_EXTRACT, eventDescription = "extracting ISO", async = true) String extract(final ExtractIsoCmd cmd); @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_EXTRACT, eventDescription = "extracting template", async = true) String extract(final ExtractTemplateCmd cmd); @Override VirtualMachineTemplate prepareTemplate(final long templateId, final long zoneId, final Long storageId); @Override void prepareIsoForVmProfile(final VirtualMachineProfile profile); void prepareTemplateInAllStoragePools(final VMTemplateVO template, final long zoneId); @Override @DB VMTemplateStoragePoolVO prepareTemplateForCreate(final VMTemplateVO templ, final StoragePool pool); @Override String getChecksum(final DataStore store, final String templatePath); @Override @DB boolean resetTemplateDownloadStateOnPool(final long templateStoragePoolRefId); @Override @DB boolean copy(final long userId, final VMTemplateVO template, final DataStore srcSecStore, final DataCenterVO dstZone); @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_COPY, eventDescription = "copying template", async = true) VirtualMachineTemplate copyTemplate(final CopyTemplateCmd cmd); @Override boolean delete(final long userId, final long templateId, final Long zoneId); @Override List<VMTemplateStoragePoolVO> getUnusedTemplatesInPool(final StoragePoolVO pool); @Override @DB void evictTemplateFromStoragePool(final VMTemplateStoragePoolVO templatePoolVO); @Override boolean start(); @Override boolean stop(); @Override boolean configure(final String name, final Map<String, Object> params); @Override boolean templateIsDeleteable(final VMTemplateHostVO templateHostRef); @Override boolean templateIsDeleteable(final long templateId); @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_DETACH, eventDescription = "detaching ISO", async = true) boolean detachIso(final long vmId); @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_ATTACH, eventDescription = "attaching ISO", async = true) boolean attachIso(final long isoId, final long vmId); @Override TemplateInfo prepareIso(final long isoId, final long dcId); @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_DELETE, eventDescription = "deleting template", async = true) boolean deleteTemplate(final DeleteTemplateCmd cmd); @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_DELETE, eventDescription = "deleting iso", async = true) boolean deleteIso(final DeleteIsoCmd cmd); @Override List<String> listTemplatePermissions(final BaseListTemplateOrIsoPermissionsCmd cmd); @DB @Override boolean updateTemplateOrIsoPermissions(final BaseUpdateTemplateOrIsoPermissionsCmd cmd); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", async = true) VirtualMachineTemplate createPrivateTemplate(final CreateTemplateCmd command); @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", create = true) VMTemplateVO createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner); @Override Pair<String, String> getAbsoluteIsoPath(final long templateId, final long dataCenterId); @Override String getSecondaryStorageURL(final long zoneId); @Override DataStore getImageStore(final long zoneId, final long tmpltId); @Override DataStore getImageStore(final long tmpltId); @Override Long getTemplateSize(final long templateId, final long zoneId); @Override List<DataStore> getImageStoreByTemplate(final long templateId, final Long zoneId); @Override VMTemplateVO updateTemplate(final UpdateIsoCmd cmd); @Override VMTemplateVO updateTemplate(final UpdateTemplateCmd cmd); @Override String getConfigComponentName(); @Override ConfigKey<?>[] getConfigKeys(); List<TemplateAdapter> getTemplateAdapters(); @Inject void setTemplateAdapters(final List<TemplateAdapter> adapters);  }
@Test(expected = InvalidParameterValueException.class) public void testVerifyTemplateIdOfSystemTemplate() { templateManager.verifyTemplateId(1L); }