@Test public void testCreateResource() { String metaData = "{deployFileName:'external.properties'}"; JpaResourceConfigTemplate result = resourceDao.createResource(1L, 1L, 1L, EntityType.EXT_PROPERTIES, "external.properties", "key=value", metaData); assertEquals(new Long(1), result.getEntityId()); assertEquals(new Long(1), result.getGroupId()); assertEquals(new Long(1), result.getAppId()); assertEquals(EntityType.EXT_PROPERTIES, result.getEntityType()); assertEquals("external.properties", result.getTemplateName()); assertEquals("key=value", result.getTemplateContent()); assertEquals(metaData, result.getMetaData()); }
@Override public JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData) { JpaResourceConfigTemplate resourceTemplate = new JpaResourceConfigTemplate(); resourceTemplate.setEntityId(entityId); resourceTemplate.setGrpId(groupId); resourceTemplate.setAppId(appId); resourceTemplate.setTemplateContent(templateContent); resourceTemplate.setTemplateName(resourceFileName); resourceTemplate.setEntityType(entityType); resourceTemplate.setMetaData(metaData); em.persist(resourceTemplate); em.flush(); return resourceTemplate; }
ResourceDaoImpl implements ResourceDao { @Override public JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData) { JpaResourceConfigTemplate resourceTemplate = new JpaResourceConfigTemplate(); resourceTemplate.setEntityId(entityId); resourceTemplate.setGrpId(groupId); resourceTemplate.setAppId(appId); resourceTemplate.setTemplateContent(templateContent); resourceTemplate.setTemplateName(resourceFileName); resourceTemplate.setEntityType(entityType); resourceTemplate.setMetaData(metaData); em.persist(resourceTemplate); em.flush(); return resourceTemplate; } }
ResourceDaoImpl implements ResourceDao { @Override public JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData) { JpaResourceConfigTemplate resourceTemplate = new JpaResourceConfigTemplate(); resourceTemplate.setEntityId(entityId); resourceTemplate.setGrpId(groupId); resourceTemplate.setAppId(appId); resourceTemplate.setTemplateContent(templateContent); resourceTemplate.setTemplateName(resourceFileName); resourceTemplate.setEntityType(entityType); resourceTemplate.setMetaData(metaData); em.persist(resourceTemplate); em.flush(); return resourceTemplate; }  }
ResourceDaoImpl implements ResourceDao { @Override public JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData) { JpaResourceConfigTemplate resourceTemplate = new JpaResourceConfigTemplate(); resourceTemplate.setEntityId(entityId); resourceTemplate.setGrpId(groupId); resourceTemplate.setAppId(appId); resourceTemplate.setTemplateContent(templateContent); resourceTemplate.setTemplateName(resourceFileName); resourceTemplate.setEntityType(entityType); resourceTemplate.setMetaData(metaData); em.persist(resourceTemplate); em.flush(); return resourceTemplate; }  @Override int deleteWebServerResource(final String templateName, final String webServerName); @Override int deleteGroupLevelWebServerResource(final String templateName, final String groupName); @Override int deleteJvmResource(final String templateName, final String jvmName); @Override int deleteGroupLevelJvmResource(final String templateName, final String groupName); @Override int deleteAppResource(final String templateName, final String appName, final String jvmName); @Override int deleteGroupLevelAppResource(String appName, final String groupName, final String templateName); @Override int deleteWebServerResources(final List<String> templateNameList, final String webServerName); @Override int deleteGroupLevelWebServerResources(final List<String> templateNameList, final String groupName); @Override int deleteJvmResources(final List<String> templateNameList, final String jvmName); @Override int deleteGroupLevelJvmResources(final List<String> templateNameList, final String groupName); @Override int deleteAppResources(final List<String> templateNameList, final String appName, final String jvmName); @Override int deleteGroupLevelAppResources(final String appName, final String groupName, final List<String> templateNameList); @Override int deleteExternalProperties(); @Override JpaWebServerConfigTemplate getWebServerResource(final String resourceName, final String webServerName); @Override JpaJvmConfigTemplate getJvmResource(final String resourceName, final String jvmName); @Override JpaApplicationConfigTemplate getAppResource(final String resourceName, final String appName, final String jvmName); @Override JpaGroupWebServerConfigTemplate getGroupLevelWebServerResource(final String resourceName, final String groupName); @Override JpaGroupJvmConfigTemplate getGroupLevelJvmResource(final String resourceName, final String groupName); @Override JpaGroupAppConfigTemplate getGroupLevelAppResource(final String resourceName, final String appName, final String groupName); @Override List<String> getGroupLevelAppResourceNames(String groupName, String webAppName); @Override JpaResourceConfigTemplate getExternalPropertiesResource(String resourceName); @Override JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData); @Override void updateResource(ResourceIdentifier resourceIdentifier, EntityType entityType, String templateContent); @Override void updateResourceGroup(JpaApplication jpaApplication, JpaGroup jpaGroup); @Override List<String> getResourceNames(ResourceIdentifier identifier, EntityType entityType); }
ResourceDaoImpl implements ResourceDao { @Override public JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData) { JpaResourceConfigTemplate resourceTemplate = new JpaResourceConfigTemplate(); resourceTemplate.setEntityId(entityId); resourceTemplate.setGrpId(groupId); resourceTemplate.setAppId(appId); resourceTemplate.setTemplateContent(templateContent); resourceTemplate.setTemplateName(resourceFileName); resourceTemplate.setEntityType(entityType); resourceTemplate.setMetaData(metaData); em.persist(resourceTemplate); em.flush(); return resourceTemplate; }  @Override int deleteWebServerResource(final String templateName, final String webServerName); @Override int deleteGroupLevelWebServerResource(final String templateName, final String groupName); @Override int deleteJvmResource(final String templateName, final String jvmName); @Override int deleteGroupLevelJvmResource(final String templateName, final String groupName); @Override int deleteAppResource(final String templateName, final String appName, final String jvmName); @Override int deleteGroupLevelAppResource(String appName, final String groupName, final String templateName); @Override int deleteWebServerResources(final List<String> templateNameList, final String webServerName); @Override int deleteGroupLevelWebServerResources(final List<String> templateNameList, final String groupName); @Override int deleteJvmResources(final List<String> templateNameList, final String jvmName); @Override int deleteGroupLevelJvmResources(final List<String> templateNameList, final String groupName); @Override int deleteAppResources(final List<String> templateNameList, final String appName, final String jvmName); @Override int deleteGroupLevelAppResources(final String appName, final String groupName, final List<String> templateNameList); @Override int deleteExternalProperties(); @Override JpaWebServerConfigTemplate getWebServerResource(final String resourceName, final String webServerName); @Override JpaJvmConfigTemplate getJvmResource(final String resourceName, final String jvmName); @Override JpaApplicationConfigTemplate getAppResource(final String resourceName, final String appName, final String jvmName); @Override JpaGroupWebServerConfigTemplate getGroupLevelWebServerResource(final String resourceName, final String groupName); @Override JpaGroupJvmConfigTemplate getGroupLevelJvmResource(final String resourceName, final String groupName); @Override JpaGroupAppConfigTemplate getGroupLevelAppResource(final String resourceName, final String appName, final String groupName); @Override List<String> getGroupLevelAppResourceNames(String groupName, String webAppName); @Override JpaResourceConfigTemplate getExternalPropertiesResource(String resourceName); @Override JpaResourceConfigTemplate createResource(Long entityId, Long groupId, Long appId, EntityType entityType, String resourceFileName, String templateContent, String metaData); @Override void updateResource(ResourceIdentifier resourceIdentifier, EntityType entityType, String templateContent); @Override void updateResourceGroup(JpaApplication jpaApplication, JpaGroup jpaGroup); @Override List<String> getResourceNames(ResourceIdentifier identifier, EntityType entityType);  }