@Test public void shouldLookupEntityCollection() { Entity e = setup(); AppInfo mockAppInfo = Mockito.mock(AppInfo.class); mockSchema.addAnnotation(mockAppInfo); String collectionName = naturalKeyExtractor.getCollectionName(e); Assert.assertEquals(COLLECTION_TYPE, collectionName); }
public String getCollectionName(Entity entity) { NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { return appInfo.getCollectionType(); } } LOG.error("No collectionType found in schema for entity: " + entity.getType()); return null; }
NaturalKeyExtractor implements INaturalKeyExtractor { public String getCollectionName(Entity entity) { NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { return appInfo.getCollectionType(); } } LOG.error("No collectionType found in schema for entity: " + entity.getType()); return null; } }
NaturalKeyExtractor implements INaturalKeyExtractor { public String getCollectionName(Entity entity) { NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { return appInfo.getCollectionType(); } } LOG.error("No collectionType found in schema for entity: " + entity.getType()); return null; }  }
NaturalKeyExtractor implements INaturalKeyExtractor { public String getCollectionName(Entity entity) { NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { return appInfo.getCollectionType(); } } LOG.error("No collectionType found in schema for entity: " + entity.getType()); return null; }  @Override Map<String, String> getNaturalKeys(Entity entity); @Override Map<String, Boolean> getNaturalKeyFields(Entity entity); @Override NaturalKeyDescriptor getNaturalKeyDescriptor(Entity entity); String getCollectionName(Entity entity); }
NaturalKeyExtractor implements INaturalKeyExtractor { public String getCollectionName(Entity entity) { NeutralSchema schema = entitySchemaRegistry.getSchema(entity.getType()); if (schema != null) { AppInfo appInfo = schema.getAppInfo(); if (appInfo != null) { return appInfo.getCollectionType(); } } LOG.error("No collectionType found in schema for entity: " + entity.getType()); return null; }  @Override Map<String, String> getNaturalKeys(Entity entity); @Override Map<String, Boolean> getNaturalKeyFields(Entity entity); @Override NaturalKeyDescriptor getNaturalKeyDescriptor(Entity entity); String getCollectionName(Entity entity);  }