text:
// Test dependencies are required and exposed in common/bootstrap.js
require('../common/bootstrap');
/*global Menu */

exports['Tessel (get)'] = {

  setUp(done) {
    var testContext = this;
    this.sandbox = sinon.sandbox.create();
    this.spinnerStart = this.sandbox.stub(log.spinner, 'start');
    this.spinnerStop = this.sandbox.stub(log.spinner, 'stop');
    this.activeSeeker = undefined;
    // This is necessary to prevent an Emitter memory leak warning
    this.processOn = this.sandbox.stub(process, 'on');
    this.seeker = this.sandbox.stub(discover, 'TesselSeeker').callsFake(function Seeker() {
      this.start = function(options) {
        testContext.activeSeeker = this;
        setTimeout(() => this.stop(), options.timeout);
        return this;
      };
      this.stop = function() {
        this.emit('end');
        return this;
      };
    });
    util.inherits(this.seeker, Emitter);
    this.logWarn = this.sandbox.stub(log, 'warn');
    this.logInfo = this.sandbox.stub(log, 'info');

    this.menu = this.sandbox.stub(Menu, 'prompt').callsFake(function() {
      return Promise.resolve();
    });

    this.standardOpts = {
      timeout: 0.01,
    };

    done();
  },

  tearDown(done) {
    this.sandbox.restore();
    done();
  },

  infoOutput(test) {
    test.expect(1);
    Tessel.get(this.standardOpts)
      .catch(() => {
        test.equal(this.logInfo.firstCall.args[0], 'Looking for your Tessel...');
        test.done();
      });
  },

  noTessels(test) {
    // Try to get Tessels but return none
    Tessel.get(this.standardOpts)
      // If Tessels were returned, this test should fail because we're
      // not emitting any Tessels to the seeker
      .then(function(tessels) {
        test.equal(tessels, false, 'Somehow Tessels were returned');
      })
      .catch(function(err) {
        test.equal(typeof err, 'string', 'No error thrown');
        test.done();
      });
  },

  noTesselWithName(test) {
    var testConnectionType = 'USB';
    var testName = 'Does_Exist';

    var customOpts = {
      timeout: this.standardOpts.timeout,
      name: 'Does_Not_Exist'
    };

    // Try to get Tessels but return none
    Tessel.get(customOpts)
      .then(function(tessels) {
        test.equal(tessels, false, 'Somehow Tessels were returned');
      })
      .catch(function(err) {
        test.equal(typeof err, 'string', 'No error thrown');
        test.done();
      });

    var tessel = new Tessel({
      connectionType: testConnectionType
    });
    tessel.name = testName;

    setImmediate(() => this.activeSeeker.emit('tessel', tessel));
  },

  oneUSB(test) {
    var testConnectionType = 'USB';
    var testName = 'testTessel';
    // Try to get Tessels but return none
    Tessel.get(this.standardOpts)
      // If
      .then(function(tessel) {
        test.equal(tessel.name, testName);
        test.equal(tessel.connection.connectionType, testConnectionType);
        test.done();
      })
      .catch(function(err) {
        test.equal(err, undefined, 'A valid USB Tessel was reject upon get.');
      });

    var tessel = new Tessel({
      connectionType: testConnectionType
    });
    tessel.name = testName;

    setImmediate(() => this.activeSeeker.emit('tessel', tessel));
  },

  multipleUSBNoName(test) {
    test.expect(2);
    // Try to get Tessels
    Tessel.get(this.standardOpts)
      // It should return the menu prompt to choose a Tessel
      .then(function() {
        test.fail('Message promt not shown with mutiple USB connections');
        test.done();
      })
      .catch((reason) => {
        test.equal(reason, 'No Tessel selected, mission aborted!');
        test.equal(this.menu.calledOnce, 1);
        a.close();
        b.close();
        test.done();
      });

    var a = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });
    var b = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });

    a.name = 'a';
    b.name = 'b';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', a);
      this.activeSeeker.emit('tessel', b);
    });
  },

  multipleUSBHasName(test) {
    test.expect(1);

    var customOpts = {
      timeout: this.standardOpts.timeout,
      name: 'a'
    };

    Tessel.get(customOpts)
      .then(function(tessel) {
        test.equal(tessel.name, 'a');
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var a = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });
    var b = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });

    a.name = 'a';
    b.name = 'b';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', a);
      this.activeSeeker.emit('tessel', b);
    });
  },

  usbAndNonAuthorizedLANSameTessel(test) {
    test.expect(2);

    // Try to get Tessels but return none
    Tessel.get(this.standardOpts)
      .then(function(tessel) {
        test.equal(tessel.name, 'a');
        test.equal(tessel.connection.connectionType, 'USB');

        usb.close();
        lan.close();
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var usb = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });
    var lan = new Tessel({
      connectionType: 'LAN',
      authorized: false,
      end() {
        return Promise.resolve();
      }
    });

    usb.name = 'a';
    lan.name = 'a';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', usb);
      this.activeSeeker.emit('tessel', lan);
    });
  },

  usbAndNonAuthorizedLANSameTesselLANFirst(test) {
    test.expect(2);
    // Try to get Tessels but return none
    Tessel.get(this.standardOpts)
      .then(function(tessel) {
        test.equal(tessel.name, 'a');
        test.equal(tessel.connection.connectionType, 'USB');
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var usb = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });
    var lan = new Tessel({
      connectionType: 'LAN',
      authorized: false,
      end() {
        return Promise.resolve();
      }
    });

    usb.name = 'a';
    lan.name = 'a';

    setImmediate(() => {
      // "Detect" the lan first. This order is intentional
      // 1
      this.activeSeeker.emit('tessel', lan);
      // 2
      this.activeSeeker.emit('tessel', usb);
    });

  },

  usbAndAuthorizedLANSameTessel(test) {
    test.expect(2);

    // Try to get Tessels
    Tessel.get(this.standardOpts)
      .then(function(tessel) {
        test.equal(tessel.name, 'a');
        test.equal(tessel.connection.connectionType, 'USB');
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var usb = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });
    var lan = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });

    usb.name = 'a';
    lan.name = 'a';

    lan.connection.authorized = true;

    setImmediate(() => {
      this.activeSeeker.emit('tessel', usb);
      this.activeSeeker.emit('tessel', lan);
    });
  },

  multipleLANNoName(test) {
    test.expect(2);
    // Try to get Tessels but return none
    Tessel.get(this.standardOpts)
      .catch((reason) => {
        test.equal(reason, 'No Tessel selected, mission aborted!');
        test.equal(this.menu.calledOnce, 1);
        a.close();
        b.close();
        test.done();
      });

    var a = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });
    var b = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });

    a.name = 'a';
    b.name = 'b';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', a);
      this.activeSeeker.emit('tessel', b);
    });
  },

  multipleLANHasName(test) {
    test.expect(1);

    var customOpts = {
      timeout: this.standardOpts.timeout,
      name: 'a'
    };

    Tessel.get(customOpts)
      .then(function(tessel) {
        test.equal(tessel.name, 'a');
        a.close();
        b.close();
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var a = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });
    var b = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });

    a.name = 'a';
    b.name = 'b';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', a);
      this.activeSeeker.emit('tessel', b);
    });
  },

  // Tests that Tessel.get will return a USB connection
  // immediately upon being found if preferLAN is false
  defaultUSBPrefer(test) {
    test.expect(1);

    Tessel.get({
        timeout: 0.01,
      })
      .then(function(tessel) {
        test.equal(tessel.name, b.name);
        a.close();
        b.close();
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var a = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });
    var b = new Tessel({
      connectionType: 'USB',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });

    a.name = 'a';
    b.name = 'b';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', a);
      this.activeSeeker.emit('tessel', b);
    });
  },

  // Tests that Tessel.get will return a LAN connection
  // if one is ever found for a default Tessel
  LANPrefer(test) {
    test.expect(2);

    Tessel.get({
        timeout: 0.01,
        lanPrefer: true
      })
      .then(function(tessel) {
        test.equal(tessel.name, lan.name);
        test.equal(tessel.connection.connectionType, 'LAN');
        usb.close();
        lan.close();
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var usb = new Tessel({
      connectionType: 'USB',
      end() {
        return Promise.resolve();
      }
    });
    var lan = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });

    usb.name = 'a';
    lan.name = 'a';

    setImmediate(() => {
      this.activeSeeker.emit('tessel', usb);
      this.activeSeeker.emit('tessel', lan);
    });
  },

  // Tests that Tessel.get will return a LAN connection
  // if USB is preferred but none are found
  USBPreferNoUSBFound(test) {
    test.expect(2);

    Tessel.get({
        timeout: 0.01,
        lanPrefer: false
      })
      .then(function(tessel) {
        test.equal(tessel.name, lan.name);
        test.equal(tessel.connection.connectionType, 'LAN');
        lan.close();
        test.done();
      })
      .catch(function() {
        test.ok(false, 'Tessel.get failed');
        test.done();
      });

    var lan = new Tessel({
      connectionType: 'LAN',
      authorized: true,
      end() {
        return Promise.resolve();
      }
    });

    lan.name = 'a';

    setImmediate(() => this.activeSeeker.emit('tessel', lan));
  }
};

exports['Tessel (get); filter: unauthorized'] = {

  setUp(done) {
    var testContext = this;
    this.sandbox = sinon.sandbox.create();
    this.spinnerStart = this.sandbox.stub(log.spinner, 'start');
    this.spinnerStop = this.sandbox.stub(log.spinner, 'stop');
    this.activeSeeker = undefined;
    // This is necessary to prevent an Emitter memory leak warning
    this.processOn = this.sandbox.stub(process, 'on');

    var Seeker = discover.TesselSeeker;

    this.start = this.sandbox.spy(Seeker.prototype, 'start');

    this.seeker = this.sandbox.stub(discover, 'TesselSeeker').callsFake(function() {
      testContext.activeSeeker = new Seeker();
      return testContext.activeSeeker;
    });

    this.startScan = this.sandbox.stub(lan, 'startScan').callsFake(function() {
      return new Emitter();
    });

    util.inherits(this.seeker, Emitter);
    this.logWarn = this.sandbox.stub(log, 'warn');
    this.logInfo = this.sandbox.stub(log, 'info');

    this.menu = this.sandbox.stub(Menu, 'prompt').callsFake(function() {
      return Promise.resolve();
    });

    this.standardOpts = {
      timeout: 0.01,
    };

    done();
  },

  tearDown(done) {
    this.sandbox.restore();
    done();
  },

  unauthorizedLANDoesNotSurface(test) {
    test.expect(1);

    var customOpts = {
      timeout: this.standardOpts.timeout,
      authorized: true
    };

    Tessel.get(customOpts)
      .then(() => {
        test.fail();
      })
      .catch((message) => {
        test.equal(message, 'No Authorized Tessels Found.');
        test.done();
      });

    var lan = TesselSimulator({
      type: 'LAN',
      authorized: false
    });

    lan.connection.host = 'TestTessel';

    setImmediate(() => {
      this.activeSeeker.lanScan.emit('connection', lan.connection);
      this.activeSeeker.emit('end');
    });
  },
};

exports['Tessel.simpleExec'] = {
  setUp(done) {
    this.sandbox = sinon.sandbox.create();
    this.spinnerStart = this.sandbox.stub(log.spinner, 'start');
    this.spinnerStop = this.sandbox.stub(log.spinner, 'stop');

    this.tessel = new TesselSimulator();
    done();
  },
  tearDown(done) {
    this.tessel.mockClose();
    this.sandbox.restore();
    done();
  },

  fastClose(test) {
    // Stub exec so we can inject an immediate close
    this.sandbox.stub(this.tessel.connection, 'exec').callsFake((command, callback) => {
      // Return the remote process
      callback(null, this.tessel._rps);
      // Immediately close the remote process
      this.tessel._rps.emit('close');
    });

    // Execute an arbitrary command
    this.tessel.simpleExec('arbitrary command')
      // If the callback gets called, it passes the test
      .then(test.done);
  }
};


text:
require 'netopt3_db'
require 'digest/md5'

#desc cdma.sys_account_info
#名称           空值       类型
#------------ -------- -------------
#ACCOUNT_CODE NOT NULL VARCHAR2(20)
#ACCOUNT_NAME          VARCHAR2(20)
#PASSWORD              VARCHAR2(20)
#MOBILE                VARCHAR2(20)
#NOTE                  VARCHAR2(500)
#CITY_ID      NOT NULL NUMBER(38)
#GROUP_CODE   NOT NULL VARCHAR2(20)
#ISLOCK                NUMBER
#IP_ASSIGNIP           VARCHAR2(15)
#DEPT_ID      NOT NULL NUMBER(38)
#POSITION              VARCHAR2(20)
#REGION_CODE           NUMBER(38)

class CmNetoptUser < Netopt3Db
  self.table_name = "cdma.sys_account_info"
  self.primary_key = :account_code

  #
  # 认真用户密码
  def auth(hashedPass)
    result = false

    if !self.password.empty? && hashedPass && !hashedPass.empty?
      orgKey = Digest::MD5.hexdigest(self.password)
      result = orgKey.eql?(hashedPass)
    end

    puts "password : #{password} | hasedPass : #{hashedPass} | encode : #{orgKey}} | result : #{result}"

    result
  end

end

redpajama_set_name: RedPajamaGithub


text:
describe ManageIQ::Providers::Redhat::InfraManager do
  it ".ems_type" do
    expect(described_class.ems_type).to eq('rhevm')
  end

  it ".description" do
    expect(described_class.description).to eq('Red Hat Virtualization')
  end

  describe ".metrics_collector_queue_name" do
    it "returns the correct queue name" do
      worker_queue = ManageIQ::Providers::Redhat::InfraManager::MetricsCollectorWorker.default_queue_name
      expect(described_class.metrics_collector_queue_name).to eq(worker_queue)
    end
  end

  describe "rhevm_metrics_connect_options" do
    let(:ems) { FactoryBot.create(:ems_redhat, :hostname => "some.thing.tld") }

    it "rhevm_metrics_connect_options fetches configuration and allows overrides" do
      expect(ems.rhevm_metrics_connect_options[:host]).to eq("some.thing.tld")
      expect(ems.rhevm_metrics_connect_options(:hostname => "different.tld")[:host])
        .to eq("different.tld")
    end

    it "rhevm_metrics_connect_options fetches the default database name" do
      expect(ems.rhevm_metrics_connect_options[:database])
        .to eq(ems.class.default_history_database_name)
    end

    context "non default metrics database name" do
      let(:ems) do
        FactoryBot.create(:ems_redhat,
                           :hostname                  => "some.thing.tld",
                           :connection_configurations => [{:endpoint => {:role => :metrics,
                                                                         :path => "some.database"}}])
      end

      it "fetches the set database name" do
        expect(ems.rhevm_metrics_connect_options[:database]).to eq("some.database")
      end
    end
  end

  context "#vm_reconfigure" do
    context "version 4" do
      context "#vm_reconfigure" do
        before do
          _guid, _server, zone = EvmSpecHelper.create_guid_miq_server_zone
          @ems  = FactoryBot.create(:ems_redhat_with_authentication, :zone => zone)
          @vm   = FactoryBot.create(:vm_redhat, :ext_management_system => @ems)

          @rhevm_vm_attrs = double('rhevm_vm_attrs')
          allow(@ems).to receive(:highest_supported_api_version).and_return(4)
          stub_settings_merge(:ems => { :ems_redhat => { :use_ovirt_engine_sdk => use_ovirt_engine_sdk } })
          @v4_strategy_instance = instance_double(ManageIQ::Providers::Redhat::InfraManager::OvirtServices::Strategies::V4)
          allow(ManageIQ::Providers::Redhat::InfraManager::OvirtServices::Strategies::V4)
            .to receive(:new)
            .and_return(@v4_strategy_instance)
        end

        context "use_ovirt_engine_sdk is set to true" do
          let(:use_ovirt_engine_sdk) { true }
          it 'sends vm_reconfigure to the right ovirt_services' do
            expect(@v4_strategy_instance).to receive(:vm_reconfigure).with(@vm, {})
            @ems.vm_reconfigure(@vm)
          end
        end

        context "use_ovirt_engine_sdk is set to false" do
          let(:use_ovirt_engine_sdk) { false }
          it 'sends vm_reconfigure to the right ovirt_services' do
            expect(@v4_strategy_instance).to receive(:vm_reconfigure).with(@vm, {})
            @ems.vm_reconfigure(@vm)
          end
        end
      end
    end

    context "version 3" do
      before do
        _guid, _server, zone = EvmSpecHelper.create_guid_miq_server_zone
        @ems  = FactoryBot.create(:ems_redhat_with_authentication, :zone => zone)
        @hw   = FactoryBot.create(:hardware, :memory_mb => 1024, :cpu_sockets => 2, :cpu_cores_per_socket => 1)
        @vm   = FactoryBot.create(:vm_redhat, :ext_management_system => @ems)

        @cores_per_socket = 2
        @num_of_sockets   = 3

        @rhevm_vm_attrs = double('rhevm_vm_attrs')
        stub_settings_merge(:ems => { :ems_redhat => { :use_ovirt_engine_sdk => false } })
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:name).and_return('myvm')
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:memory).and_return(4.gigabytes)
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:memory_policy, :guaranteed).and_return(2.gigabytes)
        # TODO: Add tests for when the highest_supported_api_version is 4
        allow(@ems).to receive(:supported_api_versions).and_return(%w(3))
        @rhevm_vm = double('rhevm_vm')
        allow(@rhevm_vm).to receive(:attributes).and_return(@rhevm_vm_attrs)
        allow(@vm).to receive(:with_provider_object).and_yield(@rhevm_vm)
      end

      it "cpu_topology=" do
        spec = {
          "numCPUs"           => @cores_per_socket * @num_of_sockets,
          "numCoresPerSocket" => @cores_per_socket
        }

        expect(@rhevm_vm).to receive(:cpu_topology=).with(:cores => @cores_per_socket, :sockets => @num_of_sockets)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'updates the current and persistent configuration if the VM is up' do
        spec = {
          'memoryMB' => 8.gigabytes / 1.megabyte
        }
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('up')
        expect(@rhevm_vm).to receive(:update_memory).with(8.gigabytes, 2.gigabytes, :next_run => true)
        expect(@rhevm_vm).to receive(:update_memory).with(8.gigabytes, nil)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'updates only the persistent configuration when the VM is down' do
        spec = {
          'memoryMB' => 8.gigabytes / 1.megabyte
        }
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('down')
        expect(@rhevm_vm).to receive(:update_memory).with(8.gigabytes, 2.gigabytes)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'adjusts the increased memory to the next 256 MiB multiple if the VM is up' do
        spec = {
          'memoryMB' => 8.gigabytes / 1.megabyte + 1
        }
        adjusted = 8.gigabytes + 256.megabytes
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('up')
        expect(@rhevm_vm).to receive(:update_memory).with(adjusted, 2.gigabytes, :next_run => true)
        expect(@rhevm_vm).to receive(:update_memory).with(adjusted, nil)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'adjusts reduced memory to the next 256 MiB multiple if the VM is up' do
        spec = {
          'memoryMB' => 8.gigabytes / 1.megabyte - 1
        }
        adjusted = 8.gigabytes
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('up')
        expect(@rhevm_vm).to receive(:update_memory).with(adjusted, 2.gigabytes, :next_run => true)
        expect(@rhevm_vm).to receive(:update_memory).with(adjusted, nil)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'adjusts the guaranteed memory if it is larger than the virtual memory if the VM is up' do
        spec = {
          'memoryMB' => 1.gigabyte / 1.megabyte
        }
        adjusted = 1.gigabyte
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('up')
        expect(@rhevm_vm).to receive(:update_memory).with(1.gigabyte, adjusted, :next_run => true)
        expect(@rhevm_vm).to receive(:update_memory).with(1.gigabyte, nil)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'adjusts the guaranteed memory if it is larger than the virtual memory if the VM is down' do
        spec = {
          'memoryMB' => 1.gigabyte / 1.megabyte
        }
        adjusted = 1.gigabyte
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('down')
        expect(@rhevm_vm).to receive(:update_memory).with(1.gigabyte, adjusted)
        @ems.vm_reconfigure(@vm, :spec => spec)
      end

      it 'cpu_topology from set_number_of_cpus with number of sockets >= 1' do
        allow(@vm).to receive(:cpu_cores_per_socket).and_return(2)
        options = { :user_event => "Console Request Action [vm_set_number_of_cpus], VM [#{@vm.name}]", :value => 2 }
        expect(@rhevm_vm).to receive(:cpu_topology=).with(:sockets => 1)
        @ems.vm_set_num_cpus(@vm, options)
      end

      it 'cpu_topology from set_number_of_cpus with number of sockets < 1' do
        allow(@vm).to receive(:cpu_cores_per_socket).and_return(2)
        options = { :user_event => "Console Request Action [vm_set_number_of_cpus], VM [#{@vm.name}]", :value => 1 }
        expect(@rhevm_vm).to receive(:cpu_topology=).with(:cores => 1, :sockets => 1)
        @ems.vm_set_num_cpus(@vm, options)
      end

      it 'adjusts memory from set_memory' do
        options = { :user_event => "Console Request Action [vm_set_memory], VM [#{@vm.name}]", :value => 2048 }
        allow(@rhevm_vm_attrs).to receive(:fetch_path).with(:status, :state).and_return('down')
        expect(@rhevm_vm).to receive(:update_memory).with(2.gigabytes, 2.gigabytes)
        @ems.vm_set_memory(@vm, options)
      end
    end
  end

  context ".make_ems_ref" do
    it "removes the /ovirt-engine prefix" do
      expect(described_class.make_ems_ref("/ovirt-engine/api/vms/123")).to eq("/api/vms/123")
    end

    it "does not remove the /api prefix" do
      expect(described_class.make_ems_ref("/api/vms/123")).to eq("/api/vms/123")
    end
  end

  context ".extract_ems_ref_id" do
    it "extracts the resource ID from the href" do
      expect(described_class.extract_ems_ref_id("/ovirt-engine/api/vms/123")).to eq("123")
    end
  end

  context "api versions" do
    require 'ovirtsdk4'

    let(:ems) { FactoryBot.create(:ems_redhat_with_authentication) }
    context 'when parsing database api_version' do
      let(:ems) { FactoryBot.create(:ems_redhat, :api_version => api_version) }
      subject(:supported_api_versions) { ems.supported_api_versions }
      context "version 4.2" do
        let(:api_version) { "4.2.0" }
        it 'returns versions 3 and 4' do
          expect(supported_api_versions).to match_array(%w(3 4))
        end
      end

      context "version 3.6.1" do
        let(:api_version) { "3.6.1" }
        it 'returns versions 3' do
          expect(supported_api_versions).to match_array(%w(3))
        end
      end

      context "version 4.2.0-0.0.master.20170917124606.gita804ef7.el7.centos" do
        let(:api_version) { "4.2.0-0.0.master.20170917124606.gita804ef7.el7.centos" }
        it 'returns versions 3 and 4' do
          expect(supported_api_versions).to match_array(%w(3 4))
        end
      end

      context "version 4.2.1.3" do
        let(:api_version) { "4.2.1.3" }
        it 'returns versions 3 and 4' do
          expect(supported_api_versions).to match_array(%w(3 4))
        end
      end

      context "version 4.2.1a" do
        let(:api_version) { "4.2.1a" }
        it 'returns versions 3 and 4' do
          expect(supported_api_versions).to match_array(%w(3 4))
        end
      end

      context "version 4.3" do
        let(:api_version) { "4.3" }
        it 'returns versions 3 and 4' do
          expect(supported_api_versions).to match_array(%w(3 4))
        end
      end

      context "version 5.5" do
        let(:api_version) { "5.5" }
        it 'returns empty array' do
          expect(supported_api_versions).to match_array([])
        end
      end
    end

    context 'when probing provider directly' do
      subject(:supported_api_versions) { ems.supported_api_versions }
      context "#supported_api_versions" do
        it 'calls the OvirtSDK4::Probe.probe' do
          expect(OvirtSDK4::Probe).to receive(:probe).and_return([])
          supported_api_versions
        end

        it 'properly parses ProbeResults' do
          allow(OvirtSDK4::Probe).to receive(:probe)
            .and_return([OvirtSDK4::ProbeResult.new(:version => '3'),
                         OvirtSDK4::ProbeResult.new(:version => '4')])
          expect(supported_api_versions).to match_array(%w(3 4))
        end
      end
    end

    describe "#supports_the_api_version?" do
      it "returns the supported api versions" do
        allow(ems).to receive(:supported_api_versions).and_return([3])
        expect(ems.supports_the_api_version?(3)).to eq(true)
        expect(ems.supports_the_api_version?(6)).to eq(false)
      end
    end
  end

  context "supported features" do
    let(:ems) { FactoryBot.create(:ems_redhat) }
    let(:supported_api_versions) { [3, 4] }
    context "#process_api_features_support" do
      before(:each) do
        allow(SupportsFeatureMixin).to receive(:guard_queryable_feature).and_return(true)
        allow(described_class).to receive(:api_features)
          .and_return('3' => %w(feature1 feature3), '4' => %w(feature2 feature3))
        described_class.process_api_features_support
        allow(ems).to receive(:supported_api_versions).and_return(supported_api_versions)
      end

      context "no versions supported" do
        let(:supported_api_versions) { [] }
        it 'supports the right features' do
          expect(ems.supports_feature1?).to be_falsey
          expect(ems.supports_feature2?).to be_falsey
          expect(ems.supports_feature3?).to be_falsey
        end
      end

      context "version 3 supported" do
        let(:supported_api_versions) { [3] }
        it 'supports the right features' do
          expect(ems.supports_feature1?).to be_truthy
          expect(ems.supports_feature2?).to be_falsey
          expect(ems.supports_feature3?).to be_truthy
        end
      end

      context "version 4 supported" do
        let(:supported_api_versions) { [4] }
        it 'supports the right features' do
          expect(ems.supports_feature1?).to be_falsey
          expect(ems.supports_feature2?).to be_truthy
          expect(ems.supports_feature3?).to be_truthy
        end
      end

      context "all versions supported" do
        let(:supported_api_versions) { [3, 4] }
        it 'supports the right features' do
          expect(ems.supports_feature1?).to be_truthy
          expect(ems.supports_feature2?).to be_truthy
          expect(ems.supports_feature3?).to be_truthy
        end
      end
    end
  end

  context "#version_at_least?" do
    let(:api_version) { "4.2" }
    let(:ems) { FactoryBot.create(:ems_redhat, :api_version => api_version) }

    context "api version is higher or equal than checked version" do
      it 'supports the right features' do
        expect(ems.version_at_least?("4.1")).to be_truthy

        ems.api_version = "4.1.3.2-0.1.el7"
        expect(ems.version_at_least?("4.1")).to be_truthy

        ems.api_version = "4.2.0_master"
        expect(ems.version_at_least?("4.1")).to be_truthy

        ems.api_version = "4.2.1_master"
        expect(ems.version_at_least?("4.2.0")).to be_truthy
      end
    end

    context "api version is lowergit  than checked version" do
      let(:api_version) { "4.0" }
      it 'supports the right features' do
        expect(ems.version_at_least?("4.1")).to be_falsey

        ems.api_version = "4.0.3.2-0.1.el7"
        expect(ems.version_at_least?("4.1")).to be_falsey

        ems.api_version = "4.0.0_master"
        expect(ems.version_at_least?("4.1")).to be_falsey

        ems.api_version = "4.0.1_master"
        expect(ems.version_at_least?("4.0.2")).to be_falsey
      end
    end

    context "api version not set" do
      let(:api_version) { nil }
      it 'always return false' do
        expect(ems.version_at_least?("10.1")).to be_falsey

        expect(ems.version_at_least?("0")).to be_falsey
      end
    end
  end

  context ".raw_connect" do
    let(:options) do
      {
        :username => 'user',
        :password => 'pword'
      }
    end
    let(:v4_connection) { double(OvirtSDK4::Connection) }
    let(:v3_connection) { double(Ovirt::Service) }

    before do
      allow(v3_connection).to receive(:disconnect)
    end

    it "works with version 4" do
      expect(described_class).to receive(:raw_connect_v4).and_return(v4_connection)
      expect(v4_connection).to receive(:test).with(hash_including(:raise_exception => true))
        .and_return(true)

      described_class.raw_connect(options)
    end

    it "works with version 3" do
      expect(described_class).to receive(:raw_connect_v4).and_return(v4_connection)
      expect(v4_connection).to receive(:test).with(hash_including(:raise_exception => true))
        .and_raise(OvirtSDK4::Error.new('Something failed'))
      expect(described_class).to receive(:raw_connect_v3).and_return(v3_connection)
      expect(v3_connection).to receive(:api).and_return(nil)

      described_class.raw_connect(options)
    end

    it "always closes the V3 connection" do
      expect(described_class).to receive(:raw_connect_v4).and_return(v4_connection)
      expect(v4_connection).to receive(:test).with(hash_including(:raise_exception => true))
        .and_raise(OvirtSDK4::Error.new('Something failed'))
      expect(described_class).to receive(:raw_connect_v3).and_return(v3_connection)
      expect(v3_connection).to receive(:api).and_return(nil)
      expect(v3_connection).to receive(:disconnect)

      described_class.raw_connect(options)
    end

    it "decrypts the password" do
      allow(described_class).to receive(:raw_connect_v4).and_return(v4_connection)
      expect(v4_connection).to receive(:test).with(hash_including(:raise_exception => true))
        .and_return(true)

      expect(ManageIQ::Password).to receive(:try_decrypt).with(options[:password])

      described_class.raw_connect(options)
    end
  end

  context "network manager validations" do
    let(:api_version) { "4.2" }

    before do
      @ems = FactoryBot.create(:ems_redhat, :api_version => api_version)
      @provider = double(:authentication_url => 'https://hostname.usersys.redhat.com:35357/v2.0')
      @providers = double("providers", :sort_by => [@provider], :first => @provider)
      allow(@ems).to receive(:ovirt_services).and_return(double(:collect_external_network_providers => @providers))
      @ems.ensure_managers
    end

    it "does not create orphaned network_manager" do
      expect(ExtManagementSystem.count).to eq(2)
      same_ems = ExtManagementSystem.find(@ems.id)
      allow(same_ems).to receive(:ovirt_services).and_return(double(:collect_external_network_providers => @providers))

      @ems.destroy
      expect(ExtManagementSystem.count).to eq(0)

      same_ems.hostname = "dummy-mandatory"
      same_ems.ensure_managers
      expect(ExtManagementSystem.count).to eq(0)
    end

    context "network manager url is valid" do
      it "returns the correct hostname" do
        expect(@ems.network_manager.hostname).to eq "hostname.usersys.redhat.com"
      end
      it "returns the correct port" do
        expect(@ems.network_manager.port).to eq(35357)
      end
      it "returns the correct version" do
        expect(@ems.network_manager.api_version).to eq("v2")
      end
      it "returns the correct security protocol" do
        expect(@ems.network_manager.security_protocol).to eq("ssl")
      end
    end

    it "removes network manager" do
      zone = FactoryBot.create(:zone)
      allow(MiqServer).to receive(:my_zone).and_return(zone.name)
      allow(@ems).to receive(:ovirt_services).and_return(double(:collect_external_network_providers => {}))
      expect(ExtManagementSystem.count).to eq(2)
      @ems.ensure_managers
      deliver_queue_messages
      expect(ExtManagementSystem.count).to eq(1)
    end

    def deliver_queue_messages
      MiqQueue.order(:id).each do |queue_message|
        status, message, result = queue_message.deliver
        queue_message.delivered(status, message, result)
      end
    end
  end

  context 'catalog types' do
    let(:ems) { FactoryBot.create(:ems_redhat) }

    it "#supported_catalog_types" do
      expect(ems.supported_catalog_types).to eq(%w(redhat))
    end
  end

  context 'vm_migration' do
    before do
      @ems = FactoryBot.create(:ems_redhat)
      @vm = FactoryBot.create(:vm_redhat, :ext_management_system => @ems)

      service = double
      allow(service).to receive(:migrate).with(:host => {:id => "11089411-53a2-4337-8613-7c1d411e8ae8"})
      allow(@ems).to receive(:with_version4_vm_service).and_return(service)
    end

    it "succeeds migration" do
      ems_event = FactoryBot.create(:ems_event, :event_type => "VM_MIGRATION_DONE", :message => "migration done", :ext_management_system => @ems, :vm => @vm, :timestamp => Time.zone.now + 1)
      @vm.ems_events << ems_event

      expect { @ems.vm_migrate(@vm, {:host => "/ovirt-engine/api/hosts/11089411-53a2-4337-8613-7c1d411e8ae8"}, 1) }.to_not raise_error
    end

    it "fails migration" do
      ems_event = FactoryBot.create(:ems_event, :event_type => "VM_MIGRATION_FAILED_FROM_TO", :message => "migration failed", :ext_management_system => @ems, :vm => @vm, :timestamp => Time.zone.now + 1)
      @vm.ems_events << ems_event

      expect { @ems.vm_migrate(@vm, {:host => "/ovirt-engine/api/hosts/11089411-53a2-4337-8613-7c1d411e8ae8"}, 1) }.to raise_error(ManageIQ::Providers::Redhat::InfraManager::OvirtServices::Error)
    end

    it "never receives an event" do
      expect { @ems.vm_migrate(@vm, {:host => "/ovirt-engine/api/hosts/11089411-53a2-4337-8613-7c1d411e8ae8"}, 1, 2) }.to raise_error(ManageIQ::Providers::Redhat::InfraManager::OvirtServices::Error)
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <artifactId>sigpep</artifactId>
        <groupId>com.compomics.sigpep</groupId>
        <version>1.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>sigpep-webapp-vaadin</artifactId>
    <packaging>war</packaging>
    <name>sigpep-webapp-vaadin</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <vaadin.version>6.6.4</vaadin.version>
        <gwt.version>2.3.0</gwt.version>
        <gwt.plugin.version>2.2.0</gwt.plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>

            <!-- Compile custom GWT components or widget dependencies with the GWT compiler -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>${gwt.plugin.version}</version>
                <configuration>
                    <webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets
                    </webappDirectory>
                    <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                    <runTarget>sigpep-webapp-vaadin</runTarget>
                    <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                    <noServer>true</noServer>
                    <port>8080</port>
                    <compileReport>false</compileReport>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>resources</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>${gwt.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwt.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.icepush</groupId>
                        <artifactId>icepush-gwt</artifactId>
                        <version>2.0.0-A3</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>1.0.2</version>
                <executions>
                    <execution>
                        <configuration>
                        </configuration>
                        <goals>
                            <goal>update-widgetset</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- A simple Jetty test server at http://localhost:8080/untitled can be launched with the Maven goal jetty:run
        and stopped with jetty:stop -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.24</version>
                <configuration>
                    <stopPort>9966</stopPort>
                    <stopKey>untitled</stopKey>
                    <!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment -->
                    <scanIntervalSeconds>0</scanIntervalSeconds>
                    <!-- make sure Jetty also finds the widgetset -->
                    <webAppConfig>
                        <contextPath>/untitled</contextPath>
                        <baseResource implementation="org.mortbay.resource.ResourceCollection">
                            <!-- Workaround for Maven/Jetty issue http://jira.codehaus.org/browse/JETTY-680 -->
                            <!-- <resources>src/main/webapp,${project.build.directory}/${project.build.finalName}</resources> -->
                            <resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}
                            </resourcesAsCSV>
                        </baseResource>
                    </webAppConfig>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>copy-vaadin-themes</id>
                        <!-- here the phase you need -->
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.directory}/${project.name}-${project.version}/VAADIN/themes
                            </outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources/themes</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>vaadin-snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
        <repository>
            <id>icefaces</id>
            <url>http://anonsvn.icefaces.org/repo/maven2/releases/</url>
        </repository>
        <repository>
            <id>hadoop</id>
            <url>http://hadoop-bam.sourceforge.net/maven/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>codehaus-snapshots</id>
            <url>http://nexus.codehaus.org/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
        <pluginRepository>
            <id>vaadin-snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>

        <dependency>
            <groupId>com.compomics.sigpep</groupId>
            <artifactId>sigpep-app</artifactId>
            <version>1.1</version>
            <!--<scope>provided</scope>-->
            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xerces</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>icepush</artifactId>
            <version>0.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>notifique</artifactId>
            <version>1.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>overlays</artifactId>
            <version>0.9.8</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>confirmdialog</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>contexthelp</artifactId>
            <version>1.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt.version}</version>
            <scope>provided</scope>
        </dependency>
        <!--javax validation framework-->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <scope>provided</scope>
        </dependency>
        <!--javax validation framework-->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.0.0.GA</version>
            <classifier>sources</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.icepush</groupId>
            <artifactId>icepush-gwt</artifactId>
            <version>2.0.0-A3</version>
        </dependency>
        <dependency>
            <groupId>org.icepush</groupId>
            <artifactId>icepush-basic</artifactId>
            <version>2.0.0-A3</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>10.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.compomics</groupId>
            <artifactId>pepnovo-jwrapper</artifactId>
            <version>0.2</version>
            <exclusions>
                <exclusion>
                    <groupId>com.compomics</groupId>
                    <artifactId>utilities</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.jbytecode</groupId>
            <artifactId>RCaller</artifactId>
            <version>2.8</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.4</version>
        </dependency>
        <!--google analytics vaadin add-on-->
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>googleanalyticstracker</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.0.3.RELEASE</version>
        </dependency>
    </dependencies>
</project>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>CodeAndMore @font-face Demo</title>

test heading h1

test heading h2

test heading h3

test normal paragraph

Created by @font-face generator on CodeAndMore based on open source tools.


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="280dip"
    android:layout_height="350dip"
    android:layout_gravity="center_vertical|center_horizontal"
    android:background="@drawable/alertdialog_bg"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="2.0dip"
        android:layout_marginTop="15.0dip" />

    <TextView
        android:id="@+id/message_select_tv"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="关于我们" />

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="2.0dip"
        android:layout_marginTop="5.0dip"
        android:src="@color/darkgray" />

    <TextView
        android:layout_width="220dp"
        android:layout_height="wrap_content"
         android:layout_gravity="center"
            android:gravity="center"
        android:layout_weight="0.34"
        android:text="长沙新帆网络科技有限公司asdlkasdjlajsdljjlkajsldkjaslkjlkajsdlkjsalkdjalskjdlkasjdlkasjdlkjasldkjlaksjdkl~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" />

</LinearLayout>


text:
namespace password_manager {

namespace {

TEST(PSLMatchingUtilsTest, IsPublicSuffixDomainMatch) {
  struct TestPair {
    const char* url1;
    const char* url2;
    bool should_match;
  };

  TestPair pairs[] = {
      {"http://facebook.com", "http://facebook.com", true},
      {"http://facebook.com/path", "http://facebook.com/path", true},
      {"http://facebook.com/path1", "http://facebook.com/path2", true},
      {"http://facebook.com", "http://m.facebook.com", true},
      {"http://www.facebook.com", "http://m.facebook.com", true},
      {"http://facebook.com/path", "http://m.facebook.com/path", true},
      {"http://facebook.com/path1", "http://m.facebook.com/path2", true},
      {"http://example.com/has space", "http://example.com/has space", true},
      {"http://www.example.com", "http://wwwexample.com", false},
      {"http://www.example.com", "https://www.example.com", false},
      {"http://www.example.com:123", "http://www.example.com", false},
      {"http://www.example.org", "http://www.example.com", false},
      // URLs without registry controlled domains should not match.
      {"http://localhost", "http://127.0.0.1", false},
      // Invalid URLs should not match anything.
      {"http://", "http://", false},
      {"", "", false},
      {"bad url", "bad url", false},
      {"http://www.example.com", "http://", false},
      {"", "http://www.example.com", false},
      {"http://www.example.com", "bad url", false},
      {"http://www.example.com/%00", "http://www.example.com/%00", false},
  };

  for (size_t i = 0; i < arraysize(pairs); ++i) {
    autofill::PasswordForm form1;
    form1.signon_realm = pairs[i].url1;
    autofill::PasswordForm form2;
    form2.signon_realm = pairs[i].url2;
    EXPECT_EQ(pairs[i].should_match,
              IsPublicSuffixDomainMatch(form1.signon_realm, form2.signon_realm))
        << "First URL = " << pairs[i].url1
        << ", second URL = " << pairs[i].url2;
  }
}

}  // namespace

}  // namespace password_manager


text:
package org.springframework.boot.context.properties.source;

import org.springframework.util.Assert;

/**
 * A {@link ConfigurationPropertySource} supporting a prefix.
 *
 * @author Madhura Bhave
 */
class PrefixedConfigurationPropertySource implements ConfigurationPropertySource {

	private final ConfigurationPropertySource source;

	private final ConfigurationPropertyName prefix;

	PrefixedConfigurationPropertySource(ConfigurationPropertySource source, String prefix) {
		Assert.notNull(source, "Source must not be null");
		Assert.hasText(prefix, "Prefix must not be empty");
		this.source = source;
		this.prefix = ConfigurationPropertyName.of(prefix);
	}

	protected final ConfigurationPropertyName getPrefix() {
		return this.prefix;
	}

	@Override
	public ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name) {
		ConfigurationProperty configurationProperty = this.source.getConfigurationProperty(getPrefixedName(name));
		if (configurationProperty == null) {
			return null;
		}
		return ConfigurationProperty.of(name, configurationProperty.getValue(), configurationProperty.getOrigin());
	}

	private ConfigurationPropertyName getPrefixedName(ConfigurationPropertyName name) {
		return this.prefix.append(name);
	}

	@Override
	public ConfigurationPropertyState containsDescendantOf(ConfigurationPropertyName name) {
		return this.source.containsDescendantOf(getPrefixedName(name));
	}

	@Override
	public Object getUnderlyingSource() {
		return this.source.getUnderlyingSource();
	}

	protected ConfigurationPropertySource getSource() {
		return this.source;
	}

}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.sql.util;

import com.google.common.graph.SuccessorsFunction;
import com.google.common.graph.Traverser;
import io.prestosql.sql.tree.Node;

import java.util.stream.Stream;

import static com.google.common.collect.Streams.stream;
import static java.util.Objects.requireNonNull;

public final class AstUtils
{
    public static boolean nodeContains(Node node, Node subNode)
    {
        requireNonNull(node, "node is null");
        requireNonNull(subNode, "subNode is null");

        return preOrder(node)
                .anyMatch(childNode -> childNode == subNode);
    }

    public static Stream<Node> preOrder(Node node)
    {
        return stream(
                Traverser.forTree((SuccessorsFunction<Node>) Node::getChildren)
                        .depthFirstPreOrder(requireNonNull(node, "node is null")));
    }

    private AstUtils() {}
}


text:
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using SquidReports.DataCollector.Plugin.BES.Model;

namespace SquidReports.DataCollector.Plugin.BES.Context
{
    public class BESContext : DbContext
    {
        public BESContext() : base("DB")
        {

        }

        public DbSet<Model.Action> Actions { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}


text:
Title: Galettes bretonnes
Category: Recette
Tags: recette, plat, breton, moyen
Summary: Recette pour des galettes bretonnes, le plat typique de la Bretagne, facile à cuisiner, rapide à cuire et délicieux dans l'assiette !

Recette pour des galettes bretonnes : le plat typique de la Bretagne, facile à cuisiner, rapide à cuire et délicieux dans l'assiette !

- *Préparation* : 5 minutes.
- *Cuisson* : 7-10 minutes.
- *Quantité* : pour 2 personnes, 4 à 6 galettes bretonnes (selon la taille de votre poêle).

## Ingrédients
- 1 œuf moyen (optionnel, la variante végan est sans l'œuf et ça fonctionne très bien aussi !),
- trois cuillères à soupe de farine blanche,
- 125 g de farine de blé noir,
- 40 cL d'eau (plus ou moins),
- un peu de sel.

> Pour plus de deux personnes, comptez ces quantités et multipliez...

## Préparation
1. Dans un gros saladier, mélanger les deux farines,
2. Ajouter l'œuf (optionnel) et le sel :
   [![galette-bretonne-1.jpg]({static}images/galette-bretonne-1.jpg){width=40%}]({static}images/galette-bretonne-1.jpg)

3. Bien travailler cette pâte en ajoutant petit à petit de l'eau, en mélangeant beaucoup avec un fouet,
4. Ne pas mettre trop d'eau, la pâte doit être collante et fluide... *mais pas trop*. De petites bulles apparaissent sur le dessus :
   [![galette-bretonne-2.jpg]({static}images/galette-bretonne-2.jpg){width=40%}]({static}images/galette-bretonne-2.jpg)
   > Comme Perceval et Karadoc qui font des potions,  *« J'en met combien ? Ben, vous en mettez pas trop. »* -- Kaamelott, Livre I.

## Cuisson
1. Dans une poêle bien chaude <i class="fa fa-thermometer-full" aria-hidden="true"></i>, anti-adhérente,
2. Ajouter une noix de beurre, ou d'huile végétale (par exemple de tournesol) dans la variante végan,
3. Étendre une mince couche de cette préparation dans la poêle,
4. Laisser cuire et dorer le côté poêle, puis retourner,
   [![galette-bretonne-3.jpg]({static}images/galette-bretonne-3.jpg){width=55%}]({static}images/galette-bretonne-3.jpg)

5. On peut garnir directement dans la poêle : la "galette complète" est avec du fromage rappé (gruyère), du jambon et un œuf, qui vont cuire directement dans la poêle (on peut plier la galette pour la servir plus facilement).

## Service
- :cutlery: Service bien chaud, avec une petite salade verte,
- Garnir avec du jambon, un œuf en plus, du fromage etc. Il suffit d'être créatif !
- Variante végan : avec des légumes, des épices, des graines… J'aime beaucoup les combinaisons suivantes : une tomate et du persil frais haché, des courgettes et oignons grillés à la poèle (il faut les faire avant), une fondue de poireaux, des pommes de terres, carottes, panais ou potimarrons, cuits à la vapeur en petits morceaux…
- :wine_glass: Servir avec un bon cidre sec.
- Si on ne sale pas trop la pâte, on peut aussi les déguster avec de la garniture sucrée. Les classiques : miel, confiture, crème de marrons, sucre... Les plus originales : sirop d'érable et chantilly, beurre sucre, sucre citron, sucre et flambée au rhum etc.
- Sucrées, c'est délicieux avec une boule de glace, par exemple une boule citron pour une crêpe beurre sucre :

[![galette-bretonne-5.jpg]({static}images/galette-bretonne-5.jpg){width=75%}]({static}images/galette-bretonne-5.jpg)

## Photo
[![galette-bretonne-4.jpg]({static}images/galette-bretonne-4.jpg){width=75%}]({static}images/galette-bretonne-4.jpg)

## Remarques
- Des poêles "crêpières" fonctionnent très bien !
- **Attention** c'est en fait assez long à cuire si vous prévoyez d'en faire pour 6 personnes… On peut facilement passer 40 minutes devant sa poêle (surtout si on en a qu'une seule) quand les autres mangent !


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!--
This file contains standard test definitions for the Android platform

The following test types are supported:
 - On device Java instrumentation tests are defined by <test> tags.
 - native ones (C/C++) are defined by <test-native> tags.
 - host java tests are defined by <test-host> tags.

See test_defs.xsd for more information.
-->

<test-definitions xmlns="http://schemas.android.com/testrunner/test_defs/1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://schemas.android.com/testrunner/test_defs/1.0 test_defs.xsd">

<!-- frameworks tests -->
<test name="frameworks-core"
    build_path="frameworks/base/core/tests/coretests"
    package="com.android.frameworks.coretests"
    coverage_target="framework"
    continuous="true" />

<!-- will not run in the continuous test as it needs both Wifi & 3G -->
<test name="frameworks-connectivity"
    build_path="frameworks/base/core/tests/ConnectivityManagerTest/"
    package="com.android.connectivitymanagertest"
    runner=".ConnectivityManagerUnitTestRunner"
    coverage_target="framework" />

<test name="frameworks-graphics"
    build_path="frameworks/base/graphics/tests/graphicstests"
    package="com.android.frameworks.graphicstests"
    coverage_target="framework"
    continuous="true" />

<test name="frameworks-location"
    build_path="frameworks/base/location/tests/locationtests"
    package="com.android.frameworks.locationtests"
    coverage_target="framework"
    continuous="true" />

<test name="frameworks-sax"
    build_path="frameworks/base/sax/tests/saxtests"
    package="com.android.frameworks.saxtests"
    coverage_target="framework"
    continuous="true" />

<test name="frameworks-services"
    build_path="frameworks/base/services/tests/servicestests"
    package="com.android.frameworks.servicestests"
    coverage_target="framework"
    continuous="true" />

<test name="frameworks-telephony"
    build_path="frameworks/opt/telephony/tests/telephonytests"
    package="com.android.frameworks.telephonytests"
    coverage_target="framework"
    continuous="true" />

<test name="frameworks-testrunner"
    build_path="frameworks/base/test-runner"
    package="com.android.frameworks.testrunner.tests"
    coverage_target="android.test.runner"
    continuous="true" />

<test name="frameworks-vpn"
    build_path="frameworks/base/vpn/tests/vpntests"
    package="com.android.frameworks.vpntests"
    coverage_target="framework"
    continuous="true" />

<test name="frameworks-support"
    build_path="frameworks/support/tests"
    package="android.support.tests"
    continuous="true" />

<test name="core"
    build_path="frameworks/base/tests/CoreTests"
    package="android.core"
    coverage_target="framework"
    continuous="true" />

<test name="keystore-unit"
    build_path="frameworks/base/keystore/tests"
    package="android.security.tests"
    coverage_target="framework"
    continuous="true" />

<test name="imf"
    build_path="frameworks/base/tests/ImfTest"
    package="com.android.imftest.tests"
    coverage_target="framework"
    continuous="true" />

<test name="framework-permission"
    build_path="frameworks/base/tests/permission"
    package="com.android.framework.permission.tests"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="framework"
    continuous="true" />

<test name="android-common"
    build_path="frameworks/base/common/tests"
    package="com.android.common.tests"
    coverage_target="framework"
    continuous="true" />

<test name="ex-variablespeed"
    build_path="frameworks/ex/variablespeed/tests"
    package="com.android.ex.variablespeed.tests"
    coverage_target="framework"
    continuous="true"
    description="Framework variable speed audio tests" />

<test-native name="libandroidfw"
    build_path="frameworks/base/libs/androidfw/tests"
    description="Framework libandroidfw unit tests." />

<test-native name="libutils"
    build_path="frameworks/native/libs/utils/tests"
    description="Framework libutils unit tests." />

<test-native name="libinput"
    build_path="frameworks/native/libs/input/tests"
    description="Framework libinput unit tests." />

<test-native name="libinputservice"
    build_path="frameworks/base/services/input/tests"
    description="Framework libinputservice unit tests." />

<test name="volley"
    build_path="frameworks/support/volley/tests"
    package="com.android.volley.tests"
    continuous="true" />

<!--  end of framework tests -->

<!-- media framework tests -->
<test name="media"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    runner=".MediaFrameworkTestRunner"
    coverage_target="framework"
    continuous="true" />

<test name="mediaapitest"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    class="com.android.mediaframeworktest.functional.MediaPlayerApiTest"
    runner=".MediaFrameworkTestRunner"
    coverage_target="framework" />

<test name="mediarecordertest"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    class="com.android.mediaframeworktest.functional.MediaRecorderTest"
    runner=".MediaFrameworkTestRunner"
    coverage_target="framework" />

<test name="mediastresstest"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    runner=".MediaRecorderStressTestRunner"
    coverage_target="framework" />

<test name="mediamemorystress"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    runner=".MediaFrameworkPerfTestRunner"
    coverage_target="framework" />

<test name="mediaunit"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    runner=".MediaFrameworkUnitTestRunner"
    coverage_target="framework" />

<test name="mediaintegrationtest"
    build_path="frameworks/base/media/tests/MediaFrameworkTest"
    package="com.android.mediaframeworktest"
    runner=".MediaFrameworkIntegrationTestRunner"
    coverage_target="framework" />

<test-native name="camera-client-native"
    build_path="frameworks/av/camera/tests/"
    description="Camera client native tests." />

<test-native name="camera-hal2-native"
    build_path="hardware/libhardware/tests/camera2"
    description="Camera hal2 native tests." />
<!--  end of media framework tests -->

<!--  targeted framework tests -->
<test name="account"
    build_path="frameworks/base/core/tests/coretests"
    package="com.android.frameworks.coretests"
    class="android.accounts.AccountManagerServiceTest"
    coverage_target="framework" />

<test name="smoke"
    build_path="frameworks/base/tests/SmokeTest"
    package="com.android.smoketest.tests"
    coverage_target="framework"
    continuous="true" />

<test name="launchperf"
    build_path="development/apps/launchperf"
    package="com.android.launchperf"
    runner=".SimpleActivityLaunchPerformance"
    coverage_target="framework" />

<test name="contentprovideroperation"
    build_path="frameworks/base/core/tests/coretests"
    package="com.android.frameworks.coretests"
    class="android.content.ContentProviderOperationTest"
    coverage_target="framework" />

<!--  cts tests -->

<test name="cts-permission"
    build_path="cts/tests/tests/permission"
    package="com.android.cts.permission"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="framework"
    continuous="true"
    suite="cts" />

<test name="cts-permission2"
    build_path="cts/tests/tests/permission2"
    package="com.android.cts.permission2"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="framework"
    continuous="true"
    suite="true" />

<test name="cts-process"
    build_path="cts/tests/tests/process"
    package="com.android.cts.process"
    coverage_target="framework"
    suite="cts" />

<test name="cts-security"
    build_path="cts/tests/tests/security"
    package="com.android.cts.security"
    runner="android.test.InstrumentationCtsTestRunner"
    suite="cts" />

<test name="cts-accounts"
    build_path="cts/tests/tests/accounts"
    package="android.accounts.cts"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-api-signature"
    build_path="cts/tests/SignatureTest"
    package="android.tests.sigtest"
    runner=".InstrumentationRunner"
    suite="cts" />

<test name="cts-api-signature-func"
    build_path="cts/tests/SignatureTest"
    package="android.tests.sigtest.tests"
    suite="cts" />

<test name="cts-app"
    build_path="cts/tests/tests/app"
    package="com.android.cts.app"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-content"
    build_path="cts/tests/tests/content"
    package="com.android.cts.content"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-database"
    build_path="cts/tests/tests/database"
    package="com.android.cts.database"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-dreams"
    build_path="cts/tests/tests/dreams"
    package="com.android.cts.dreams"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-gesture"
    build_path="cts/tests/tests/gesture"
    package="com.android.cts.gesture"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-graphics"
    build_path="cts/tests/tests/graphics"
    package="com.android.cts.graphics"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-hardware"
    build_path="cts/tests/tests/hardware"
    package="com.android.cts.hardware"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    continuous="true"
    suite="cts" />

<test name="cts-location"
    build_path="cts/tests/tests/location"
    package="com.android.cts.location"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-media"
    build_path="cts/tests/tests/media"
    package="com.android.cts.media"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-net"
    build_path="cts/tests/tests/net"
    package="com.android.cts.net"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-os"
    build_path="cts/tests/tests/os"
    package="com.android.cts.os"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-provider"
    build_path="cts/tests/tests/provider"
    package="com.android.cts.provider"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-text"
    build_path="cts/tests/tests/text"
    package="com.android.cts.text"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-telephony"
    build_path="cts/tests/tests/telephony"
    package="com.android.cts.telephony"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-util"
    build_path="cts/tests/tests/util"
    package="com.android.cts.util"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-view"
    build_path="cts/tests/tests/view"
    package="com.android.cts.view"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-webkit"
    build_path="cts/tests/tests/webkit"
    package="com.android.cts.webkit"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<test name="cts-widget"
    build_path="cts/tests/tests/widget"
    package="com.android.cts.widget"
    runner="android.test.InstrumentationCtsTestRunner"
    coverage_target="framework"
    suite="cts" />

<!--  end of cts tests -->

<!--  selected app tests -->
<test name="apidemos"
    build_path="development/samples/ApiDemos"
    package="com.example.android.apis.tests" />

<test name="browser"
    build_path="packages/apps/Browser"
    package="com.android.browser.tests"
    coverage_target="Browser"
    continuous="true" />

<test name="calculator"
    build_path="packages/apps/Calculator"
    package="com.android.calculator2.tests"
    coverage_target="Calculator"
    continuous="true" />

<test name="calendar"
    build_path="packages/apps/Calendar"
    package="com.android.calendar.tests"
    coverage_target="Calendar"
    continuous="true" />

<test name="calprov"
    build_path="packages/providers/CalendarProvider"
    package="com.android.providers.calendar.tests"
    coverage_target="CalendarProvider"
    continuous="true" />

<test name="camera-functional"
    build_path="packages/apps/Camera"
    package="com.google.android.camera.tests"
    runner="com.android.camera.CameraTestRunner"
    coverage_target="Camera"
    description="Camera functional test"
    continuous="true" />

<test name="contactsprov"
    build_path="packages/providers/ContactsProvider"
    package="com.android.providers.contacts.tests"
    coverage_target="ContactsProvider"
    continuous="true" />

<test name="contacts"
    build_path="packages/apps/Contacts"
    package="com.android.contacts.tests"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="Contacts"
    description="Tests for the Contacts app."
    continuous="true" />

<test name="contacts-launch"
    build_path="packages/apps/Contacts"
    package="com.android.contacts.tests"
    runner="com.android.contacts.ContactsLaunchPerformance"
    description="Launch performance for Contacts." />

<test name="dialer"
    build_path="packages/apps/Dialer"
    package="com.android.dialer.tests"
    runner="android.test.InstrumentationTestRunner"
    coverage_target="Dialer"
    description="Tests for the Dialer app."
    continuous="true" />

<test name="downloadprovider"
    build_path="packages/providers/DownloadProvider/tests"
    package="com.android.providers.downloads.tests"
    coverage_target="DownloadProvider"
    continuous="true" />

<test name="downloadprovider-permission"
    build_path="packages/providers/DownloadProvider/tests/permission"
    package="com.android.providers.downloads.permission.tests"
    coverage_target="DownloadProvider"
    continuous="true" />

<test name="email"
    build_path="packages/apps/Email"
    package="com.android.email.tests"
    coverage_target="Email"
    continuous="true" />

<test name="emailsmall"
    build_path="packages/apps/Email"
    package="com.android.email.tests"
    class="com.android.email.SmallTests"
    coverage_target="Email" />

<test name="exchange"
    build_path="packages/apps/Exchange"
    package="com.android.exchange.tests"
    coverage_target="Exchange"
    continuous="true" />

<test name="musicplayer"
    build_path="packages/apps/Music"
    package="com.android.music.tests"
    runner=".MusicPlayerFunctionalTestRunner"
    coverage_target="Music" />

<test name="mms"
    build_path="packages/apps/Mms"
    package="com.android.mms.tests"
    coverage_target="Mms" />

<!-- Unit tests for the phone application. -->
<test name="phone-unit"
    build_path="packages/apps/Phone"
    package="com.android.phone.tests"
    continuous="true"
    coverage_target="Phone" />

<test name="quicksearchbox"
    build_path="packages/apps/QuickSearchBox"
    package="com.android.quicksearchbox.tests"
    coverage_target="QuickSearchBox" />

<test name="systemui"
    build_path="frameworks/base/packages/SystemUI"
    package="com.android.systemui.tests"
    coverage_target="SystemUI"
    continuous="true"
    description="SystemUI tests" />

<test name="documentsui"
    build_path="frameworks/base/packages/DocumentsUI/tests"
    package="com.android.documentsui.tests"
    coverage_target="DocumentsUI"
    continuous="true"
    description="DocumentsUI tests" />

<!--  native tests  -->

<!-- Bionic C++ -->
<test-native name="libstdcpp"
    build_path="system/extras/tests/bionic/libstdc++"
    description="Bionic libstdc++."
    extra_build_args="BIONIC_TESTS=1" />

<test-native name="libskia"
    build_path="external/skia/tests"
    description="Skia tests." />

<!-- Google Test -->
<test-native name="gtest"
    build_path="external/gtest"
    description="Google test."
    extra_build_args="GTEST_TESTS=1" />

<!-- Libjingle -->
<test-native name="libjingle"
    build_path="vendor/google/libraries/libjingle"
    description="Libjingle."
    full_make="true"
    extra_build_args="LIBJINGLE_TESTS=1" />

<!-- host java tests -->
<test-host name="cts-appsecurity"
    build_path="cts/hostsidetests/appsecurity"
    class="com.android.cts.appsecurity.AppSecurityTests"
    jar_name="CtsAppSecurityTests.jar"
    suite="cts" />

<test-host name="frameworks-core-host"
    build_path="frameworks/base/core/tests/hosttests"
    class="android.content.pm.PackageManagerHostTests"
    jar_name="FrameworkCoreHostTests.jar" />

</test-definitions>


text:
#ifndef jsprvtd_h___
#define jsprvtd_h___
/*
 * JS private typename definitions.
 *
 * This header is included only in other .h files, for convenience and for
 * simplicity of type naming.  The alternative for structures is to use tags,
 * which are named the same as their typedef names (legal in C/C++, and less
 * noisy than suffixing the typedef name with "Struct" or "Str").  Instead,
 * all .h files that include this file may use the same typedef name, whether
 * declaring a pointer to struct type, or defining a member of struct type.
 *
 * A few fundamental scalar types are defined here too.  Neither the scalar
 * nor the struct typedefs should change much, therefore the nearly-global
 * make dependency induced by this file should not prove painful.
 */

#include "jspubtd.h"

/* Internal identifier (jsid) macros. */

#define JSID_IS_ATOM(id)            JSVAL_IS_STRING((jsval)(id))
#define JSID_TO_ATOM(id)            ((JSAtom *)(id))
#define ATOM_TO_JSID(atom)          (JS_ASSERT(ATOM_IS_STRING(atom)),         \
                                     (jsid)(atom))

#define JSID_IS_INT(id)             JSVAL_IS_INT((jsval)(id))
#define JSID_TO_INT(id)             JSVAL_TO_INT((jsval)(id))
#define INT_TO_JSID(i)              ((jsid)INT_TO_JSVAL(i))
#define INT_JSVAL_TO_JSID(v)        ((jsid)(v))
#define INT_JSID_TO_JSVAL(id)       ((jsval)(id))

#define JSID_IS_OBJECT(id)          JSVAL_IS_OBJECT((jsval)(id))
#define JSID_TO_OBJECT(id)          JSVAL_TO_OBJECT((jsval)(id))
#define OBJECT_TO_JSID(obj)         ((jsid)OBJECT_TO_JSVAL(obj))
#define OBJECT_JSVAL_TO_JSID(v)     ((jsid)v)

#define ID_TO_VALUE(id)             ((jsval)(id))

/*
 * Convenience constants.
 */
#define JS_BITS_PER_UINT32_LOG2 5
#define JS_BITS_PER_UINT32      32

/* Scalar typedefs. */
typedef uint8  jsbytecode;
typedef uint8  jssrcnote;
typedef uint32 jsatomid;

/* Struct typedefs. */
typedef struct JSArgumentFormatMap  JSArgumentFormatMap;
typedef struct JSCodeGenerator      JSCodeGenerator;
typedef struct JSGCThing            JSGCThing;
typedef struct JSGenerator          JSGenerator;
typedef struct JSParseContext       JSParseContext;
typedef struct JSParsedObjectBox    JSParsedObjectBox;
typedef struct JSParseNode          JSParseNode;
typedef struct JSPropCacheEntry     JSPropCacheEntry;
typedef struct JSSharpObjectMap     JSSharpObjectMap;
typedef struct JSTempValueRooter    JSTempValueRooter;
typedef struct JSThread             JSThread;
typedef struct JSToken              JSToken;
typedef struct JSTokenPos           JSTokenPos;
typedef struct JSTokenPtr           JSTokenPtr;
typedef struct JSTokenStream        JSTokenStream;
typedef struct JSTreeContext        JSTreeContext;
typedef struct JSTryNote            JSTryNote;
typedef struct JSWeakRoots          JSWeakRoots;

/* Friend "Advanced API" typedefs. */
typedef struct JSAtom               JSAtom;
typedef struct JSAtomList           JSAtomList;
typedef struct JSAtomListElement    JSAtomListElement;
typedef struct JSAtomMap            JSAtomMap;
typedef struct JSAtomState          JSAtomState;
typedef struct JSCodeSpec           JSCodeSpec;
typedef struct JSPrinter            JSPrinter;
typedef struct JSRegExp             JSRegExp;
typedef struct JSRegExpStatics      JSRegExpStatics;
typedef struct JSScope              JSScope;
typedef struct JSScopeOps           JSScopeOps;
typedef struct JSScopeProperty      JSScopeProperty;
typedef struct JSStackHeader        JSStackHeader;
typedef struct JSStringBuffer       JSStringBuffer;
typedef struct JSSubString          JSSubString;
typedef struct JSXML                JSXML;
typedef struct JSXMLNamespace       JSXMLNamespace;
typedef struct JSXMLQName           JSXMLQName;
typedef struct JSXMLArray           JSXMLArray;
typedef struct JSXMLArrayCursor     JSXMLArrayCursor;

/* "Friend" types used by jscntxt.h and jsdbgapi.h. */
typedef enum JSTrapStatus {
    JSTRAP_ERROR,
    JSTRAP_CONTINUE,
    JSTRAP_RETURN,
    JSTRAP_THROW,
    JSTRAP_LIMIT
} JSTrapStatus;

typedef JSTrapStatus
(* JS_DLL_CALLBACK JSTrapHandler)(JSContext *cx, JSScript *script,
                                  jsbytecode *pc, jsval *rval, void *closure);

typedef JSBool
(* JS_DLL_CALLBACK JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsval id,
                                        jsval old, jsval *newp, void *closure);

/* called just after script creation */
typedef void
(* JS_DLL_CALLBACK JSNewScriptHook)(JSContext  *cx,
                                    const char *filename,  /* URL of script */
                                    uintN      lineno,     /* first line */
                                    JSScript   *script,
                                    JSFunction *fun,
                                    void       *callerdata);

/* called just before script destruction */
typedef void
(* JS_DLL_CALLBACK JSDestroyScriptHook)(JSContext *cx,
                                        JSScript  *script,
                                        void      *callerdata);

typedef void
(* JS_DLL_CALLBACK JSSourceHandler)(const char *filename, uintN lineno,
                                    jschar *str, size_t length,
                                    void **listenerTSData, void *closure);

/*
 * This hook captures high level script execution and function calls (JS or
 * native).  It is used by JS_SetExecuteHook to hook top level scripts and by
 * JS_SetCallHook to hook function calls.  It will get called twice per script
 * or function call: just before execution begins and just after it finishes.
 * In both cases the 'current' frame is that of the executing code.
 *
 * The 'before' param is JS_TRUE for the hook invocation before the execution
 * and JS_FALSE for the invocation after the code has run.
 *
 * The 'ok' param is significant only on the post execution invocation to
 * signify whether or not the code completed 'normally'.
 *
 * The 'closure' param is as passed to JS_SetExecuteHook or JS_SetCallHook
 * for the 'before'invocation, but is whatever value is returned from that
 * invocation for the 'after' invocation. Thus, the hook implementor *could*
 * allocate a structure in the 'before' invocation and return a pointer to that
 * structure. The pointer would then be handed to the hook for the 'after'
 * invocation. Alternately, the 'before' could just return the same value as
 * in 'closure' to cause the 'after' invocation to be called with the same
 * 'closure' value as the 'before'.
 *
 * Returning NULL in the 'before' hook will cause the 'after' hook *not* to
 * be called.
 */
typedef void *
(* JS_DLL_CALLBACK JSInterpreterHook)(JSContext *cx, JSStackFrame *fp, JSBool before,
                                      JSBool *ok, void *closure);

typedef void
(* JS_DLL_CALLBACK JSObjectHook)(JSContext *cx, JSObject *obj, JSBool isNew,
                                 void *closure);

typedef JSBool
(* JS_DLL_CALLBACK JSDebugErrorHook)(JSContext *cx, const char *message,
                                     JSErrorReport *report, void *closure);

typedef struct JSDebugHooks {
    JSTrapHandler       interruptHandler;
    void                *interruptHandlerData;
    JSNewScriptHook     newScriptHook;
    void                *newScriptHookData;
    JSDestroyScriptHook destroyScriptHook;
    void                *destroyScriptHookData;
    JSTrapHandler       debuggerHandler;
    void                *debuggerHandlerData;
    JSSourceHandler     sourceHandler;
    void                *sourceHandlerData;
    JSInterpreterHook   executeHook;
    void                *executeHookData;
    JSInterpreterHook   callHook;
    void                *callHookData;
    JSObjectHook        objectHook;
    void                *objectHookData;
    JSTrapHandler       throwHook;
    void                *throwHookData;
    JSDebugErrorHook    debugErrorHook;
    void                *debugErrorHookData;
} JSDebugHooks;

/*
 * Type definitions for temporary GC roots that register with GC local C
 * variables. See jscntxt.h for details.
 */
typedef void
(* JS_DLL_CALLBACK JSTempValueTrace)(JSTracer *trc, JSTempValueRooter *tvr);

typedef union JSTempValueUnion {
    jsval               value;
    JSObject            *object;
    JSString            *string;
    JSXML               *xml;
    JSXMLQName          *qname;
    JSXMLNamespace      *nspace;
    JSTempValueTrace    trace;
    JSScopeProperty     *sprop;
    JSWeakRoots         *weakRoots;
    JSParseContext      *parseContext;
    JSScript            *script;
    jsval               *array;
} JSTempValueUnion;

struct JSTempValueRooter {
    JSTempValueRooter   *down;
    ptrdiff_t           count;
    JSTempValueUnion    u;
};

/*
 * The following determines whether JS_EncodeCharacters and JS_DecodeBytes
 * treat char[] as utf-8 or simply as bytes that need to be inflated/deflated.
 */
#ifdef JS_C_STRINGS_ARE_UTF8
# define js_CStringsAreUTF8 JS_TRUE
#else
extern JSBool js_CStringsAreUTF8;
#endif

#endif /* jsprvtd_h___ */


text:
<!doctype html>
<html class="no-js" <?php language_attributes(); ?>>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="alternate" type="application/rss+xml" title="<?= get_bloginfo('name'); ?> Feed" href="<?= esc_url(get_feed_link()); ?>">
    <script src="//use.typekit.net/dxp5ekn.js"></script>
    <script>try{Typekit.load();}catch(e){}</script>
    <?php wp_head(); ?>
  </head>


text:
__author__ = 'housne'

import os
import __builtin__
import json
import codecs
import hashlib
from datetime import datetime
import jinja2
from jinja2 import Environment, FileSystemLoader
import markdown
from pyrfc3339 import generate
import pytz
import htmlmin
from conf import *

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates')
ASSETS_DIR = os.path.join(BASE_DIR, 'static/assets')
DIST_ASSETS_DIR = os.path.join(BASE_DIR, 'static/assets/dist')
BUILD_ASSETS_DIR = os.path.join(BASE_DIR, 'static/assets/build')
__builtin__.GLOBAL_PAGES = []

def write_file(file_name, file_content):
    if not os.path.exists(os.path.dirname(file_name)):
        os.makedirs(os.path.dirname(file_name))
    with codecs.open(file_name, 'w', encoding='utf8') as f:
        f.write(file_content)

def read_file(file_name):
    with codecs.open(file_name, 'r', encoding='utf8') as f:
        return f.read()

def write_json(file_name, data):
    if not os.path.exists(os.path.dirname(file_name)):
        os.makedirs(os.path.dirname(file_name))
    with open(file_name, 'w') as f:
        json.dump(f, data)

def read_json(file_name):
    try:
        with open(file_name, 'r') as f:
            return json.load(f.read())
    except IOError:
        return None

def md5(string):
    string = string.encode('utf-8')
    m = hashlib.md5()
    m.update(str(string))
    hash_str = m.hexdigest()[0:6]
    return hash_str

def md5_filter(file_path):
    t = file_path.split('/')[0]
    if DEBUG is True:
        return "dist/%s" % file_path
    f = os.path.join(DIST_ASSETS_DIR, file_path)
    with codecs.open(f, "r", encoding="utf-8") as fl:
        content = fl.read()
        file_name = "build/%s/%s" % (t, md5(content))
        md5_file_path = os.path.join(ASSETS_DIR, file_name)
        if not os.path.exists(md5_file_path):
            write_file(md5_file_path, content)
        return file_name

def rfc3339_filter(date):
    try:
        shanghai = pytz.timezone("Asia/Shanghai")
        dt = shanghai.localize(date)
    except ValueError:
        eastern = pytz.timezone('US/Eastern')
        dt = eastern.localize(datetime.now())
    return generate(dt)

def inline_assets(file_path, type):
    file_path = md5_filter(file_path)
    if DEBUG is True:
        resource = "<link href='/assets/%s' rel='stylesheet'>" % file_path
        if type == 'style':
            resource = "<link href='/assets/%s' rel='stylesheet'>" % file_path
        if type == 'script':
            resource = "<script src='/assets/%s'></script>" % file_path
        return resource
    f = read_file(os.path.join(ASSETS_DIR, file_path))
    return "<%s>%s</%s>" % (type, f, type)

@jinja2.contextfunction
def cover_filter(context):
    print context

def render(template=None, **kwargs):
    env = Environment(loader=FileSystemLoader(TEMPLATE_DIR),
                      trim_blocks=True)
    env.filters["md5"] = md5_filter
    env.filters["rfc3339"] = rfc3339_filter
    env.filters["inline_assets"] = inline_assets
    template = env.get_template(template)
    html = template.render(config=SITE_CONFIG, last_build=datetime.now(),
                           pages=__builtin__.GLOBAL_PAGES, **kwargs)
    minify = kwargs.get('minify', True)
    if minify is False:
        return html
    return htmlmin.minify(html)

def md(text):
    mark = markdown.Markdown(extensions=['markdown.extensions.meta', 'codehilite'],
                             extension_configs={'codehilite': {'linenums': True}})
    html = htmlmin.minify(mark.convert(text))
    content = mark.Meta
    data = {}
    for key, item in content.iteritems():
        data[key] = ''.join(item)
    data["content"] = html
    try:
        data["tags"] = [tag.strip() for tag in data["tags"].strip('[]').split(',')]
        data["date"] = datetime.strptime(data["date"], "%Y-%m-%d")
    except KeyError as e:
        if e == "date":
            data["date"] = datetime.now()
        else:
            data["tags"] = ["default"]
    except ValueError as e:
        if e == "date":
            data["date"] = datetime.now()
    return data

def pagination(data_length, page, path):
    pages = int(data_length / PAGE_SIZE)
    if pages <= 0:
        pages = 1
    if data_length > PAGE_SIZE and data_length % PAGE_SIZE > 0:
        pages += 1
    if page > pages:
        page = pages
    has_next = page < pages
    has_prev = page > 1
    start = (page - 1) * PAGE_SIZE
    end = page * PAGE_SIZE
    if end > data_length:
        end = data_length
    nt = None
    prev = None
    if has_next:
        nt = "/%s/%d" % (path, page + 1)
        if path == '':
            nt = "/%d" % (page + 1)
    if has_prev:
        prev = "/%s/%d" % (path, page - 1)
        if path == '':
            prev = "/%d" % (page - 1)
        if page == 2:
            prev = "/%s" % path
    return {
        "start": start,
        "end": end,
        "has_next": has_next,
        "has_prev": has_prev,
        "next": nt,
        "prev": prev,
        "pages": pages,
        "page": page
    }

def sort_by_date(posts):
    posts.sort(key=lambda post: post["date"])
    posts.reverse()
    return posts


text:
<?xml version="1.0" encoding="UTF-8"?>

<rootTag>
  <Award>
    <AwardTitle>Finescale Dynamics of the Double-Diffusive Thermocline</AwardTitle>
    <AwardEffectiveDate>09/15/2013</AwardEffectiveDate>
    <AwardExpirationDate>09/30/2017</AwardExpirationDate>
    <AwardAmount>432056</AwardAmount>
    <AwardInstrument>
      <Value>Interagency Agreement</Value>
    </AwardInstrument>
    <Organization>
      06040300
      <Directorate>
        <LongName>Directorate For Geosciences</LongName>
      </Directorate>
      <Division>
        <LongName>Division Of Ocean Sciences</LongName>
      </Division>
    </Organization>
    <ProgramOfficer>
      <SignBlockName>Eric C. Itsweire</SignBlockName>
    </ProgramOfficer>
    <AbstractNarration/>
    <MinAmdLetterDate>08/14/2013</MinAmdLetterDate>
    <MaxAmdLetterDate>08/14/2013</MaxAmdLetterDate>
    <ARRAAmount/>
    <AwardID>1334914</AwardID>
    <Investigator>
      <FirstName>Timour</FirstName>
      <LastName>Radko</LastName>
      <EmailAddress>tradko@nps.edu</EmailAddress>
      <StartDate>08/14/2013</StartDate>
      <EndDate/>
      <RoleCode>Principal Investigator</RoleCode>
    </Investigator>
    <Institution>
      <Name>Naval Postgraduate School</Name>
      <CityName>Monterey</CityName>
      <ZipCode>939435000</ZipCode>
      <PhoneNumber>8316562271</PhoneNumber>
      <StreetAddress>1 University Circle</StreetAddress>
      <CountryName>United States</CountryName>
      <StateName>California</StateName>
      <StateCode>CA</StateCode>
    </Institution>
    <ProgramElement>
      1610
      <Text>PHYSICAL OCEANOGRAPHY</Text>
    </ProgramElement>
  </Award>
</rootTag>


text:
<!--
  #%L
  %%
  Copyright (C) 2018 BMW Car IT GmbH
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>io.joynr.tests</groupId>
	<artifactId>graceful-shutdown-test</artifactId>
	<name>${project.groupId}:${project.artifactId}</name>
	<packaging>pom</packaging>

	<parent>
		<groupId>io.joynr</groupId>
		<artifactId>tests</artifactId>
		<version>1.21.6</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<modules>
		<module>graceful-shutdown-test-api</module>
		<module>graceful-shutdown-test-consumer</module>
		<module>graceful-shutdown-test-provider</module>
		<module>graceful-shutdown-test-second-level-provider</module>
	</modules>

	<properties>
		<payaramicro.maven.plugin.version>1.3.0</payaramicro.maven.plugin.version>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
	</properties>

	<dependencyManagement>

		<dependencies>

			<dependency>
				<groupId>io.joynr.java</groupId>
				<artifactId>jeeintegration</artifactId>
				<version>${project.version}</version>
			</dependency>
			<dependency>
				<groupId>io.joynr.java.messaging.mqtt</groupId>
				<artifactId>hivemq-mqtt-client</artifactId>
				<version>${project.version}</version>
			</dependency>
		</dependencies>

	</dependencyManagement>

</project>


text:
'use strict';

var Primus = require('../../')
  , http = require('http')
  , spdy = require('spdy')
  , argh = require('argh')
  , path = require('path')
  , fs = require('fs');

//
// Create a server where we will connect from.
//
http.createServer(function handle(req, res) {
  if (~req.url.indexOf('primus')) throw new Error('No Primus requests should be served');

  res.setHeader('Content-Type', 'text/html');
  fs.createReadStream(__dirname +'/index.html').pipe(res);
}).listen(5000);

//
// Create the HTTPS server where we can attach our primus server on.
//
var server = spdy.createServer({
  key: fs.readFileSync(path.join(__dirname, '../../test/ssl/server.key')),
  cert: fs.readFileSync(path.join(__dirname, '../../test/ssl/server.crt')),
  windowSize: 1024 * 1024,
  autoSpdy31: false
}, function handle(req, res) {
  res.setHeader('Content-Type', 'text/html');
  fs.createReadStream(__dirname +'/index.html').pipe(res);
});

//
// Attach the primus server on spdy server.
//
var primus = new Primus(server, {
  transformer: argh.argv.transformer || 'engine.io',
  parser: argh.argv.parser || 'JSON'
});

primus.on('connection', function connection(spark) {
  console.log(spark.id, ' has connected');

  spark.on('data', function data(msg) {
    console.log(spark.id, ' send: ', msg);
  });

  spark.on('end', function end() {
    console.log(spark.id, ' has disconnected');
  });
});

server.listen(443, function connected() {
  console.log('original server listening on https://localhost:443');
  console.log('proxy server listening on http://localhost:5000');
});