Code Monkey home page Code Monkey logo

cloud-resource's Introduction

Test resource manager

  • Manages test resource files in a hybrid manner
    • Resource files are centrally managed in automation-resource-store-do-not-remove bucket in cn-east-2.
    • In each test environment (including both in-door test environment and and each region online) a copy of the resource files are maintained in automation-resource-${pin}-${region} bucket for each user.
    • Each resource file is downloaded to local (under ${project_home}/local_resource) on use.
    • If no luxury to access cn-east-2 OSS service, just simply place the resource files (copied from a location where cn-east-2 OSS service can be accessed) into ${project_home}/local_resource/${tag} directory, the resource manager can then use them for test as well.
  • Usage
    • Use existing resource files (already defined in com.jcloud.resource.XXXResource files):
      • Use a resource online: String bucketName = resource.getResourceObject().getBucket(); String key = resource.getResourceObject.getKey();
      • Use a resource in local work sapce: File resourceFile = resource.getResourceFile();
    • Use a new resource file (not defined in com.jcloud.resource.XXXResource files yet):
      1. Edit one of the com.jcloud.resource.XXXResource files (or create a new one, if none of the existing files can properly include your new resource).
      2. Place the new resource file into ${project_home}/local_resource/${tag}, where ${tag} is defined by the first parameter of the new "Resource" object in your Resource file.
      3. Run corresponding TestNG method in com.jcloud.Uploader.
  • Basic flow
    • Use a resource online: if(isAvailableInResourceBucket()) { return resourceObject; }

        if(!resourceFile.exists()) {
            if(isAvailableInResourceStore()) {
                downloadFromResourceStore();
            } else {
                throw new ResourceNotFoundException(this);
            }
        }
      
        uploadToResourceBucket();
      
        return resourceObject;
      
    • Use a resource in local work space: if(resourceFile.exists()) { return resourceFile; }

        if(isAvailableInResourceBucket()) {
            downloadFromResourceBucket();
        } else if(isAvailableInResourceStore()) {
            downloadFromResourceStore();
            uploadToResourceBucket();
        } else {
            throw new ResourceNotFoundException(this);
        }
      
        return resourceFile;
      

cloud-resource's People

Contributors

zhangyue avatar ffzy avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.