agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/dao/AbstractDaoTest.java
/**
     * Creates private execution system with a random uuid as the id.
     * Asserts that the system is created and valid prior to returning.
     * @return a persisted {@link ExecutionSystem}
     */
Creates private execution system with a random uuid as the id.
Asserts that the system is created and valid prior to returning.
@return a persisted  ExecutionSystem
Creates private execution system with a random uuid as the id . Asserts that the system is created and valid prior to returning . @return a persisted ExecutionSystem
protected ExecutionSystem createExecutionSystem(BatchQueue[] batchQueues) {
        ExecutionSystem system = null;
        SystemDao dao = new SystemDao();
        try {
            JSONObject json = JSONTestDataUtil.getInstance().getTestDataObject(TEST_EXECUTION_SYSTEM_FILE);
            json.put("id", UUID.randomUUID().toString());
            JSONArray queues = new JSONArray();
            for(BatchQueue q: batchQueues) {
                BatchQueue cc = q.clone();
                JSONObject jsonQ = new JSONObject()
                    .put("id", cc.getUuid())
                    .put("name", cc.getName())
                    .put("mappedName", UUID.randomUUID().toString())
                    .put("description", cc.getDescription())
                    .put("default", cc.isSystemDefault())
                    .put("maxJobs", cc.getMaxJobs())
                    .put("maxUserJobs", cc.getMaxUserJobs())
                    .put("maxNodes", cc.getMaxNodes())
                    .put("maxProcessorsPerNode", cc.getMaxProcessorsPerNode())
                    .put("maxMemoryPerNode", cc.getMaxMemoryPerNode())
                    .put("maxRequestedTime", cc.getMaxRequestedTime())
                    .put("customDirectives", cc.getCustomDirectives());
                queues.put(jsonQ);
            }
            json.put("queues", queues);
            system = ExecutionSystem.fromJSON(json);
            system.setOwner(SYSTEM_OWNER);
            system.getUsersUsingAsDefault().add(SYSTEM_OWNER);
            dao.persist(system);
        } catch (IOException | JSONException | SystemArgumentException e) {
            log.error("Unable create execution system", e);
            Assert.fail("Unable create execution system", e);
        }
        return system;
    }
protected ExecutionSystem createExecutionSystem ( BatchQueue [ ] batchQueues ) { ExecutionSystem system = null ; SystemDao dao = new SystemDao ( ) ; try { JSONObject json = JSONTestDataUtil . getInstance ( ) . getTestDataObject ( TEST_EXECUTION_SYSTEM_FILE ) ; json . put ( "id" , UUID . randomUUID ( ) . toString ( ) ) ; JSONArray queues = new JSONArray ( ) ; for ( BatchQueue q : batchQueues ) { BatchQueue cc = q . clone ( ) ; JSONObject jsonQ = new JSONObject ( ) . put ( "id" , cc . getUuid ( ) ) . put ( "name" , cc . getName ( ) ) . put ( "mappedName" , UUID . randomUUID ( ) . toString ( ) ) . put ( "description" , cc . getDescription ( ) ) . put ( "default" , cc . isSystemDefault ( ) ) . put ( "maxJobs" , cc . getMaxJobs ( ) ) . put ( "maxUserJobs" , cc . getMaxUserJobs ( ) ) . put ( "maxNodes" , cc . getMaxNodes ( ) ) . put ( "maxProcessorsPerNode" , cc . getMaxProcessorsPerNode ( ) ) . put ( "maxMemoryPerNode" , cc . getMaxMemoryPerNode ( ) ) . put ( "maxRequestedTime" , cc . getMaxRequestedTime ( ) ) . put ( "customDirectives" , cc . getCustomDirectives ( ) ) ; queues . put ( jsonQ ) ; } json . put ( "queues" , queues ) ; system = ExecutionSystem . fromJSON ( json ) ; system . setOwner ( SYSTEM_OWNER ) ; system . getUsersUsingAsDefault ( ) . add ( SYSTEM_OWNER ) ; dao . persist ( system ) ; } catch ( IOException | JSONException | SystemArgumentException e ) { log . error ( "Unable create execution system" , e ) ; Assert . fail ( "Unable create execution system" , e ) ; } return system ; }
Creates private execution system with a random uuid as the id.
Creates private execution system with a random uuid as the id .
// add batch queues into system json, replacing previous ones. // now marshal to an ExecutionSystem and save