Class DataInjector

java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.services.bench.DataInjector
All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin

public abstract class DataInjector extends org.exoplatform.container.component.BaseComponentPlugin
  • Field Details

  • Constructor Details

    • DataInjector

      public DataInjector()
  • Method Details

    • getRestId

      public String getRestId()
    • setRestId

      public void setRestId(String restId)
    • getLog

      public abstract org.exoplatform.services.log.Log getLog()
      get log object.
      Returns:
    • execute

      public abstract Object execute(HashMap<String,String> params) throws Exception
      This function should be implemented to execute tasks that require to response data to client.
      Parameters:
      params - query parameters of a HTTP GET request.
      Returns:
      object that can be serialized to JSON object.
      Throws:
      Exception
    • inject

      public abstract void inject(HashMap<String,String> params) throws Exception
      This function should be implemented to inject data into the product.
      Parameters:
      params - parameters for injecting. They can be query parameters of a HTTP GET request.
      Throws:
      Exception
    • reject

      public abstract void reject(HashMap<String,String> params) throws Exception
      This function should be implemented to clear data that is injected before by inject(java.util.HashMap<java.lang.String, java.lang.String>).
      Parameters:
      params - parameters for rejecting. They can be query parameters of a HTTP GET request.
      Throws:
      Exception
    • words

      public final String words(int amount)
      get pseudo words.
      Parameters:
      amount - number of words
      Returns:
      pseudo words
    • paragraphs

      public final String paragraphs(int amount)
      get pseudo paragraphs.
      Parameters:
      amount - number of paragraphs
      Returns:
      pseudo paragraphs
    • randomUser

      public final String randomUser()
      get random user id.
    • randomWords

      public final String randomWords(int i)
      get random words.
      Parameters:
      i - maximum number of words. the number of words is between 0 and i.
      Returns:
    • randomParagraphs

      public final String randomParagraphs(int i)
      get random paragraphs
      Parameters:
      i - maximum number of paragraphs.
      Returns:
    • createTextResource

      public String createTextResource(int size)
      create text/plain resource by size.
      Parameters:
      size - in kilobyte
      Returns:
    • readGroupsIfExist

      public List<String> readGroupsIfExist(HashMap<String,String> queryParams)
    • readUsersIfExist

      public List<String> readUsersIfExist(HashMap<String,String> queryParams)
    • readMembershipIfExist

      public List<String> readMembershipIfExist(HashMap<String,String> queryParams)