text:
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

//const $ = document.querySelector.bind(document);
//const css = (el,prop) => parseInt(window.getComputedStyle(el).getPropertyValue(prop));
var Interface = function () {
  function Interface() {
    _classCallCheck(this, Interface);
  }

  _createClass(Interface, [{
    key: 'toggle',
    value: function toggle() {
      var panel = $('.hidden-box');
      var classname = '';
      var state = panel.css('top');
      if (state != 0) {
        panel.self.classList.remove('hide');
        classname = 'show';
      } else {
        panel.self.classList.remove('show');
        classname = 'hide';
      }
      panel.self.style.left = (document.documentElement.clientWidth - panel.css('width')) / 2 + 'px';
      panel.self.classList.add(classname);
    }
  }, {
    key: 'on',
    value: function on() {
      $('#switch').self.addEventListener('click', this.toggle, false);
    }
  }]);

  return Interface;
}();

new Interface().on();


text:
import { expect } from 'chai';
import { assert } from 'chai';
import { newConfig } from 'src/config';

const utils = require('src/utils');

let getConfig;
let setConfig;
let setDefaults;

describe('config API', () => {
  let logErrorSpy;
  beforeEach(() => {
    const config = newConfig();
    getConfig = config.getConfig;
    setConfig = config.setConfig;
    setDefaults = config.setDefaults;
    logErrorSpy = sinon.spy(utils, 'logError');
  });

  afterEach(() => {
    utils.logError.restore();
  });

  it('setConfig is a function', () => {
    expect(setConfig).to.be.a('function');
  });

  it('getConfig returns an object', () => {
    expect(getConfig()).to.be.a('object');
  });

  it('sets and gets arbitrary configuarion properties', () => {
    setConfig({ baz: 'qux' });
    expect(getConfig('baz')).to.equal('qux');
  });

  it('only accepts objects', () => {
    setConfig('invalid');
    expect(getConfig('0')).to.not.equal('i');
  });

  it('sets multiple config properties', () => {
    setConfig({ foo: 'bar' });
    setConfig({ biz: 'buz' });
    var config = getConfig();
    expect(config.foo).to.equal('bar');
    expect(config.biz).to.equal('buz');
  });

  it('overwrites existing config properties', () => {
    setConfig({ foo: {biz: 'buz'} });
    setConfig({ foo: {baz: 'qux'} });
    expect(getConfig('foo')).to.eql({baz: 'qux'});
  });

  it('sets debugging', () => {
    setConfig({ debug: true });
    expect(getConfig('debug')).to.be.true;
  });

  // remove test when @deprecated $$PREBID_GLOBAL$$.logging removed
  it('gets legacy logging in deprecation window', () => {
    $$PREBID_GLOBAL$$.logging = false;
    expect(getConfig('debug')).to.equal(false);
  });

  it('sets bidderTimeout', () => {
    setConfig({ bidderTimeout: 1000 });
    expect(getConfig('bidderTimeout')).to.be.equal(1000);
  });

  // remove test when @deprecated $$PREBID_GLOBAL$$.bidderTimeout removed
  it('gets legacy bidderTimeout in deprecation window', () => {
    $$PREBID_GLOBAL$$.bidderTimeout = 5000;
    expect(getConfig('bidderTimeout')).to.equal(5000);
  });

  it('gets user-defined publisherDomain', () => {
    setConfig({ publisherDomain: 'fc.kahuna' });
    expect(getConfig('publisherDomain')).to.equal('fc.kahuna');
  });

  // remove test when @deprecated $$PREBID_GLOBAL$$.publisherDomain removed
  it('gets legacy publisherDomain in deprecation window', () => {
    $$PREBID_GLOBAL$$.publisherDomain = 'ad.example.com';
    expect(getConfig('publisherDomain')).to.equal('ad.example.com');
  });

  it('gets default userSync config', () => {
    const DEFAULT_USERSYNC = {
      syncEnabled: true,
      pixelEnabled: true,
      syncsPerBidder: 5,
      syncDelay: 3000
    };
    setDefaults({'userSync': DEFAULT_USERSYNC});
    expect(getConfig('userSync')).to.eql(DEFAULT_USERSYNC);
  });

  it('has subscribe functionality for adding listeners to config updates', () => {
    const listener = sinon.spy();

    getConfig(listener);

    setConfig({ foo: 'bar' });

    sinon.assert.calledOnce(listener);
    sinon.assert.calledWith(listener, { foo: 'bar' });
  });

  it('subscribers can unsubscribe', () => {
    const listener = sinon.spy();

    const unsubscribe = getConfig(listener);

    unsubscribe();

    setConfig({ logging: true });

    sinon.assert.notCalled(listener);
  });

  it('subscribers can subscribe to topics', () => {
    const listener = sinon.spy();

    getConfig('logging', listener);

    setConfig({ logging: true, foo: 'bar' });

    sinon.assert.calledOnce(listener);
    sinon.assert.calledWithExactly(listener, { logging: true });
  });

  it('topic subscribers are only called when that topic is changed', () => {
    const listener = sinon.spy();
    const wildcard = sinon.spy();

    getConfig('subject', listener);
    getConfig(wildcard);

    setConfig({ foo: 'bar' });

    sinon.assert.notCalled(listener);
    sinon.assert.calledOnce(wildcard);
  });

  it('sets priceGranularity', () => {
    setConfig({ priceGranularity: 'low' });
    expect(getConfig('priceGranularity')).to.be.equal('low');
  });

  it('sets priceGranularity and customPriceBucket', () => {
    const goodConfig = {
      'buckets': [{
        'min': 0,
        'max': 3,
        'increment': 0.01,
        'cap': true
      }]
    };
    setConfig({ priceGranularity: goodConfig });
    expect(getConfig('priceGranularity')).to.be.equal('custom');
    expect(getConfig('customPriceBucket')).to.equal(goodConfig);
  });

  it('should log error for invalid priceGranularity', () => {
    setConfig({ priceGranularity: '' });
    const error = 'Prebid Error: no value passed to `setPriceGranularity()`';
    assert.ok(logErrorSpy.calledWith(error), 'expected error was logged');
  });
});

redpajama_set_name: RedPajamaGithub


text:
package com.danielesegato.adme.content;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.AsyncTaskLoader;
import android.util.Log;

import com.danielesegato.adme.InternalADMEConsts;

/**
 * An abstract {@link BaseContentWrapper} loader that automatically start loading on initialization.
 *

 * It cache the value returned by {@link #loadContentInBackground()} and automatically refresh reload
 * in background when the data behind the ContentWrapper changes.
 *

 * It automatically handle the wrapper close method and observer registering.
 */
public abstract class ADMEContentLoaderCompat<D> extends AsyncTaskLoader<ContentWrapper<D>> {

    private final ForceLoadContentObserver observer;
    protected ContentWrapper<D> mContent;
    private ContentWrapper<D> mContentObserved;

    public ADMEContentLoaderCompat(Context context) {
        super(context);
        this.observer = new ForceLoadContentObserver();
    }

    @Override
    protected void onStartLoading() {
        if (mContent != null) {
            deliverResult(mContent);
        }

        if (mContent == null || takeContentChanged()) {
            forceLoad();
        }
    }

    @Override
    public void deliverResult(ContentWrapper<D> data) {
        if (isReset()) {
            if (data != null) {
                unobserve(data);
                data.close();
            }
            return;
        }

        ContentWrapper<D> oldContent = mContent;

        boolean dataChanged = data != oldContent;
        boolean needCloseOld = oldContent != null && dataChanged;
        if (needCloseOld) {
            unobserve(oldContent);
        }

        observe(data);
        mContent = data;
        if (isStarted()) {
            super.deliverResult(data);
        }
        if (needCloseOld) {
            oldContent.close();
        }
    }

    @Override
    public void onContentChanged() {
        // avoid recursive calls
        unobserve(mContentObserved);
        super.onContentChanged();
    }

    @Override
    public final ContentWrapper<D> loadInBackground() {
        return loadContentInBackground();
    }

    public abstract
    @NonNull
    ContentWrapper<D> loadContentInBackground();

    @Override
    public void onCanceled(ContentWrapper<D> data) {
        if (data != null) {
            data.close();
        }
    }

    @Override
    protected void onReset() {
        onStopLoading();
        if (mContent != null) {
            unobserve(mContent);
            mContent.close();
        }
        mContent = null;
    }

    private synchronized void unobserve(ContentWrapper<D> content) {
        if (content != mContentObserved || content == null) {
            return;
        }
        try {
            content.unregisterContentObserver(observer);
        } catch (IllegalStateException e) {
            Log.w(InternalADMEConsts.LOGTAG, String.format("unregisterContentObserver(): %s - NOT NEEDED, wasn't registered", content), e);
        }
        mContentObserved = null;
    }

    private synchronized void observe(ContentWrapper<D> content) {
        if (content == mContentObserved) {
            return;
        }
        if (mContentObserved != null) {
            Log.w(InternalADMEConsts.LOGTAG, String.format("registering observer when another content is already observed: %s -> %s", mContentObserved, content));
            unobserve(mContentObserved);
        }
        if (content == null) {
            return;
        }
        try {
            content.registerContentObserver(observer);
            mContentObserved = content;
        } catch (IllegalStateException e) {
            Log.w(InternalADMEConsts.LOGTAG, String.format("registerContentObserver(): %s - NOT NEEDED, already registered", content), e);
        }
    }
}


text:
define(function(require) {
    'use strict';

    const $ = require('jquery');
    const _ = require('underscore');
    const __ = require('orotranslation/js/translator');
    const routing = require('routing');
    const DialogWidget = require('oro/dialog-widget');
    const BaseView = require('oroui/js/app/views/base/view');
    const PageableCollection = require('orodatagrid/js/pageable-collection');

    const SelectCreateInlineTypeView = BaseView.extend({
        autoRender: true,

        urlParts: null,

        inputSelector: null,

        select2QueryAdditionalParams: null,

        entityLabel: '',

        existingEntityGridId: null,

        dialogWidget: null,

        events: {
            'click .entity-select-btn': 'onSelect',
            'click .entity-create-btn': 'onCreate'
        },

        listen: {
            'grid_load:complete mediator': 'onGridLoadComplete'
        },

        /**
         * @inheritDoc
         */
        constructor: function SelectCreateInlineTypeView(options) {
            SelectCreateInlineTypeView.__super__.constructor.call(this, options);
        },

        /**
         * @inheritDoc
         */
        initialize: function(options) {
            SelectCreateInlineTypeView.__super__.initialize.call(this, options);
            _.extend(this, _.pick(options, 'urlParts', 'entityLabel', 'existingEntityGridId', 'inputSelector'));
        },

        buildRouteParams: function(routeType) {
            const routeParams = this.urlParts[routeType].parameters;
            return _.extend({}, routeParams, this.$(this.inputSelector).data('select2_query_additional_params'));
        },

        setEnableState: function(enabled) {
            this.$('button').prop('disabled', !enabled);
            this.$(this.inputSelector).select2('readonly', !enabled);
        },

        onSelect: function(e) {
            e.preventDefault();
            const routeName = _.result(this.urlParts.grid, 'gridWidgetView') || this.urlParts.grid.route;
            const routeParams = this.buildRouteParams('grid');
            this.dialogWidget = new DialogWidget({
                title: __('Select {{ entity }}', {entity: this.entityLabel}),
                url: routing.generate(routeName, routeParams),
                stateEnabled: false,
                incrementalPosition: true,
                dialogOptions: {
                    modal: true,
                    allowMaximize: true,
                    width: 1280,
                    height: 650,
                    close: _.bind(this.onDialogClose, this)
                }
            });

            this.dialogWidget.once('grid-row-select', _.bind(this.onGridRowSelect, this));
            this.dialogWidget.render();
        },

        /**
         * Add query_additional_params to select datagrid AJAX request to have them passed in both cases
         * when grid is loaded in widget and when grid data is loaded with AJAX requests like pager, search, etc.
         *
         * @param {Object} collection
         */
        onGridLoadComplete: function(collection) {
            const routeParams = this.buildRouteParams('grid');
            if (collection.inputName === routeParams.gridName) {
                const additionalParameters = _.extend(
                    {},
                    this.select2QueryAdditionalParams,
                    this.$(this.inputSelector).data('select2_query_additional_params')
                );
                this._patchGridCollectionUrl(collection, additionalParameters);
            }
        },

        /**
         * @param {Object} collection
         * @param {Object} params
         * @private
         */
        _patchGridCollectionUrl: function(collection, params) {
            if (!_.isUndefined(collection)) {
                let url = collection.url;
                if (_.isUndefined(url)) {
                    return;
                }
                const newParams = _.extend(this._getQueryParamsFromUrl(url), params);
                if (url.indexOf('?') !== -1) {
                    url = url.substring(0, url.indexOf('?'));
                }
                if (!_.isEmpty(newParams)) {
                    collection.url = url + '?' + $.param(newParams);
                }
            }
        },

        /**
         * @param {String} url
         * @return {Object}
         * @private
         */
        _getQueryParamsFromUrl: function(url) {
            if (_.isUndefined(url)) {
                return {};
            }

            if (url.indexOf('?') === -1) {
                return {};
            }

            const query = url.substring(url.indexOf('?') + 1, url.length);
            if (!query.length) {
                return {};
            }

            return PageableCollection.decodeStateData(query);
        },

        onDialogClose: function() {
            this.$(this.inputSelector).off('.' + this.dialogWidget._wid);
        },

        onGridRowSelect: function(data) {
            const eventNamespace = this.dialogWidget._wid;
            let loadingStarted = false;
            const $input = this.$(this.inputSelector);
            const onSelect = _.bind(function() {
                this.dialogWidget.remove();
                this.dialogWidget = null;

                const $input = this.$(this.inputSelector);
                const $form = $input.closest('form');

                if ($form.length && $form.data('validator')) {
                    $form.validate().element($input);
                }

                $input.inputWidget('focus');
            }, this);
            this.dialogWidget._showLoading();
            $input.one('select2-data-request.' + eventNamespace, function() {
                loadingStarted = true;
                $(this).one('select2-data-loaded.' + eventNamespace, onSelect);
            });
            $input.inputWidget('val', data.model.get(this.existingEntityGridId), true);
            // if there was no data request sent to server
            if (!loadingStarted) {
                onSelect();
            }
        },

        onCreate: function(e) {
            e.preventDefault();
            const routeName = this.urlParts.create.route;
            const routeParams = this.buildRouteParams('create');
            this.dialogWidget = new DialogWidget({
                title: __('Create {{ entity }}', {entity: this.entityLabel}),
                url: routing.generate(routeName, routeParams),
                stateEnabled: false,
                incrementalPosition: true,
                dialogOptions: {
                    modal: true,
                    allowMaximize: true,
                    width: 1280,
                    height: 650,
                    close: _.bind(this.onDialogClose, this)
                }
            });

            this.dialogWidget.once('formSave', _.bind(function(id) {
                const $input = this.$(this.inputSelector);
                $input.inputWidget('val', id, true);
                this.dialogWidget.remove();
                this.dialogWidget = null;

                const $form = $input.closest('form');
                if ($form.length && $form.data('validator')) {
                    $form.validate().element($input);
                }

                $input.inputWidget('focus');
            }, this));

            this.dialogWidget.render();
        },

        getUrlParts: function() {
            return this.urlParts;
        },

        setUrlParts: function(newParts) {
            this.urlParts = newParts;
        },

        setSelection: function(value) {
            this.$(this.inputSelector).inputWidget('val', value);
        },

        getSelection: function() {
            return this.$(this.inputSelector).inputWidget('val');
        }
    });

    return SelectCreateInlineTypeView;
});


text:
/*会员中心*/
body{ background:#f0f0f0}
.profile .top{ padding-top:1.4rem; box-shadow:0 0 4px rgba(0,0,0,0.2); background:#f60 }
.profile .person{ height:1.6rem; background:#fff; font-size:.36rem; }
.profile .person a{ color:#666; width:100%}
.profile .person i.num{ font-size:.5rem; color:#333}
.profile .person .avatar,.profile .person .cart,.profile .person .share,.profile .person .points{ width:25%;  text-align:center; line-height:.44rem; margin-top:.16rem; padding:.2rem 0; position:relative}

.top .person .cart b,.top .person .share b{ border-radius:.4rem; font-size:.3rem; background:#f60; position:absolute; top:0; margin-left:.6rem; font-weight:300; color:#fff;padding: 0 0.12rem; }
.profile .person .avatar{ margin-top:-1.2rem; position:relative;}
.profile .person .avatar span{ box-shadow:0 0 .4rem rgba(0,0,0,0.1) ;border:.1rem solid #fff; float:right;background-position:center center; background-repeat:no-repeat;  border-radius:2rem; height:2rem; width:2rem; display:block;}
.profile .person .avatar .name{ position:absolute;right: -2.6rem;    top: 0.5rem; font-size:.4rem; color:#fff}
.profile .person  i.code{ position:absolute; font-size: 1rem;    position: absolute;    right: 0.2rem;    top: 0.2rem;}
.profile .person .share{ border-left:1px solid #e0e0e0; border-right:1px solid #e0e0e0; box-sizing:border-box}

.mlogin { margin-top: .466667rem; width:100%; }
.mlogin .field {  width:100%; box-sizing: border-box; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-align: center; -webkit-align-items: center; border-bottom: 1px solid #DDD; padding: .373333rem .266667rem; color: #6C6C6C; background-color: #fff; text-align: left }
.field .label { width: 2rem; font-size:.4rem; }
.field .field-control { -webkit-box-flex: 1; -webkit-flex: 1; flex-grow: 1; }
.field .field-control span{ font-size:.4rem; width:100%; display:block;}
.field .field-control input { -webkit-appearance: none; width: 100%; padding: 0; border: 0; background-color: transparent; font-size:.4rem; }
.field .money span{ padding:0.2rem 0}
.field .money span:first-child{ padding-top:0}
 .input-required::-webkit-input-placeholder {
 text-align:right;
}
    /* 火狐浏览器 */
    .input-required::-moz-placeholder {
 text-align:right;
}

.bottomside{ font-size:.4rem; line-height:50px; text-align:right; background:#fff; border-top:1px solid #e0e0e0 }
.bottomside span{ margin-right:.4rem; color:#333}
.bottomside a{padding-right:.4rem; display:inline-block; color:#666}
.bottomside .share{ float:right; font-size:.6rem; border-top-left-radius: 1rem; border-bottom-left-radius: 1rem; background: #f90; box-shadow: 0 0 0.4rem rgba(0,0,0,0.2); color: #fff }


text:
@interface QNResumeUploadTest : QNUploadFlowTest
@property BOOL inTravis;
@end

@implementation QNResumeUploadTest

- (void)setUp {
    [super setUp];
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
    NSString *travis = [[NSProcessInfo processInfo] environment][@"QINIU_TEST_ENV"];
    if ([travis isEqualToString:@"travis"]) {
        _inTravis = YES;
    }
#endif
}

- (void)tearDown {
}

- (void)testSwitchRegionV1 {
    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    NSArray *sizeArray = @[@5000, @8000, @10000, @20000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_switch_region_v1_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeSwitchRegionTestWithFile:tempFile key:key config:config option:nil];
    }
}

- (void)testCancelV1 {
    float cancelPercent = 0.1;

    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    NSArray *sizeArray = @[@30000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_cancel_v1_%@k_%@", size, [NSDate date]];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeCancelTest:cancelPercent * size.longLongValue * 1024 tempFile:tempFile key:key config:config option:nil];
    }
}

- (void)testHttpV1 {
    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];
    NSArray *sizeArray = @[@500, @1000, @3000, @4000, @5000, @8000, @10000, @20000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_http_v1_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeUploadAndAssertSuccessResult:tempFile key:key config:config option:nil];
    }
}

- (void)testHttpsV1 {
    [kQNDnsPrefetch clearDnsCache:nil];

    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    NSArray *sizeArray = @[@500, @1000, @3000, @4000, @5000, @8000, @10000, @20000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_https_v1_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeUploadAndAssertSuccessResult:tempFile key:key config:config option:nil];
    }
}

- (void)testReuploadV1 {

    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
        builder.chunkSize = 1 * 1024 * 1024;
        builder.recorder = [QNFileRecorder fileRecorderWithFolder:[NSTemporaryDirectory() stringByAppendingString:@"qiniu"] error:nil];
    }];

    NSArray *sizeArray = @[@30000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_reupload_v1_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeResumeUploadTest:0.5 * 1024 * size.longLongValue  tempFile:tempFile key:key config:config option:nil];
    }
}

- (void)testNoKeyV1 {
    QNConfiguration *configHttp = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];

    NSString *keyUp = [NSString stringWithFormat:@"resume_NoKey_v1_%dk", 600];
    QNTempFile *tempFile = [QNTempFile createTempFileWithSize:600 * 1024 identifier:keyUp];
    tempFile.canRemove = NO;
    [self allFileTypeUploadAndAssertSuccessResult:tempFile key:nil config:configHttp option:nil];

    tempFile.canRemove = YES;
    QNConfiguration *configHttps = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    [self allFileTypeUploadAndAssertSuccessResult:tempFile key:nil config:configHttps option:nil];
}

- (void)test0kV1 {
    QNConfiguration *configHttp = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];

    NSString *key = @"resume_0k_v1_0k";
    QNTempFile *tempFile = [QNTempFile createTempFileWithSize:0 identifier:key];
    tempFile.canRemove = NO;
    [self allFileTypeUploadAndAssertResult:kQNZeroDataSize tempFile:tempFile key:key config:configHttp option:nil];

    tempFile.canRemove = YES;
    QNConfiguration *configHttps = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    [self allFileTypeUploadAndAssertResult:kQNZeroDataSize tempFile:tempFile key:key config:configHttps option:nil];

}

- (void)testCustomParamV1 {

    NSDictionary *userParam = @{@"x:foo" : @"foo_value",
                                @"x:bar" : @"bar_value"};
    NSDictionary *metaParam = @{@"0000" : @"meta_value_0",
                                @"x-qn-meta-aaa" : @"meta_value_1",
                                @"x-qn-meta-key-2" : @"meta_value_2"};
    QNUploadOption *option = [[QNUploadOption alloc] initWithMime:nil
                                                  progressHandler:nil
                                                           params:userParam
                                                   metaDataParams:metaParam
                                                         checkCrc:YES
                                               cancellationSignal:nil];

    QNConfiguration *configHttp = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV1;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];

    NSString *key = @"resume_custom_param_v1";
    QNTempFile *tempFile = [QNTempFile createTempFileWithSize:1024 * 1024 * 5 identifier:key];

    [self allFileTypeUploadAndAssertSuccessResult:tempFile key:key config:configHttp option:option];
}

- (void)testSwitchRegionV2 {
    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    NSArray *sizeArray = @[@1000, @3000, @4000, @5000, @8000, @10000, @20000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_switch_region_v2_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeSwitchRegionTestWithFile:tempFile key:key config:config option:nil];
    }
}

- (void)testCancelV2 {
    float cancelPercent = 0.1;

    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    NSArray *sizeArray = @[@30000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_cancel_v2_%@k_%@", size, [NSDate date]];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeCancelTest:cancelPercent * size.longLongValue * 1024 tempFile:tempFile key:key config:config option:nil];
    }
}

- (void)testHttpV2 {
    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];
    NSArray *sizeArray = @[@500, @1000, @3000, @4000, @5000, @8000, @10000, @20000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_http_v2_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeUploadAndAssertSuccessResult:tempFile key:key config:config option:nil];
    }
}

- (void)testHttpsV2 {
    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    NSArray *sizeArray = @[@500, @1000, @3000, @4000, @5000, @8000, @10000, @20000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_https_v2_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeUploadAndAssertSuccessResult:tempFile key:key config:config option:nil];
    }
}

- (void)testReuploadV2 {

    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
        builder.chunkSize = 1 * 1024 * 1024;
        builder.recorder = [QNFileRecorder fileRecorderWithFolder:[NSTemporaryDirectory() stringByAppendingString:@"qiniu"] error:nil];
    }];

    NSArray *sizeArray = @[@30000];
    for (NSNumber *size in sizeArray) {
        NSString *key = [NSString stringWithFormat:@"resume_reupload_v2_%@k", size];
        QNTempFile *tempFile = [QNTempFile createTempFileWithSize:[size intValue] * 1024 identifier:key];
        [self allFileTypeResumeUploadTest:0.5 * 1024 * size.longLongValue tempFile:tempFile key:key config:config option:nil];
    }
}

- (void)testNoKeyV2 {
    QNConfiguration *configHttp = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.concurrentTaskCount = 3;
        builder.useHttps = NO;
    }];

    NSString *keyUp = [NSString stringWithFormat:@"resume_NoKey_v2_%dk", 600];
    QNTempFile *tempFile = [QNTempFile createTempFileWithSize:600 * 1024 identifier:keyUp];
    tempFile.canRemove = NO;
    [self allFileTypeUploadAndAssertSuccessResult:tempFile key:nil config:configHttp option:nil];

    tempFile.canRemove = YES;
    QNConfiguration *configHttps = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = YES;
    }];
    [self allFileTypeUploadAndAssertSuccessResult:tempFile key:nil config:configHttps option:nil];
}

- (void)test0kV2 {
    QNConfiguration *configHttp = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];

    NSString *key = @"resume_v2_0k";
    QNTempFile *tempFile = [QNTempFile createTempFileWithSize:0 identifier:key];
    tempFile.canRemove = NO;
    [self uploadAndAssertResult:kQNZeroDataSize tempFile:tempFile key:key config:configHttp option:nil];

    tempFile.canRemove = YES;
    QNConfiguration *configHttps = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
           builder.useConcurrentResumeUpload = NO;
           builder.concurrentTaskCount = 3;
           builder.useHttps = YES;
       }];
    [self allFileTypeUploadAndAssertResult:kQNZeroDataSize tempFile:tempFile key:key config:configHttps option:nil];

}

- (void)testCustomParamV2 {

    NSDictionary *userParam = @{@"x:foo" : @"foo_value",
                                @"x:bar" : @"bar_value"};
    NSDictionary *metaParam = @{@"0000" : @"meta_value_0",
                                @"x-qn-meta-aaaa" : @"meta_value_1",
                                @"x-qn-meta-key-2" : @"meta_value_2"};
    QNUploadOption *option = [[QNUploadOption alloc] initWithMime:nil
                                                  progressHandler:nil
                                                           params:userParam
                                                   metaDataParams:metaParam
                                                         checkCrc:YES
                                               cancellationSignal:nil];

    QNConfiguration *configHttp = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
        builder.resumeUploadVersion = QNResumeUploadVersionV2;
        builder.useConcurrentResumeUpload = NO;
        builder.useHttps = NO;
    }];

    NSString *key = @"resume_custom_param_v2";
    QNTempFile *tempFile = [QNTempFile createTempFileWithSize:1024 * 1024 * 5 identifier:key];

    [self allFileTypeUploadAndAssertSuccessResult:tempFile key:key config:configHttp option:option];
}

//- (void)testProxy {
//    NSDictionary *proxyDict = @{
//        @"HTTPEnable" : [NSNumber numberWithInt:1],
//        (NSString *)kCFStreamPropertyHTTPProxyHost : @"180.101.136.11",
//        (NSString *)kCFStreamPropertyHTTPProxyPort : @80,
//    };
//
//    QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
//        builder.proxy = proxyDict;
//        NSArray *upList = [[NSArray alloc] initWithObjects:@"upnono.qiniu.com", @"upnono.qiniu.com", nil];
//        builder.useHttps = NO;
//        builder.zone = [[QNFixedZone alloc] initWithUpDomainList:upList];
//    }];
//
//    QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
//
//    int size = 600;
//    QNTempFile *tempFile = [QNTempFile createTempfileWithSize:size * 1024];
//    NSString *keyUp = [NSString stringWithFormat:@"%dkproxy", size];
//    __block QNResponseInfo *info = nil;
//    __block NSString *key = nil;
//    [upManager putFile:tempFile.fileUrl.path key:keyUp token:token_na0 complete:^(QNResponseInfo *i, NSString *k, NSDictionary *resp) {
//        key = k;
//        info = i;
//    }
//                option:nil];
//
//    AGWW_WAIT_WHILE(key == nil, 60 * 30);
//    NSLog(@"info %@", info);
//    XCTAssert(info.isOK, @"Pass");
//    XCTAssert([keyUp isEqualToString:key], @"Pass");
//
//    [tempFile remove];
//}
@end


text:
//
//  JDAdViewConfigration.h
//  JDAdSDKDemo
//
//  Created by Ben Miao on 15/11/7.
//  Copyright © 2015年 com.jd.dm. All rights reserved.
//

#ifndef JDAdViewConfigration_h
#define JDAdViewConfigration_h

typedef NS_ENUM(NSUInteger, JDAdType) {
    JDAdTypeBanner = 1,
    JDAdTypeModal,
    JDAdTypeNative,
    JDAdTypeOthers
};

typedef NS_ENUM(NSUInteger,JDAdSize){

    JDAdSize_Banner_320_48 = 1001,
    JDAdSize_Banner_320_50,
    JDAdSize_Banner_480_75,
    JDAdSize_Banner_640_100,
    JDAdSize_Banner_936_120,

    JDAdSize_Modal_320_480 = 2001,
    JDAdSize_Modal_600_500,
    JDAdSize_Modal_640_960,

};

typedef NS_ENUM(NSUInteger, BannerPosition) {
    BannerLocateBottom,
    BannerLocateTop,
    BannerLocateCustom
};

typedef NS_ENUM(NSUInteger, JDAdURLResponseStatus)
{
    JDAdURLResponseStatusSuccess,
    JDAdURLResponseStatusErrorTimeout,
    JDAdURLResponseStatusErrorNoNetwork // 默认除了超时以外的错误都是无网络错误。
};

typedef NS_ENUM(NSUInteger, JDAdNativeType) {
    NativeTypeObject,
    NativeTypeDictionary,
};

typedef NS_ENUM(NSUInteger, JDAdDefineGender) {
    JDAdGenderMale = 1,
    JDAdGenderFemale
};

/**
 *  JDAdError
 */
typedef NS_ENUM(NSUInteger, JDAdError) {
    /**
     *  check your tagid,always your tagid doesn't match your bundle.
     */
    JDADTagIDError,
    /**
     *  the viewcontroller you send has been presenting another viewcontorller.
     *  pelease ensure the viewcontroller.pressentingViewcontroller you offeris nil.
     */
    JDADPrensenttingError,
    /**
     *  server return error data or changed the json structure.
     */
    JDADReturnDataError,
    /**
     *  others.
     */
    JDADOtherError
};

#endif /* JDAdViewConfigration_h */


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/linearLayout5"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardCornerRadius="0dp"
    app:cardElevation="2dp"
    android:layout_margin="4dp">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/layout10"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView13"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="@string/id"
            app:layout_constraintBottom_toBottomOf="@+id/txtInvoiceId"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtInvoiceId" />

        <TextView
            android:id="@+id/txtInvoiceId"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toTopOf="parent" />

        <androidx.constraintlayout.widget.Guideline
            android:id="@+id/guideline8"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_constraintGuide_percent="0.33" />

        <TextView
            android:id="@+id/textView15"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="8dp"
            android:text="@string/customer_id"
            app:layout_constraintBottom_toBottomOf="@+id/txtCustomerId"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtCustomerId" />

        <TextView
            android:id="@+id/txtCustomerId"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtInvoiceDate" />

        <TextView
            android:id="@+id/txtCustomerName"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtCustomerId" />

        <TextView
            android:id="@+id/textView18"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="@string/customer_name"
            app:layout_constraintBottom_toBottomOf="@+id/txtCustomerName"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintHorizontal_bias="1.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtCustomerName"
            app:layout_constraintVertical_bias="1.0" />

        <TextView
            android:id="@+id/textView19"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="8dp"
            android:text="@string/item_id"
            app:layout_constraintBottom_toBottomOf="@+id/txtItemId"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtItemId" />

        <TextView
            android:id="@+id/txtItemId"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtCustomerName" />

        <TextView
            android:id="@+id/textView21"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="@string/item_name"
            app:layout_constraintBottom_toBottomOf="@+id/txtItemName"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtItemName" />

        <TextView
            android:id="@+id/textView22"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="@string/item_price_label"
            app:layout_constraintBottom_toBottomOf="@+id/txtItemPrice"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtItemPrice" />

        <TextView
            android:id="@+id/txtItemName"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtItemId" />

        <TextView
            android:id="@+id/txtItemPrice"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtItemName" />

        <TextView
            android:id="@+id/textView25"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="@string/date"
            app:layout_constraintBottom_toBottomOf="@+id/txtInvoiceDate"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/txtInvoiceDate" />

        <TextView
            android:id="@+id/txtInvoiceDate"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="TextView"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtInvoiceId" />

        <TextView
            android:id="@+id/textView27"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:text="@string/invoice_state"
            app:layout_constraintBottom_toBottomOf="@+id/spinnerInvoiceState"
            app:layout_constraintEnd_toStartOf="@+id/guideline8"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/spinnerInvoiceState" />

        <Spinner
            android:id="@+id/spinnerInvoiceState"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="8dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/guideline8"
            app:layout_constraintTop_toBottomOf="@+id/txtItemPrice" />
    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.cardview.widget.CardView>


text:
package com.hazelcast.spi.impl.operationservice.impl;

import com.hazelcast.cluster.Address;
import com.hazelcast.config.Config;
import com.hazelcast.config.ConfigAccessor;
import com.hazelcast.config.ServiceConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.instance.impl.Node;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.spi.impl.InternalCompletableFuture;
import com.hazelcast.spi.impl.NodeEngine;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.spi.impl.operationservice.BackupAwareOperation;
import com.hazelcast.spi.impl.operationservice.BackupOperation;
import com.hazelcast.spi.impl.operationservice.Operation;
import com.hazelcast.spi.impl.operationservice.impl.operations.Backup;
import com.hazelcast.test.AssertTask;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.hazelcast.test.annotation.ParallelJVMTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

import static com.hazelcast.internal.partition.TestPartitionUtils.getDefaultReplicaVersions;
import static com.hazelcast.test.Accessors.getNodeEngineImpl;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@RunWith(HazelcastSerialClassRunner.class)
@Category({QuickTest.class, ParallelJVMTest.class})
public class OperationOutOfOrderBackupTest extends HazelcastTestSupport {

    private final ValueHolderService service = new ValueHolderService();

    private int partitionId;
    private NodeEngineImpl nodeEngine1;
    private NodeEngineImpl nodeEngine2;

    @Before
    public void setup() {
        Config config = new Config();
        ServiceConfig serviceConfig = new ServiceConfig()
                .setImplementation(this.service)
                .setName(ValueHolderService.NAME)
                .setEnabled(true);
        ConfigAccessor.getServicesConfig(config)
                      .addServiceConfig(serviceConfig);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory();
        HazelcastInstance hz1 = factory.newHazelcastInstance(config);
        HazelcastInstance hz2 = factory.newHazelcastInstance(config);
        warmUpPartitions(hz2, hz1);

        partitionId = getPartitionId(hz1);
        nodeEngine1 = getNodeEngineImpl(hz1);
        nodeEngine2 = getNodeEngineImpl(hz2);
    }

    @Test
    public void test() throws InterruptedException {
        // set 1st value
        int oldValue = 111;
        setValue(nodeEngine1, partitionId, oldValue);

        long[] initialReplicaVersions = getDefaultReplicaVersions(nodeEngine1.getNode(), partitionId);
        assertBackupReplicaVersions(nodeEngine2.getNode(), partitionId, initialReplicaVersions);

        // set 2nd value
        int newValue = 222;
        setValue(nodeEngine1, partitionId, newValue);

        long[] lastReplicaVersions = getDefaultReplicaVersions(nodeEngine1.getNode(), partitionId);
        assertBackupReplicaVersions(nodeEngine2.getNode(), partitionId, lastReplicaVersions);

        // run a stale backup
        runBackup(nodeEngine2, oldValue, initialReplicaVersions, nodeEngine1.getThisAddress());

        long[] backupReplicaVersions = getDefaultReplicaVersions(nodeEngine2.getNode(), partitionId);
        assertArrayEquals(lastReplicaVersions, backupReplicaVersions);

        assertEquals(newValue, service.value.get());
    }

    private void runBackup(NodeEngine nodeEngine, int value, long[] replicaVersions, Address sender)
            throws InterruptedException {
        Backup
                backup = new Backup(new SampleBackupOperation(value), sender, replicaVersions, false);
        backup.setPartitionId(partitionId).setReplicaIndex(1).setNodeEngine(nodeEngine);
        nodeEngine.getOperationService().execute(backup);

        LatchOperation latchOp = new LatchOperation(1);
        nodeEngine.getOperationService().execute(latchOp.setPartitionId(partitionId));
        assertTrue(latchOp.latch.await(1, TimeUnit.MINUTES));
    }

    private void assertBackupReplicaVersions(final Node node, final int partitionId,
                                             final long[] expectedReplicaVersions) {
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                long[] backupReplicaVersions = getDefaultReplicaVersions(node, partitionId);
                assertArrayEquals(expectedReplicaVersions, backupReplicaVersions);
            }
        });
    }

    private void setValue(NodeEngine nodeEngine, int partitionId, int value) {
        InternalCompletableFuture<Object> future = nodeEngine.getOperationService()
                .invokeOnPartition(new SampleBackupAwareOperation(value).setPartitionId(partitionId));
        future.join();
    }

    private static class ValueHolderService {
        static final String NAME = "value-holder-service";

        final AtomicLong value = new AtomicLong();
    }

    private static class SampleBackupAwareOperation extends Operation implements BackupAwareOperation {

        long value;

        SampleBackupAwareOperation() {
        }

        SampleBackupAwareOperation(long value) {
            this.value = value;
        }

        @Override
        public void run() throws Exception {
            NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
            ValueHolderService service = nodeEngine.getService(ValueHolderService.NAME);
            service.value.set(value);
        }

        @Override
        public boolean shouldBackup() {
            return true;
        }

        @Override
        public int getSyncBackupCount() {
            return 1;
        }

        @Override
        public int getAsyncBackupCount() {
            return 0;
        }

        @Override
        public Operation getBackupOperation() {
            return new SampleBackupOperation(value);
        }

        @Override
        protected void writeInternal(ObjectDataOutput out) throws IOException {
            super.writeInternal(out);
            out.writeLong(value);
        }

        @Override
        protected void readInternal(ObjectDataInput in) throws IOException {
            super.readInternal(in);
            value = in.readLong();
        }
    }

    private static class SampleBackupOperation extends Operation implements BackupOperation {

        final CountDownLatch latch = new CountDownLatch(1);

        long value;

        SampleBackupOperation() {
        }

        SampleBackupOperation(long value) {
            this.value = value;
        }

        @Override
        public void run() throws Exception {
            try {
                NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
                ValueHolderService service = nodeEngine.getService(ValueHolderService.NAME);
                service.value.set(value);
            } finally {
                latch.countDown();
            }
        }

        @Override
        protected void writeInternal(ObjectDataOutput out) throws IOException {
            super.writeInternal(out);
            out.writeLong(value);
        }

        @Override
        protected void readInternal(ObjectDataInput in) throws IOException {
            super.readInternal(in);
            value = in.readLong();
        }
    }

    private static class LatchOperation extends Operation {

        final CountDownLatch latch;

        private LatchOperation(int count) {
            latch = new CountDownLatch(count);
        }

        @Override
        public void run() throws Exception {
            latch.countDown();
        }

        @Override
        public boolean returnsResponse() {
            return false;
        }

        @Override
        public boolean validatesTarget() {
            return false;
        }
    }
}


text:
Edges must be defined at object construction via
* ```registerIncomingEdges(...string $class)```
* and ```registerOutgoingEdges(...string $class)```

Any edge that claims that this particle is its tail, and that has not been already registered by the particle's parent, must be defined, otherwise an exception will be thrown when trying to access edge methods.

Secondly, you can define field constraints and directives for particles by setting up a **FIELDS** constant in the particle head.

```php
class CustomObject extends Object
{
    const FIELDS = [
        "my_field" => [
            "constraints" => [
                "minLength" => null, // minimum character length (int)
                "maxLength" => null, // maximum character length (int)
                "uuid" => null, // whether the field must be in uuid format or not (bool)
                "regex" => null, // the regular expression the value must satisfy (string without enclosure)
                "greaterThan" => null, // minimum integer value to enter (int)
                "lessThan" => null, // maximum integere value to enter (int)
            ],
            "directives" => [
                "md5" => true, // encrypt the value by MD5
                "now" => false,
                "default" => "",
            ]
        ]
    ];

```

Thus, the CustomObject particle above will by default come with two additional methods (getters and setters):

* **getMyField()**
* **setMyField(/\*mixed\*/ $value, bool $silent = false)**

With Fields, "Directives" help set up a default value, or filter the passed argument. For example, the "md5" field will encrypt all plaintext arguments passed to the setMyField function. As for "Constraints", they make sure the argument values meet certain requirements.

> When ```$silent``` is on, no "modified" signal is emitted with AttributeBag value changes.

> While defining field names (such as my_field in the example above) make sure they are either underscored (my_field_name) or
> camelcased (myFieldName) in terms of formatting. Pho Framework reorganizes the variable names to match camelcased function
> name format, thus it functions properly only if your field names parseable.

Last but not least, all outgoing edges of a particle must be defined in the {ParticleName}Out/ folder.

An example edge is shown below:

```php
class Subscribe extends Framework\AbstractEdge {
    const HEAD_LABEL = "subscription";
    const HEAD_LABELS = "subscriptions";
    const TAIL_LABEL = "subscriber";
    const TAIL_LABELS = "subscribers";
    const SETTABLES = [Framework\ParticleInterface::class];
}
```

For an edge to be valid, it must:
* extend Framework\AbstractEdge
* have five different constants where:
    * **TAIL_LABEL**: what the tail node of this edge's role is called, in singular. A *subscriber* subscribes. So it's "subscriber"
    * **TAIL_LABELS**: same as above, in plural. So it's "subscribers"
    * **HEAD_LABEL**: what the head node of this edge's role is called, in singular. A subscriber subscribes to a *subscription*, hence it's "subscription"
    * **HEAD_LABELS**: same as above, in plural. So it's "subscriptions"
    * **SETTABLES**: what classes can this edge target, in array format. If it's [Framework\ParticleInterface::class], that means it can target any node/particle. Sometimes this level of flexibility may not be the case for all types of edges; for example, the [Write](https://github.com/phonetworks/pho-framework/blob/master/src/Pho/Framework/ActorOut/Write.php) edge cannot target Actor particles, because a user can't create a user. Hence its SETTABLES is declared as [Framework\Object::class, Framework\Graph::class] only, so that it can target Graphs and Objects only, and not Actors.
    * **SETTABLES_EXTRA**: similar to SETTABLES, but allows a subclass to define new settables that extend the parent class' ones, without overriding them (because defining a new SETTABLES constant would override the parents')
    * **FORMABLES**: if it's a formative edge (as defined by the predicate) the formables constant defines the classes that this edge can create. Please note, Formables cannot point to an interface, and **must** point to classes with a constructor.

As you can see above, the constants defined in the edge class are merely for naming purposes. The mechanics function as follows;

```php
// $actor will be our Actor node
$actor = new Actor($graph);

// This is a set function, generate automatically from the ActorOut/Susbcribes.php edge.
$actor->subscribes($content);

// This is a ActorOut/Subscribes.php edge getter where $actor is in "head node" position, and it retrieves its tails.
// again generated automatically.
$actor->getSubscribers();

// This is a ActorOut/Subscribes.php edge getter where $actor is in "tail node" position, and it retrieves its heads.
// again generated automatically.
$actor->getSubscriptions();
```


text:
package uk.gov.gchq.gaffer.analytic.operation.handler;

import uk.gov.gchq.gaffer.analytic.operation.AnalyticDetail;
import uk.gov.gchq.gaffer.analytic.operation.GetAnalytic;
import uk.gov.gchq.gaffer.analytic.operation.UIMappingDetail;
import uk.gov.gchq.gaffer.analytic.operation.handler.cache.AnalyticCache;
import uk.gov.gchq.gaffer.named.operation.NamedOperationDetail;
import uk.gov.gchq.gaffer.named.operation.cache.exception.CacheOperationFailedException;
import uk.gov.gchq.gaffer.operation.OperationException;
import uk.gov.gchq.gaffer.store.Context;
import uk.gov.gchq.gaffer.store.Store;
import uk.gov.gchq.gaffer.store.operation.handler.OutputOperationHandler;
import uk.gov.gchq.gaffer.store.operation.handler.named.cache.NamedOperationCache;

/**
 * Operation Handler for GetAnalyticOperation
 */
public class GetAnalyticHandler implements OutputOperationHandler<GetAnalytic, AnalyticDetail> {
    private final AnalyticCache cache;

    public GetAnalyticHandler() {
        this(new AnalyticCache());
    }

    public GetAnalyticHandler(final AnalyticCache cache) {
        this.cache = cache;
    }

    /**
     * Retrieves the Analytic Operation that a user is allowed to see. As the
     * expected behaviour is to bring back a summary of each operation, the simple
     * flag is set to true. This means all the details regarding access roles and
     * operation chain details are not included in the output.
     *
     * @param operation the {@link uk.gov.gchq.gaffer.operation.Operation} to be
     *                  executed
     * @param context   the operation chain context, containing the user who
     *                  executed the operation
     * @param store     the {@link Store} the operation should be run on
     * @return an iterable of AnalyticOperations
     * @throws OperationException thrown if the cache has not been initialized in
     *                            the operation declarations file
     */
    @Override
    public AnalyticDetail doOperation(final GetAnalytic operation, final Context context, final Store store)
            throws OperationException {
        final AnalyticDetail op;
        try {
            op = cache.getAnalyticOperation(operation.getAnalyticName(), context.getUser(),
                    store.getProperties().getAdminAuth());
        } catch (final CacheOperationFailedException e) {
            throw new OperationException(e.getMessage());
        }

        return resolveParameters(op, context);
    }

    private AnalyticDetail resolveParameters(final AnalyticDetail analyticOp, final Context context) {
        if (null != analyticOp) {
            try {
                NamedOperationDetail nod = new NamedOperationCache()
                        .getNamedOperation(analyticOp.getOperationName(), context.getUser());
                analyticOp.setReadAccessRoles(nod.getReadAccessRoles());
                analyticOp.setWriteAccessRoles(nod.getWriteAccessRoles());
                for (final String currentParam : nod.getParameters().keySet()) {
                    for (final String uiKey : analyticOp.getUiMapping().keySet()) {
                        UIMappingDetail uiParam = analyticOp.getUiMapping().get(uiKey);
                        if (uiParam.getParameterName().equals(currentParam)) {
                            uiParam.setInputClass(nod.getParameters().get(currentParam).getValueClass());
                            analyticOp.getUiMapping().put(uiKey, uiParam);
                        }
                    }
                }

            } catch (final Exception e) {
                // Can't find the parameter.
            }
        }
        return analyticOp;
    }
}


text:
Using SideSync, you can conveniently share the screen and data between your PC and mobile device. Receive alarms of your phone through PC and use various features of your phone on the computer. Enjoy the smarter and more convenient life with SideSync.

Install SideSync onto a PC and mobile device, and then connect two devices through USB data cable or Wi-Fi. Simply connecting the PC and mobile, you can conveniently use various features of SideSync. For a PC or MAC, click the download button above to install. For a mobile device, you can download the app from Google Play™ or Samsung GALAXY Apps which is preloaded on your latest Galaxy device.

## Features

- Make Phone Calls and Send Text Messages from PC
- Share Files between your PC and Mobile Device


text:
module HashFactoryBuilder
  def build(class_name, options)
    new_obj = class_name.to_s.pluralize.classify.constantize.new
    new_obj.send :attributes=, options, false
    new_obj.save!

    return new_obj
  end
end


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = _asyncMap;

var _isArrayLike = require('lodash/isArrayLike');

var _isArrayLike2 = _interopRequireDefault(_isArrayLike);

var _getIterator = require('./getIterator');

var _getIterator2 = _interopRequireDefault(_getIterator);

var _noop = require('lodash/noop');

var _noop2 = _interopRequireDefault(_noop);

var _once = require('lodash/once');

var _once2 = _interopRequireDefault(_once);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _asyncMap(eachfn, arr, iteratee, callback) {
    callback = (0, _once2.default)(callback || _noop2.default);
    arr = arr || [];
    var results = (0, _isArrayLike2.default)(arr) || (0, _getIterator2.default)(arr) ? [] : {};
    eachfn(arr, function (value, index, callback) {
        iteratee(value, function (err, v) {
            results[index] = v;
            callback(err);
        });
    }, function (err) {
        callback(err, results);
    });
}
module.exports = exports['default'];


text:
var referenceService = require('../api/services/References.js');
var flairService = require('../api/services/Flairs.js');
var _ = require('lodash');
module.exports = {
  addRepeats: function ($scope, io) {
    var pathToRefs = 'refUser.references',
      pathToApps = 'refUser.apps';
    $scope.editRef = function () {
      var url = "/reference/edit";
      $scope.editRefError = $scope.validateRef($scope.selectedRef);
      if ($scope.editRefError) {
        return;
      }
      $scope.indexSpin.editRef = true;
      io.socket.post(url, $scope.selectedRef, function (data, res) {
        $scope.indexSpin.editRef = false;
        if (res.statusCode === 200) {
          $scope.indexOk.editRef = true;
          var index = $scope.refUser.references.findIndex(function (searchRef) {
            return searchRef.id === $scope.selectedRef.id;
          });
          $scope.refUser.references[index] = $scope.selectedRef;
        } else {
          $scope.editRefError = "There was an issue.";
          console.log(res);
        }
        $scope.$apply();
      });
    };
    $scope.validateRef = function (ref) {
      var regexp = /(http(s?):\/\/)?(www|[a-z]*\.)?reddit\.com\/r\/((pokemontrades)|(SVExchange)|(poketradereferences))\/comments\/([a-z\d]*)\/([^\/]+)\/([a-z\d]+)(\?[a-z\d]+)?/,
        regexpGive = /(http(s?):\/\/)?(www|[a-z]*\.)?reddit\.com\/r\/((SVExchange)|(pokemontrades)|(poketradereferences)|(Pokemongiveaway)|(SVgiveaway))\/comments\/([a-z\d]*)\/([^\/]+)\/?/,
        regexpMisc = /(http(s?):\/\/)?(www|[a-z]*\.)?reddit\.com.*/,
        regexpUser = /^(\/u\/)?[A-Za-z0-9_\-]*$/,
        url = ref.url || ref.refUrl;
      if (!ref.type) {
        return "Please choose a type.";
      }
      if (ref.type === "egg" || ref.type === "giveaway" || ref.type === "misc" || ref.type === "eggcheck" || ref.type === "involvement") {
        if (!ref.descrip && !ref.description) {
          return "Make sure you enter all the information";
        }
      } else if (!ref.got || !ref.gave) {
        return "Make sure you enter all the information";
      }
      if (!url || ref.type !== "giveaway" && ref.type !== "misc" && ref.type !== "eggcheck" && !ref.user2) {
        return "Make sure you enter all the information";
      }
      if (((ref.type === "giveaway" || ref.type === "eggcheck") && !regexpGive.test(url)) ||
        (ref.type !== "giveaway" && ref.type !== "misc" && ref.type !== "eggcheck" && !regexp.test(url)) ||
        (ref.type === "misc" && !regexpMisc.test(url))) {
        return "Looks like you didn't input a proper permalink";
      }
      if (ref.user2.substring(0,3) === "/u/") {
        ref.user2 = ref.user2.slice(3);
      }
      if (ref.user2 === ($scope.user.name)) {
        return "Don't put your own username there.";
      }
      if (($scope.type !== "giveaway" && $scope.type !== "misc") && !regexpUser.test(ref.user2)) {
        return "Please put a username on its own, or in format: /u/username. Not the full url, or anything else.";
      }
      if (ref.number && isNaN(ref.number)) {
        return "Number must be a number.";
      }
      return "";
    };
    $scope.setLocalBan = function (username, ban) {
      var url = "/mod/setlocalban";
      io.socket.post(url, {username: username, ban: ban}, function (data, res) {
        if (res.statusCode === 200) {
          if ($scope.refUser) {
            $scope.refUser.banned = data.banned;
          } else {
            $scope.getBannedUsers();
          }
          $scope.$apply();
        } else {
          console.log("Error banning " + username + ": " + res.statusCode);
        }
      });
    };
    $scope.deleteRef = function (id) {
      var url = "/reference/delete";
      io.socket.post(url, {refId: id}, function (data, res) {
        if (res.statusCode === 200) {
          $scope.refUser.references = $scope.refUser.references.filter(function (ref) {
            return ref.id !== id;
          });
          $scope.$apply();
        } else {
          console.log(res.statusCode + ": " + data);
        }
      });
    };
    $scope.isNotNormalTrade = referenceService.isNotNormalTrade;
    $scope.hasNumber = referenceService.hasNumber;
    $scope.isEvent = referenceService.isEvent;
    $scope.isShiny = referenceService.isShiny;
    $scope.isCasual = referenceService.isCasual;
    $scope.isEggCheck = referenceService.isEggCheck;
    $scope.isTrade = referenceService.isTrade;
    $scope.isInvolvement = referenceService.isInvolvement;
    $scope.isEgg = referenceService.isEgg;
    $scope.isBank = referenceService.isBank;
    $scope.isGiveaway = referenceService.isGiveaway;
    $scope.isEggCheck = referenceService.isEggCheck;
    $scope.isMisc = referenceService.isMisc;
    $scope.isApprovable = referenceService.isApprovable;
    $scope.isApproved = referenceService.isApproved;
    $scope.getRedditUser = referenceService.getRedditUser;
    $scope.formattedName = flairService.formattedName;
    $scope.inPokemonTradesTrader = flairService.inPokemonTradesTrader;
    $scope.inPokemonTradesHelper = flairService.inPokemonTradesHelper;
    $scope.inSVExchangeHatcher = flairService.inSVExchangeHatcher;
    $scope.inSVExchangeGiver = flairService.inSVExchangeGiver;
    $scope.getFlair = flairService.getFlair;
    $scope.flairCheck = flairService.flairCheck;
    $scope.userHasFlair = function (flair) {
      return flairService.userHasFlair($scope.user, flair);
    };
    $scope.numberOfTrades = function () {
      return referenceService.numberOfTrades(_.get($scope, pathToRefs));
    };
    $scope.numberOfPokemonGivenAway = function () {
      return referenceService.numberOfPokemonGivenAway(_.get($scope, pathToRefs));
    };
    $scope.numberOfEggsGivenAway = function () {
      return referenceService.numberOfEggsGivenAway(_.get($scope, pathToRefs));
    };
    $scope.numberOfEggChecks = function () {
      return referenceService.numberOfEggChecks(_.get($scope, pathToRefs));
    };
    $scope.numberOfApprovedEggChecks = function () {
      return referenceService.numberOfApprovedEggChecks(_.get($scope, pathToRefs));
    };
    $scope.renderCSSClass = function(classes) {
      if (typeof classes !== 'string') {
        return '';
      }
      return classes.replace(/(\S+)/g, "flair-$1");
    };
    $scope.renderFlair = function(flair) {
      if (typeof flair !== 'string') {
        return '';
      }
      return flair.replace(/:([^:]+):/g,'');
    };
    $scope.applied = function (flair) {
      return flairService.applied(_.get($scope, pathToApps), flair);
    };
    $scope.canUserApply = function (applicationFlair) {
      if (!$scope.refUser || !$scope.user || $scope.user.name !== $scope.refUser.name) {
        return false;
      }
      return flairService.canUserApply(
        $scope.refUser.references,
        applicationFlair,
        flairService.getUserFlairs($scope.user, $scope.flairs)
      ) && !$scope.applied(applicationFlair, $scope.flairs);
    };
    $scope.hasEventFlair = function () {
      return flairService.hasEventFlair($scope.user);
    };
    $scope.formattedRequirements = function (flair) {
      return flairService.formattedRequirements(flair, $scope.flairs);
    };
    $scope.clickRefLink = function (ref) {
      if ($scope.user && $scope.user.isFlairMod) {
        io.socket.post('/flair/app/refreshClaim', ref, function (data, res) {
          if (res.statusCode !== 200) {
            console.log('Error ' + res.statusCode + ': Could not send link data to server.');
          }
        });
      }
    };
  }
};


text:
#ifndef LOC_TARGET_H
#define LOC_TARGET_H
#define TARGET_SET(gnss,ssc) ( (gnss<<1)|ssc )
#define TARGET_DEFAULT       TARGET_SET(GNSS_MSM, HAS_SSC)
#define TARGET_MDM           TARGET_SET(GNSS_MDM, HAS_SSC)
#define TARGET_APQ_SA        TARGET_SET(GNSS_GSS, NO_SSC)
#define TARGET_MPQ           TARGET_SET(GNSS_NONE,NO_SSC)
#define TARGET_MSM_NO_SSC    TARGET_SET(GNSS_MSM, NO_SSC)
#define TARGET_QCA1530       TARGET_SET(GNSS_QCA1530, NO_SSC)
#define TARGET_PDS           TARGET_SET(GNSS_PDS, NO_SSC)
#define TARGET_UNKNOWN       TARGET_SET(GNSS_UNKNOWN, NO_SSC)
#define getTargetGnssType(target)  (target>>1)

#ifdef __cplusplus
extern "C"
{
#endif

unsigned int loc_get_target(void);

/*The character array passed to this function should have length
  of atleast PROPERTY_VALUE_MAX*/
void loc_get_target_baseband(char *baseband, int array_length);
/*The character array passed to this function should have length
  of atleast PROPERTY_VALUE_MAX*/
void loc_get_platform_name(char *platform_name, int array_length);

/* Please remember to update 'target_name' in loc_log.cpp,
   if do any changes to this enum. */
typedef enum {
    GNSS_NONE = 0,
    GNSS_MSM,
    GNSS_GSS,
    GNSS_MDM,
    GNSS_QCA1530,
    GNSS_PDS,
    GNSS_UNKNOWN
}GNSS_TARGET;

typedef enum {
    NO_SSC = 0,
    HAS_SSC
}SSC_TYPE;

#ifdef __cplusplus
}
#endif

#endif /*LOC_TARGET_H*/