Package org.apache.jmeter.services

Examples of org.apache.jmeter.services.FileServer$FileEntry


    /**
     * {@inheritDoc}
     */
    @Override
    public int parse(TestElement el, int parseCount) {
        FileServer fileServer = FileServer.getFileServer();
        fileServer.reserveFile(FILENAME);
        try {
            return parse(fileServer, el, parseCount);
        } catch (Exception exception) {
            log.error("Problem creating samples", exception);
        }
View Full Code Here


        super.setProperty(property);       
    }

    @Override
    public void iterationStart(LoopIterationEvent iterEvent) {
        FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
        String delim = getDelimiter();
        if (delim.equals("\\t")) { // $NON-NLS-1$
            delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
        } else if (delim.length()==0){
            log.warn("Empty delimiter converted to ','");
            delim=",";
        }
        if (vars == null) {
            String _fileName = getFilename();
            String mode = getShareMode();
            int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
            switch(modeInt){
                case CSVDataSetBeanInfo.SHARE_ALL:
                    alias = _fileName;
                    break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
            }
            final String names = getVariableNames();
            if (names == null || names.length()==0) {
                String header = server.reserveFile(_fileName, getFileEncoding(), alias, true);
                try {
                    vars = CSVSaveService.csvSplitString(header, delim.charAt(0));
                    firstLineIsNames = true;
                } catch (IOException e) {
                    log.warn("Could not split CSV header line",e);
                }
            } else {
                server.reserveFile(_fileName, getFileEncoding(), alias);
                vars = JOrphanUtils.split(names, ","); // $NON-NLS-1$
            }
        }
          
        // TODO: fetch this once as per vars above?
        JMeterVariables threadVars = context.getVariables();
        String[] lineValues = {};
        try {
            if (getQuotedData()) {
                lineValues = server.getParsedLine(alias, recycle, firstLineIsNames, delim.charAt(0));
            } else {
                String line = server.readLine(alias, recycle, firstLineIsNames);
                lineValues = JOrphanUtils.split(line, delim, false);
            }
            for (int a = 0; a < vars.length && a < lineValues.length; a++) {
                threadVars.put(vars[a], lineValues[a]);
            }
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.apache.jmeter.engine.event.LoopIterationListener#iterationStart(org.apache.jmeter.engine.event.LoopIterationEvent)
   */
  public void iterationStart(LoopIterationEvent iterEvent) {
    FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
    if (vars == null) {
          String _fileName = getFilename();
          String mode = getShareMode();
          int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
          switch(modeInt){
              case CSVDataSetBeanInfo.SHARE_ALL:
                  alias = _fileName;
                  break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
          }
      server.reserveFile(_fileName, getFileEncoding(), alias);
      vars = JOrphanUtils.split(getVariableNames(), ","); // $NON-NLS-1$
    }
    try {
      String delim = getDelimiter();
      if (delim.equals("\\t")) { // $NON-NLS-1$
        delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
        }
      // TODO: fetch this once as per vars above?
            JMeterVariables threadVars = context.getVariables();
      String line = server.readLine(alias,getRecycle());
            if (line!=null) {// i.e. not EOF
                String[] lineValues = getQuotedData() ?
                        CSVSaveService.csvReadFile(new BufferedReader(new StringReader(line)), delim.charAt(0))
                        : JOrphanUtils.split(line, delim, false);
          for (int a = 0; a < vars.length && a < lineValues.length; a++) {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void iterationStart(LoopIterationEvent iterEvent) {
        FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
        String delim = getDelimiter();
        if (delim.equals("\\t")) { // $NON-NLS-1$
            delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
        } else if (delim.length()==0){
            log.warn("Empty delimiter converted to ','");
            delim=",";
        }
        if (vars == null) {
            String _fileName = getFilename();
            String mode = getShareMode();
            int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
            switch(modeInt){
                case CSVDataSetBeanInfo.SHARE_ALL:
                    alias = _fileName;
                    break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
            }
            final String names = getVariableNames();
            if (names == null || names.length()==0) {
                String header = server.reserveFile(_fileName, getFileEncoding(), alias, true);
                try {
                    vars = CSVSaveService.csvSplitString(header, delim.charAt(0));
                    firstLineIsNames = true;
                } catch (IOException e) {
                    log.warn("Could not split CSV header line",e);
                }
            } else {
                server.reserveFile(_fileName, getFileEncoding(), alias);
                vars = JOrphanUtils.split(names, ","); // $NON-NLS-1$
            }
        }
          
        // TODO: fetch this once as per vars above?
        JMeterVariables threadVars = context.getVariables();
        String[] lineValues = {};
        try {
            if (getQuotedData()) {
                lineValues = server.getParsedLine(alias, recycle, firstLineIsNames, delim.charAt(0));
            } else {
                String line = server.readLine(alias, recycle, firstLineIsNames);
                lineValues = JOrphanUtils.split(line, delim, false);
            }
            for (int a = 0; a < vars.length && a < lineValues.length; a++) {
                threadVars.put(vars[a], lineValues[a]);
            }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void iterationStart(LoopIterationEvent iterEvent) {
        FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
        String delim = getDelimiter();
        if (delim.equals("\\t")) { // $NON-NLS-1$
            delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
        } else if (delim.length()==0){
            log.warn("Empty delimiter converted to ','");
            delim=",";
        }
        if (vars == null) {
            String _fileName = getFilename();
            String mode = getShareMode();
            int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
            switch(modeInt){
                case CSVDataSetBeanInfo.SHARE_ALL:
                    alias = _fileName;
                    break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
            }
            final String names = getVariableNames();
            if (names == null || names.length()==0) {
                String header = server.reserveFile(_fileName, getFileEncoding(), alias, true);
                try {
                    vars = CSVSaveService.csvSplitString(header, delim.charAt(0));
                    firstLineIsNames = true;
                } catch (IOException e) {
                    log.warn("Could not split CSV header line",e);
                }
            } else {
                server.reserveFile(_fileName, getFileEncoding(), alias);
                vars = JOrphanUtils.split(names, ","); // $NON-NLS-1$
            }
        }
          
        // TODO: fetch this once as per vars above?
        JMeterVariables threadVars = context.getVariables();
        String line = null;
        try {
            line = server.readLine(alias, getRecycle(), firstLineIsNames);
        } catch (IOException e) { // treat the same as EOF
            log.error(e.toString());
        }
        if (line!=null) {// i.e. not EOF
            try {
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.apache.jmeter.engine.event.LoopIterationListener#iterationStart(org.apache.jmeter.engine.event.LoopIterationEvent)
   */
  public void iterationStart(LoopIterationEvent iterEvent) {
    FileServer server = FileServer.getFileServer();
    if (vars == null) {
      server.reserveFile(getFilename());
      vars = JOrphanUtils.split(getVariableNames(), ",");
    }
    try {
      String delim = getDelimiter();
      if (delim.equals("\\t"))
        delim = "\t";// Make it easier to enter a Tab
      String[] lineValues = JOrphanUtils.split(server.readLine(getFilename()), delim);
      for (int a = 0; a < vars.length && a < lineValues.length; a++) {
        this.getThreadContext().getVariables().put(vars[a], lineValues[a]);
      }
    } catch (IOException e) {
      log.error("Failed to read file: " + getFilename());
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void iterationStart(LoopIterationEvent iterEvent) {
        FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
        if (vars == null) {
            String _fileName = getFilename();
            String mode = getShareMode();
            int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
            switch(modeInt){
                case CSVDataSetBeanInfo.SHARE_ALL:
                    alias = _fileName;
                    break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
            }
            final String names = getVariableNames();
            if (names == null || names.length()==0) {
                String header = server.reserveFile(_fileName, getFileEncoding(), alias, true);
                try {
                    vars = CSVSaveService.csvSplitString(header, getDelimiter().charAt(0));
                } catch (IOException e) {
                    log.warn("Could not split CSV header line",e);
                }
            } else {
                server.reserveFile(_fileName, getFileEncoding(), alias);
                vars = JOrphanUtils.split(names, ","); // $NON-NLS-1$
            }
        }
        try {
            String delim = getDelimiter();
            if (delim.equals("\\t")) { // $NON-NLS-1$
                delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
            } else if (delim.length()==0){
                log.warn("Empty delimiter converted to ','");
                delim=",";
            }
            // TODO: fetch this once as per vars above?
            JMeterVariables threadVars = context.getVariables();
            String line = server.readLine(alias,getRecycle());
            if (line!=null) {// i.e. not EOF
                String[] lineValues = getQuotedData() ?
                        CSVSaveService.csvSplitString(line, delim.charAt(0))
                        : JOrphanUtils.split(line, delim, false);
                for (int a = 0; a < vars.length && a < lineValues.length; a++) {
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.jmeter.engine.event.LoopIterationListener#iterationStart(org.apache.jmeter.engine.event.LoopIterationEvent)
     */
    public void iterationStart(LoopIterationEvent iterEvent) {
        FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
        if (vars == null) {
            String _fileName = getFilename();
            String mode = getShareMode();
            int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
            switch(modeInt){
                case CSVDataSetBeanInfo.SHARE_ALL:
                    alias = _fileName;
                    break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
            }
            server.reserveFile(_fileName, getFileEncoding(), alias);
            vars = JOrphanUtils.split(getVariableNames(), ","); // $NON-NLS-1$
        }
        try {
            String delim = getDelimiter();
            if (delim.equals("\\t")) { // $NON-NLS-1$
                delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
            } else if (delim.length()==0){
                log.warn("Empty delimiter converted to ','");
                delim=",";
            }
            // TODO: fetch this once as per vars above?
            JMeterVariables threadVars = context.getVariables();
            String line = server.readLine(alias,getRecycle());
            if (line!=null) {// i.e. not EOF
                String[] lineValues = getQuotedData() ?
                        CSVSaveService.csvSplitString(line, delim.charAt(0))
                        : JOrphanUtils.split(line, delim, false);
                for (int a = 0; a < vars.length && a < lineValues.length; a++) {
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.jmeter.protocol.http.util.accesslog.TCLogParser#parse(org.apache.jmeter.testelement.TestElement, int)
     */
    public int parse(TestElement el, int parseCount) {
        FileServer fileServer = FileServer.getFileServer();
        fileServer.reserveFile(FILENAME);
        try {
            return parse(fileServer, el, parseCount);
        } catch (Exception exception) {
            log.error("Problem creating samples", exception);
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void iterationStart(LoopIterationEvent iterEvent) {
        FileServer server = FileServer.getFileServer();
        final JMeterContext context = getThreadContext();
        String delim = getDelimiter();
        if (delim.equals("\\t")) { // $NON-NLS-1$
            delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
        } else if (delim.length()==0){
            log.warn("Empty delimiter converted to ','");
            delim=",";
        }
        if (vars == null) {
            String _fileName = getFilename();
            String mode = getShareMode();
            int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
            switch(modeInt){
                case CSVDataSetBeanInfo.SHARE_ALL:
                    alias = _fileName;
                    break;
                case CSVDataSetBeanInfo.SHARE_GROUP:
                    alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
                    break;
                case CSVDataSetBeanInfo.SHARE_THREAD:
                    alias = _fileName+"@"+System.identityHashCode(context.getThread());
                    break;
                default:
                    alias = _fileName+"@"+mode; // user-specified key
                    break;
            }
            final String names = getVariableNames();
            if (names == null || names.length()==0) {
                String header = server.reserveFile(_fileName, getFileEncoding(), alias, true);
                try {
                    vars = CSVSaveService.csvSplitString(header, delim.charAt(0));
                    firstLineIsNames = true;
                } catch (IOException e) {
                    log.warn("Could not split CSV header line",e);
                }
            } else {
                server.reserveFile(_fileName, getFileEncoding(), alias);
                vars = JOrphanUtils.split(names, ","); // $NON-NLS-1$
            }
        }
          
        // TODO: fetch this once as per vars above?
        JMeterVariables threadVars = context.getVariables();
        String[] lineValues = {};
        try {
            if (getQuotedData()) {
                lineValues = server.getParsedLine(alias, recycle, firstLineIsNames, delim.charAt(0));
            } else {
                String line = server.readLine(alias, recycle, firstLineIsNames);
                lineValues = JOrphanUtils.split(line, delim, false);
            }
            for (int a = 0; a < vars.length && a < lineValues.length; a++) {
                threadVars.put(vars[a], lineValues[a]);
            }
View Full Code Here

TOP

Related Classes of org.apache.jmeter.services.FileServer$FileEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.