Ejemplo n.º 1
0
 @Override
 public void initSystem(Task initTask, OperationResult initResult) throws Exception {
   super.initSystem(initTask, initResult);
   InternalMonitor.reset();
   //		InternalMonitor.setTraceShadowFetchOperation(true);
   //		InternalMonitor.setTraceResourceSchemaOperations(true);
 }
 public static ResourceSchema getResourceSchema(
     PrismObject<ResourceType> resource, PrismContext prismContext) throws SchemaException {
   Element resourceXsdSchema = ResourceTypeUtil.getResourceXsdSchema(resource);
   if (resourceXsdSchema == null) {
     return null;
   }
   Object userDataEntry = resource.getUserData(USER_DATA_KEY_PARSED_RESOURCE_SCHEMA);
   if (userDataEntry != null) {
     if (userDataEntry instanceof ResourceSchema) {
       return (ResourceSchema) userDataEntry;
     } else {
       throw new IllegalStateException(
           "Expected ResourceSchema under user data key "
               + USER_DATA_KEY_PARSED_RESOURCE_SCHEMA
               + "in "
               + resource
               + ", but got "
               + userDataEntry.getClass());
     }
   } else {
     InternalMonitor.recordResourceSchemaParse();
     ResourceSchemaImpl parsedSchema =
         ResourceSchemaImpl.parse(
             resourceXsdSchema, "resource schema of " + resource, prismContext);
     if (parsedSchema == null) {
       throw new IllegalStateException("Parsed schema is null: most likely an internall error");
     }
     resource.setUserData(USER_DATA_KEY_PARSED_RESOURCE_SCHEMA, parsedSchema);
     parsedSchema.setNamespace(ResourceTypeUtil.getResourceNamespace(resource));
     return parsedSchema;
   }
 }
Ejemplo n.º 3
0
 protected void assertScriptExecutionIncrement(int expectedIncrement) {
   long currentScriptExecutionCount = InternalMonitor.getScriptExecutionCount();
   long actualIncrement = currentScriptExecutionCount - lastScriptExecutionCount;
   assertEquals(
       "Unexpected increment in script execution count",
       (long) expectedIncrement,
       actualIncrement);
   lastScriptExecutionCount = currentScriptExecutionCount;
 }
Ejemplo n.º 4
0
 protected void rememberScriptExecutionCount() {
   lastScriptExecutionCount = InternalMonitor.getScriptExecutionCount();
 }