public String getApplicationId() { return application != null ? application.getStringId() : null; }
public String getApplicationId() { return application != null ? application.getStringId() : null; }
@Test public void testFindByAppIdAndVerifierToken() { String token = UUID.randomUUID().toString(); UserVerifier expected = generateUserVerifier(null, token); generateUserVerifier(expected.getApplication(), UUID.randomUUID().toString()); generateUserVerifier(null, UUID.randomUUID().toString()); UserVerifier found = verifierDao.findByAppIdAndVerifierToken(expected.getApplication().getStringId(), token); Assert.assertEquals(expected, found); UserVerifier expectNull = verifierDao.findByAppIdAndVerifierToken(expected.getApplication().getStringId(), UUID.randomUUID().toString()); Assert.assertNull(expectNull); }
@Test public void testRemoveNotificationSchemasByAppId() throws Exception { Application application = generateApplication(null); generateNotificationSchema(application, 1, 1, null); notificationSchemaDao.removeNotificationSchemasByAppId(application.getStringId()); List<NotificationSchema> found = notificationSchemaDao.findNotificationSchemasByAppId(application.getStringId()); Assert.assertTrue(found.isEmpty()); }
@Override public CtlSchemaMetaInfoDto toDto() { CtlSchemaMetaInfoDto ctlSchemaMetaInfoDto = createDto(); ctlSchemaMetaInfoDto.setId(getStringId()); ctlSchemaMetaInfoDto.setFqn(fqn); ctlSchemaMetaInfoDto.setApplicationId(application != null ? application.getStringId() : null); ctlSchemaMetaInfoDto.setTenantId(tenant != null ? tenant.getStringId() : null); return ctlSchemaMetaInfoDto; }
@Override public HistoryDto toDto() { HistoryDto dto = createDto(); dto.setId(getStringId()); if (application != null) { dto.setApplicationId(application.getStringId()); } dto.setChange(change != null ? change.toDto() : null); dto.setSequenceNumber(sequenceNumber); dto.setLastModifyTime(lastModifyTime); return dto; }
@Override public ApplicationDto toDto() { ApplicationDto dto = createDto(); dto.setId(getStringId()); dto.setApplicationToken(applicationToken); dto.setName(name); dto.setSequenceNumber(sequenceNumber); if (tenant != null) { dto.setTenantId(tenant.getStringId()); } dto.setCredentialsServiceName(credentialsServiceName); return dto; } }
@Test public void testFindLatestNotificationSchemaByAppId() throws Exception { Application application = generateApplication(null); List<NotificationSchema> userSchemas = generateNotificationSchema(application, 1, 3, NotificationTypeDto.USER); List<NotificationSchema> systemSchemas = generateNotificationSchema(application, 2, 3, NotificationTypeDto.SYSTEM); NotificationSchema found = notificationSchemaDao.findLatestNotificationSchemaByAppId(application.getStringId(), NotificationTypeDto.USER); Assert.assertEquals(userSchemas.get(2), found); } }
@Test public void findByAppIdAndVersionTest() { LogSchema logSchema = generateLogSchema(null, 1, null, 1).get(0); Assert.assertNotNull(logSchema); LogSchema found = logSchemaDao.findByApplicationIdAndVersion(logSchema.getApplication().getStringId(), logSchema.getVersion()); Assert.assertEquals(logSchema, found); }
@Test public void testFindNotificationSchemasByAppId() throws Exception { Application application = generateApplication(null); List<NotificationSchema> schemas = generateNotificationSchema(application, 1, 1, null); List<NotificationSchema> found = notificationSchemaDao.findNotificationSchemasByAppId(application.getStringId()); Assert.assertEquals(schemas, found); }
@Test public void testFindNotificationSchemasByAppIdAndTypeAndVersion() throws Exception { Application application = generateApplication(null); generateNotificationSchema(application, 1, 1, NotificationTypeDto.SYSTEM); List<NotificationSchema> userSchemas = generateNotificationSchema(application, 2, 3, NotificationTypeDto.USER); NotificationSchema expected = userSchemas.get(2); NotificationSchema found = notificationSchemaDao.findNotificationSchemasByAppIdAndTypeAndVersion(application.getStringId(), NotificationTypeDto.USER, expected.getVersion()); Assert.assertEquals(expected, found); }
@Override public TopicDto toDto() { TopicDto dto = createDto(); dto.setId(getStringId()); if (application != null) { dto.setApplicationId(application.getStringId()); } dto.setName(name); dto.setType(type); dto.setDescription(description); dto.setCreatedUsername(createdUsername); dto.setCreatedTime(createdTime); dto.setSecNum(sequenceNumber); return dto; }
@Test public void findByAppIdAndSchemaVersion() { Application app = generateApplication(null); EndpointProfileSchema schema = generateProfSchema(app, 1).get(0); ServerProfileSchemaDto srvSchema = generateServerProfileSchema(app.getStringId(), app.getTenant().getStringId(), 101); generateFilter(schema, new ServerProfileSchema(srvSchema), null, 2, UpdateStatus.ACTIVE); List<ProfileFilter> filters = generateFilterWithoutSchemaGeneration(schema, new ServerProfileSchema(srvSchema), null, 1, UpdateStatus.ACTIVE); filters.addAll(generateFilterWithoutSchemaGeneration(null, new ServerProfileSchema(srvSchema), null, 1, UpdateStatus.ACTIVE)); filters.addAll(generateFilterWithoutSchemaGeneration(schema, null, null, 1, UpdateStatus.ACTIVE)); List<ProfileFilter> found = profileFilterDao.findByAppIdAndSchemaVersionsCombination(app.getStringId(), schema.getVersion(), srvSchema.getVersion()); Assert.assertEquals(filters, found); }
@Test public void findByApplicationIdTest() { LogSchema logSchema = generateLogSchema(null, 1, null, 1).get(0); Assert.assertNotNull(logSchema); List<LogSchema> schemaList = logSchemaDao.findByApplicationId(logSchema.getApplication().getStringId()); Assert.assertNotNull(schemaList); LogSchema found = null; for (LogSchema schema : schemaList) { if (schema.getId().equals(logSchema.getId())) { found = schema; } } Assert.assertEquals(logSchema, found); }
@Test public void removeByApplicationIdTest() { LogSchema logSchema = generateLogSchema(null, 1, null, 1).get(0); Assert.assertNotNull(logSchema); logSchemaDao.removeByApplicationId(logSchema.getApplication().getStringId()); LogSchema schema = logSchemaDao.findById(logSchema.getStringId()); Assert.assertNull(schema); }
@Override public T toDto() { T dto = createDto(); dto.setId(getStringId()); dto.setName(name); dto.setDescription(description); dto.setCreatedUsername(createdUsername); dto.setCreatedTime(createdTime); if (application != null) { dto.setApplicationId(application.getStringId()); } dto.setPluginTypeName(pluginTypeName); dto.setPluginClassName(pluginClassName); dto.setRawConfiguration(rawConfiguration); return dto; }
@Test public void testFindNotificationSchemasByAppIdAndType() throws Exception { Application application = generateApplication(null); List<NotificationSchema> userSchemas = generateNotificationSchema(application, 1, 2, NotificationTypeDto.USER); generateNotificationSchema(application, 2, 3, NotificationTypeDto.SYSTEM); List<NotificationSchema> found = notificationSchemaDao.findNotificationSchemasByAppIdAndType(application.getStringId(), NotificationTypeDto.USER); Assert.assertEquals(userSchemas, found); }
@Override public T toDto() { T dto = createDto(); dto.setId(getStringId()); if (application != null) { dto.setApplicationId(application.getStringId()); } if (ctlSchema != null) { dto.setCtlSchemaId(ctlSchema.getStringId()); } dto.setVersion(version); dto.setName(name); dto.setDescription(description); dto.setCreatedUsername(createdUsername); dto.setCreatedTime(createdTime); return dto; }
@Test public void removeByAppId() { List<ApplicationEventFamilyMap> applicationEventFamilyMaps = generateApplicationEventFamilyMap(null, null, null, 2, true); String id = applicationEventFamilyMaps.get(0).getStringId(); ApplicationEventFamilyMap dto = applicationEventFamilyMapDao.findById(id); Assert.assertNotNull(dto); String appId = dto.getApplication().getStringId(); Assert.assertNotNull(appId); applicationEventFamilyMapDao.removeByApplicationId(appId); dto = applicationEventFamilyMapDao.findById(id); Assert.assertNull(dto); }
@Test public void findByAppIdTest() { List<ApplicationEventFamilyMap> applicationEventFamilyMaps = generateApplicationEventFamilyMap(null, null, null, 2, true); ApplicationEventFamilyMap dto = applicationEventFamilyMapDao.findById(applicationEventFamilyMaps.get(0).getStringId()); Assert.assertNotNull(dto); List<ApplicationEventFamilyMap> eventFamilyMapList = applicationEventFamilyMapDao.findByApplicationId(dto.getApplication().getStringId()); ApplicationEventFamilyMap eventFamilyMap = null; for (ApplicationEventFamilyMap found : eventFamilyMapList) { if (dto.getId().equals(found.getId())) { eventFamilyMap = found; } } Assert.assertNotNull(eventFamilyMap); Assert.assertEquals(dto, eventFamilyMap); }