ProviderRegistry { @Lock(LockType.WRITE) public <T extends ScimResource> void registerProvider(Class<T> clazz, Instance<? extends Provider<T>> providerInstance) throws InvalidProviderException, JsonProcessingException, UnableToRetrieveExtensionsException { Provider<T> provider = providerInstance.get(); ResourceType resourceType = generateResourceType(clazz, provider); log.info("Calling addSchema on the base class: {}", clazz); registry.addSchema(generateBaseSchema(clazz)); ScimResourceType scimResourceType = clazz.getAnnotation(ScimResourceType.class); String schemaUrn = scimResourceType.schema(); String endpoint = scimResourceType.endpoint(); registry.addScimResourceSchemaUrn(schemaUrn, clazz); registry.addScimResourceEndPoint(endpoint, clazz); List<Class<? extends ScimExtension>> extensionList = provider.getExtensionList(); if (extensionList != null) { for (Class<? extends ScimExtension> scimExtension : extensionList) { log.info("Registering a extension of type: " + scimExtension); scimExtensionRegistry.registerExtension(clazz, scimExtension); log.info("Calling addSchema on an extension: " + scimExtension); registry.addSchema(generateExtensionSchema(scimExtension)); } } registry.addResourceType(resourceType); providerMap.put(clazz, providerInstance); } ProviderRegistry();  ProviderRegistry(Registry registry, ScimExtensionRegistry scimExtensionRegistry); @Lock(LockType.WRITE) void registerProvider(Class<T> clazz, Instance<? extends Provider<T>> providerInstance); @Deprecated @Lock(LockType.READ) @SuppressWarnings("unchecked") Provider<T> getProvider(Class<T> clazz); static Schema generateSchema(Class<?> clazz, List<Field> fieldList);  }
@Test public void testAddProvider() throws Exception { providerRegistry.registerProvider(ScimUser.class, providerInstance); Schema schema = registry.getSchema(ScimUser.SCHEMA_URI); assertThat(schema).isNotNull(); assertThat(schema.getId()).isEqualTo(ScimUser.SCHEMA_URI); }