コード例 #1
0
  @Override
  public void initSystem(Task initTask, OperationResult initResult) throws Exception {
    super.initSystem(initTask, initResult);
    LOGGER.trace("initSystem");

    // Resources
    File targetDir = new File(TEST_TARGET_DIR);
    if (!targetDir.exists()) {
      targetDir.mkdirs();
    }

    MiscUtil.copyFile(new File(BROKEN_CSV_SOURCE_FILE_NAME), new File(BROKEN_CSV_TARGET_FILE_NAME));

    repoAddObjectFromFile(CONNECTOR_DUMMY_NOJARS_FILENAME, ConnectorType.class, initResult);

    dummyResourceCtl = DummyResourceContoller.create(null);
    dummyResourceCtl.extendSchemaPirate();
    dummyResource = dummyResourceCtl.getDummyResource();

    resourceDummy =
        importAndGetObjectFromFile(
            ResourceType.class, RESOURCE_DUMMY_FILE, RESOURCE_DUMMY_OID, initTask, initResult);
    resourceDummyType = resourceDummy.asObjectable();
    dummyResourceCtl.setResource(resourceDummy);

    importObjectFromFile(RESOURCE_CSVFILE_BROKEN_FILENAME, initResult);
    importObjectFromFile(RESOURCE_CSVFILE_NOTFOUND_FILENAME, initResult);
    importObjectFromFile(RESOURCE_DUMMY_NOJARS_FILENAME, initResult);

    // Accounts
    repoAddObjectFromFile(ACCOUNT_SHADOW_MURRAY_CSVFILE_FILENAME, ShadowType.class, initResult);

    // Users
    userTypeJack = repoAddObjectFromFile(USER_JACK_FILE, UserType.class, initResult).asObjectable();

    assumeAssignmentPolicy(AssignmentPolicyEnforcementType.NONE);
  }
コード例 #2
0
  @Override
  public void initSystem(Task initTask, OperationResult initResult) throws Exception {
    LOGGER.trace("initSystem");
    super.initSystem(initTask, initResult);

    mappingFactory.setProfiling(true);
    lensDebugListener = new ProfilingLensDebugListener();
    clockwork.setDebugListener(lensDebugListener);

    // Resources

    dummyResourceCtl = DummyResourceContoller.create(null);
    dummyResourceCtl.extendSchemaPirate();
    dummyResource = dummyResourceCtl.getDummyResource();
    dummyResourceCtl.addAttrDef(
        dummyResource.getAccountObjectClass(),
        DUMMY_ACCOUNT_ATTRIBUTE_SEA_NAME,
        String.class,
        false,
        false);
    resourceDummy =
        importAndGetObjectFromFile(
            ResourceType.class, getResourceDummyFile(), RESOURCE_DUMMY_OID, initTask, initResult);
    resourceDummyType = resourceDummy.asObjectable();
    dummyResourceCtl.setResource(resourceDummy);

    dummyResourceCtlRed = DummyResourceContoller.create(RESOURCE_DUMMY_RED_NAME, resourceDummyRed);
    dummyResourceCtlRed.extendSchemaPirate();
    dummyResourceRed = dummyResourceCtlRed.getDummyResource();
    resourceDummyRed =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_RED_FILE,
            RESOURCE_DUMMY_RED_OID,
            initTask,
            initResult);
    resourceDummyRedType = resourceDummyRed.asObjectable();
    dummyResourceCtlRed.setResource(resourceDummyRed);

    dummyResourceCtlBlue =
        DummyResourceContoller.create(RESOURCE_DUMMY_BLUE_NAME, resourceDummyBlue);
    dummyResourceCtlBlue.extendSchemaPirate();
    dummyResourceBlue = dummyResourceCtlBlue.getDummyResource();
    resourceDummyBlue =
        importAndGetObjectFromFile(
            ResourceType.class,
            getResourceDummyBlueFile(),
            RESOURCE_DUMMY_BLUE_OID,
            initTask,
            initResult);
    resourceDummyBlueType = resourceDummyBlue.asObjectable();
    dummyResourceCtlBlue.setResource(resourceDummyBlue);

    dummyResourceCtlWhite =
        DummyResourceContoller.create(RESOURCE_DUMMY_WHITE_NAME, resourceDummyWhite);
    dummyResourceCtlWhite.extendSchemaPirate();
    dummyResourceWhite = dummyResourceCtlWhite.getDummyResource();
    resourceDummyWhite =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_WHITE_FILENAME,
            RESOURCE_DUMMY_WHITE_OID,
            initTask,
            initResult);
    resourceDummyWhiteType = resourceDummyWhite.asObjectable();
    dummyResourceCtlWhite.setResource(resourceDummyWhite);

    dummyResourceCtlYellow =
        DummyResourceContoller.create(RESOURCE_DUMMY_YELLOW_NAME, resourceDummyYellow);
    dummyResourceCtlYellow.extendSchemaPirate();
    dummyResourceYellow = dummyResourceCtlYellow.getDummyResource();
    resourceDummyYellow =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_YELLOW_FILENAME,
            RESOURCE_DUMMY_YELLOW_OID,
            initTask,
            initResult);
    resourceDummyYellowType = resourceDummyYellow.asObjectable();
    dummyResourceCtlYellow.setResource(resourceDummyYellow);

    dummyResourceCtlGreen =
        DummyResourceContoller.create(RESOURCE_DUMMY_GREEN_NAME, resourceDummyGreen);
    dummyResourceCtlGreen.extendSchemaPirate();
    dummyResourceGreen = dummyResourceCtlGreen.getDummyResource();
    resourceDummyGreen =
        importAndGetObjectFromFile(
            ResourceType.class,
            getResourceDummyGreenFile(),
            RESOURCE_DUMMY_GREEN_OID,
            initTask,
            initResult);
    resourceDummyGreenType = resourceDummyGreen.asObjectable();
    dummyResourceCtlGreen.setResource(resourceDummyGreen);

    dummyResourceCtlBlack =
        DummyResourceContoller.create(RESOURCE_DUMMY_BLACK_NAME, resourceDummyBlack);
    dummyResourceCtlBlack.extendSchemaPirate();
    dummyResourceBlack = dummyResourceCtlBlack.getDummyResource();
    resourceDummyBlack =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_BLACK_FILENAME,
            RESOURCE_DUMMY_BLACK_OID,
            initTask,
            initResult);
    resourceDummyBlackType = resourceDummyBlack.asObjectable();
    dummyResourceCtlBlack.setResource(resourceDummyBlack);

    dummyResourceCtlOrange =
        DummyResourceContoller.create(RESOURCE_DUMMY_ORANGE_NAME, resourceDummyOrange);
    dummyResourceCtlOrange.extendSchemaPirate();
    dummyResourceOrange = dummyResourceCtlOrange.getDummyResource();
    resourceDummyOrange =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_ORANGE_FILENAME,
            RESOURCE_DUMMY_ORANGE_OID,
            initTask,
            initResult);
    resourceDummyOrangeType = resourceDummyOrange.asObjectable();
    dummyResourceCtlOrange.setResource(resourceDummyOrange);

    dummyResourceCtlUpcase =
        DummyResourceContoller.create(RESOURCE_DUMMY_UPCASE_NAME, resourceDummyUpcase);
    dummyResourceCtlUpcase.extendSchemaPirate();
    dummyResourceUpcase = dummyResourceCtlUpcase.getDummyResource();
    resourceDummyUpcase =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_UPCASE_FILE,
            RESOURCE_DUMMY_UPCASE_OID,
            initTask,
            initResult);
    resourceDummyUpcaseType = resourceDummyUpcase.asObjectable();
    dummyResourceCtlUpcase.setResource(resourceDummyUpcase);
    dummyResourceCtlUpcase.addGroup(GROUP_JOKER_DUMMY_UPCASE_NAME);

    resourceDummySchemaless =
        importAndGetObjectFromFile(
            ResourceType.class,
            RESOURCE_DUMMY_SCHEMALESS_FILENAME,
            RESOURCE_DUMMY_SCHEMALESS_OID,
            initTask,
            initResult);
    resourceDummySchemalessType = resourceDummySchemaless.asObjectable();

    postInitDummyResouce();

    dummyResourceCtl.addAccount(ACCOUNT_HERMAN_DUMMY_USERNAME, "Herman Toothrot", "Monkey Island");
    dummyResourceCtl.addAccount(
        ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", "Melee Island");
    dummyResourceCtl.addAccount(
        ACCOUNT_DAVIEJONES_DUMMY_USERNAME, "Davie Jones", "Davie Jones' Locker");
    dummyResourceCtl.addAccount(ACCOUNT_CALYPSO_DUMMY_USERNAME, "Tia Dalma", "Pantano River");

    dummyResourceCtl.addAccount(ACCOUNT_ELAINE_DUMMY_USERNAME, "Elaine Marley", "Melee Island");
    dummyResourceCtlRed.addAccount(ACCOUNT_ELAINE_DUMMY_USERNAME, "Elaine Marley", "Melee Island");
    dummyResourceCtlBlue.addAccount(ACCOUNT_ELAINE_DUMMY_USERNAME, "Elaine Marley", "Melee Island");

    repoAddObjectFromFile(LOOKUP_LANGUAGES_FILE, ObjectTemplateType.class, initResult);

    repoAddObjectFromFile(SECURITY_POLICY_FILE, SecurityPolicyType.class, initResult);

    // User Templates
    repoAddObjectFromFile(USER_TEMPLATE_FILENAME, ObjectTemplateType.class, initResult);
    repoAddObjectFromFile(USER_TEMPLATE_COMPLEX_FILENAME, ObjectTemplateType.class, initResult);
    repoAddObjectFromFile(
        USER_TEMPLATE_COMPLEX_INCLUDE_FILENAME, ObjectTemplateType.class, initResult);
    repoAddObjectFromFile(
        USER_TEMPLATE_ORG_ASSIGNMENT_FILENAME, ObjectTemplateType.class, initResult);

    // Shadows
    repoAddObjectFromFile(ACCOUNT_SHADOW_GUYBRUSH_DUMMY_FILE, ShadowType.class, initResult);
    repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_FILE, ShadowType.class, initResult);
    repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_RED_FILE, ShadowType.class, initResult);
    repoAddObjectFromFile(ACCOUNT_SHADOW_ELAINE_DUMMY_BLUE_FILE, ShadowType.class, initResult);
    repoAddObjectFromFile(GROUP_SHADOW_JOKER_DUMMY_UPCASE_FILE, ShadowType.class, initResult);

    // Users
    userTypeJack =
        repoAddObjectFromFile(USER_JACK_FILE, UserType.class, true, initResult).asObjectable();
    userTypeBarbossa =
        repoAddObjectFromFile(USER_BARBOSSA_FILE, UserType.class, initResult).asObjectable();
    userTypeGuybrush =
        repoAddObjectFromFile(USER_GUYBRUSH_FILE, UserType.class, initResult).asObjectable();
    userTypeElaine =
        repoAddObjectFromFile(USER_ELAINE_FILENAME, UserType.class, initResult).asObjectable();

    // Roles
    repoAddObjectFromFile(ROLE_PIRATE_FILE, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_NICE_PIRATE_FILENAME, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_CAPTAIN_FILENAME, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_JUDGE_FILE, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_JUDGE_DEPRECATED_FILE, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_THIEF_FILE, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_EMPTY_FILE, RoleType.class, initResult);
    repoAddObjectFromFile(ROLE_SAILOR_FILE, RoleType.class, initResult);

    // Orgstruct
    if (doAddOrgstruct()) {
      repoAddObjectsFromFile(ORG_MONKEY_ISLAND_FILE, OrgType.class, initResult);
    }
  }