text:
// Copyright 2018 Google LLC
//
// 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 com.google.location.suplclient.asn1.supl2.rrlp_components;

// Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//
//
import com.google.location.suplclient.asn1.base.Asn1Integer;
import com.google.location.suplclient.asn1.base.Asn1Object;
import com.google.location.suplclient.asn1.base.Asn1Sequence;
import com.google.location.suplclient.asn1.base.Asn1Tag;
import com.google.location.suplclient.asn1.base.BitStream;
import com.google.location.suplclient.asn1.base.BitStreamReader;
import com.google.location.suplclient.asn1.base.SequenceComponent;
import com.google.common.collect.ImmutableList;
import java.util.Collection;
import javax.annotation.Nullable;

/**
*
*/
public  class BDSClockModel_r12 extends Asn1Sequence {
  //

  private static final Asn1Tag TAG_BDSClockModel_r12
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public BDSClockModel_r12() {
    super();
  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_BDSClockModel_r12;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_BDSClockModel_r12 != null) {
      return ImmutableList.of(TAG_BDSClockModel_r12);
    } else {
      return Asn1Sequence.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new BDSClockModel_r12 from encoded stream.
   */
  public static BDSClockModel_r12 fromPerUnaligned(byte[] encodedBytes) {
    BDSClockModel_r12 result = new BDSClockModel_r12();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new BDSClockModel_r12 from encoded stream.
   */
  public static BDSClockModel_r12 fromPerAligned(byte[] encodedBytes) {
    BDSClockModel_r12 result = new BDSClockModel_r12();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override protected boolean isExtensible() {
    return false;
  }

  @Override public boolean containsExtensionValues() {
    for (SequenceComponent extensionComponent : getExtensionComponents()) {
      if (extensionComponent.isExplicitlySet()) return true;
    }
    return false;
  }

  private BDSClockModel_r12.bdsAODC_r12Type bdsAODC_r12_;
  public BDSClockModel_r12.bdsAODC_r12Type getBdsAODC_r12() {
    return bdsAODC_r12_;
  }
  /**
   * @throws ClassCastException if value is not a BDSClockModel_r12.bdsAODC_r12Type
   */
  public void setBdsAODC_r12(Asn1Object value) {
    this.bdsAODC_r12_ = (BDSClockModel_r12.bdsAODC_r12Type) value;
  }
  public BDSClockModel_r12.bdsAODC_r12Type setBdsAODC_r12ToNewInstance() {
    bdsAODC_r12_ = new BDSClockModel_r12.bdsAODC_r12Type();
    return bdsAODC_r12_;
  }

  private BDSClockModel_r12.bdsToc_r12Type bdsToc_r12_;
  public BDSClockModel_r12.bdsToc_r12Type getBdsToc_r12() {
    return bdsToc_r12_;
  }
  /**
   * @throws ClassCastException if value is not a BDSClockModel_r12.bdsToc_r12Type
   */
  public void setBdsToc_r12(Asn1Object value) {
    this.bdsToc_r12_ = (BDSClockModel_r12.bdsToc_r12Type) value;
  }
  public BDSClockModel_r12.bdsToc_r12Type setBdsToc_r12ToNewInstance() {
    bdsToc_r12_ = new BDSClockModel_r12.bdsToc_r12Type();
    return bdsToc_r12_;
  }

  private BDSClockModel_r12.bdsA0_r12Type bdsA0_r12_;
  public BDSClockModel_r12.bdsA0_r12Type getBdsA0_r12() {
    return bdsA0_r12_;
  }
  /**
   * @throws ClassCastException if value is not a BDSClockModel_r12.bdsA0_r12Type
   */
  public void setBdsA0_r12(Asn1Object value) {
    this.bdsA0_r12_ = (BDSClockModel_r12.bdsA0_r12Type) value;
  }
  public BDSClockModel_r12.bdsA0_r12Type setBdsA0_r12ToNewInstance() {
    bdsA0_r12_ = new BDSClockModel_r12.bdsA0_r12Type();
    return bdsA0_r12_;
  }

  private BDSClockModel_r12.bdsA1_r12Type bdsA1_r12_;
  public BDSClockModel_r12.bdsA1_r12Type getBdsA1_r12() {
    return bdsA1_r12_;
  }
  /**
   * @throws ClassCastException if value is not a BDSClockModel_r12.bdsA1_r12Type
   */
  public void setBdsA1_r12(Asn1Object value) {
    this.bdsA1_r12_ = (BDSClockModel_r12.bdsA1_r12Type) value;
  }
  public BDSClockModel_r12.bdsA1_r12Type setBdsA1_r12ToNewInstance() {
    bdsA1_r12_ = new BDSClockModel_r12.bdsA1_r12Type();
    return bdsA1_r12_;
  }

  private BDSClockModel_r12.bdsA2_r12Type bdsA2_r12_;
  public BDSClockModel_r12.bdsA2_r12Type getBdsA2_r12() {
    return bdsA2_r12_;
  }
  /**
   * @throws ClassCastException if value is not a BDSClockModel_r12.bdsA2_r12Type
   */
  public void setBdsA2_r12(Asn1Object value) {
    this.bdsA2_r12_ = (BDSClockModel_r12.bdsA2_r12Type) value;
  }
  public BDSClockModel_r12.bdsA2_r12Type setBdsA2_r12ToNewInstance() {
    bdsA2_r12_ = new BDSClockModel_r12.bdsA2_r12Type();
    return bdsA2_r12_;
  }

  private BDSClockModel_r12.bdsTgd1_r12Type bdsTgd1_r12_;
  public BDSClockModel_r12.bdsTgd1_r12Type getBdsTgd1_r12() {
    return bdsTgd1_r12_;
  }
  /**
   * @throws ClassCastException if value is not a BDSClockModel_r12.bdsTgd1_r12Type
   */
  public void setBdsTgd1_r12(Asn1Object value) {
    this.bdsTgd1_r12_ = (BDSClockModel_r12.bdsTgd1_r12Type) value;
  }
  public BDSClockModel_r12.bdsTgd1_r12Type setBdsTgd1_r12ToNewInstance() {
    bdsTgd1_r12_ = new BDSClockModel_r12.bdsTgd1_r12Type();
    return bdsTgd1_r12_;
  }

  @Override public Iterable<? extends SequenceComponent> getComponents() {
    ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();

    builder.add(new SequenceComponent() {
          Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);

          @Override public boolean isExplicitlySet() {
            return getBdsAODC_r12() != null;
          }

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

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

          @Override public Asn1Object getComponentValue() {
            return getBdsAODC_r12();
          }

          @Override public void setToNewInstance() {
            setBdsAODC_r12ToNewInstance();
          }

          @Override public Collection<Asn1Tag> getPossibleFirstTags() {
            return tag == null ? BDSClockModel_r12.bdsAODC_r12Type.getPossibleFirstTags() : ImmutableList.of(tag);
          }

          @Override
          public Asn1Tag getTag() {
            return tag;
          }

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

          @Override public String toIndentedString(String indent) {
                return "bdsAODC_r12 : "
                    + getBdsAODC_r12().toIndentedString(indent);
              }
        });

    builder.add(new SequenceComponent() {
          Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);

          @Override public boolean isExplicitlySet() {
            return getBdsToc_r12() != null;
          }

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

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

          @Override public Asn1Object getComponentValue() {
            return getBdsToc_r12();
          }

          @Override public void setToNewInstance() {
            setBdsToc_r12ToNewInstance();
          }

          @Override public Collection<Asn1Tag> getPossibleFirstTags() {
            return tag == null ? BDSClockModel_r12.bdsToc_r12Type.getPossibleFirstTags() : ImmutableList.of(tag);
          }

          @Override
          public Asn1Tag getTag() {
            return tag;
          }

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

          @Override public String toIndentedString(String indent) {
                return "bdsToc_r12 : "
                    + getBdsToc_r12().toIndentedString(indent);
              }
        });

    builder.add(new SequenceComponent() {
          Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2);

          @Override public boolean isExplicitlySet() {
            return getBdsA0_r12() != null;
          }

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

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

          @Override public Asn1Object getComponentValue() {
            return getBdsA0_r12();
          }

          @Override public void setToNewInstance() {
            setBdsA0_r12ToNewInstance();
          }

          @Override public Collection<Asn1Tag> getPossibleFirstTags() {
            return tag == null ? BDSClockModel_r12.bdsA0_r12Type.getPossibleFirstTags() : ImmutableList.of(tag);
          }

          @Override
          public Asn1Tag getTag() {
            return tag;
          }

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

          @Override public String toIndentedString(String indent) {
                return "bdsA0_r12 : "
                    + getBdsA0_r12().toIndentedString(indent);
              }
        });

    builder.add(new SequenceComponent() {
          Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3);

          @Override public boolean isExplicitlySet() {
            return getBdsA1_r12() != null;
          }

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

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

          @Override public Asn1Object getComponentValue() {
            return getBdsA1_r12();
          }

          @Override public void setToNewInstance() {
            setBdsA1_r12ToNewInstance();
          }

          @Override public Collection<Asn1Tag> getPossibleFirstTags() {
            return tag == null ? BDSClockModel_r12.bdsA1_r12Type.getPossibleFirstTags() : ImmutableList.of(tag);
          }

          @Override
          public Asn1Tag getTag() {
            return tag;
          }

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

          @Override public String toIndentedString(String indent) {
                return "bdsA1_r12 : "
                    + getBdsA1_r12().toIndentedString(indent);
              }
        });

    builder.add(new SequenceComponent() {
          Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 4);

          @Override public boolean isExplicitlySet() {
            return getBdsA2_r12() != null;
          }

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

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

          @Override public Asn1Object getComponentValue() {
            return getBdsA2_r12();
          }

          @Override public void setToNewInstance() {
            setBdsA2_r12ToNewInstance();
          }

          @Override public Collection<Asn1Tag> getPossibleFirstTags() {
            return tag == null ? BDSClockModel_r12.bdsA2_r12Type.getPossibleFirstTags() : ImmutableList.of(tag);
          }

          @Override
          public Asn1Tag getTag() {
            return tag;
          }

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

          @Override public String toIndentedString(String indent) {
                return "bdsA2_r12 : "
                    + getBdsA2_r12().toIndentedString(indent);
              }
        });

    builder.add(new SequenceComponent() {
          Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 5);

          @Override public boolean isExplicitlySet() {
            return getBdsTgd1_r12() != null;
          }

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

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

          @Override public Asn1Object getComponentValue() {
            return getBdsTgd1_r12();
          }

          @Override public void setToNewInstance() {
            setBdsTgd1_r12ToNewInstance();
          }

          @Override public Collection<Asn1Tag> getPossibleFirstTags() {
            return tag == null ? BDSClockModel_r12.bdsTgd1_r12Type.getPossibleFirstTags() : ImmutableList.of(tag);
          }

          @Override
          public Asn1Tag getTag() {
            return tag;
          }

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

          @Override public String toIndentedString(String indent) {
                return "bdsTgd1_r12 : "
                    + getBdsTgd1_r12().toIndentedString(indent);
              }
        });

    return builder.build();
  }

  @Override public Iterable<? extends SequenceComponent>
                                                    getExtensionComponents() {
    ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();

      return builder.build();
    }

  // Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//

/**
 *
 */
public static class bdsAODC_r12Type extends Asn1Integer {
  //

  private static final Asn1Tag TAG_bdsAODC_r12Type
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public bdsAODC_r12Type() {
    super();
    setValueRange(new java.math.BigInteger("0"), new java.math.BigInteger("31"));

  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_bdsAODC_r12Type;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_bdsAODC_r12Type != null) {
      return ImmutableList.of(TAG_bdsAODC_r12Type);
    } else {
      return Asn1Integer.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new bdsAODC_r12Type from encoded stream.
   */
  public static bdsAODC_r12Type fromPerUnaligned(byte[] encodedBytes) {
    bdsAODC_r12Type result = new bdsAODC_r12Type();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new bdsAODC_r12Type from encoded stream.
   */
  public static bdsAODC_r12Type fromPerAligned(byte[] encodedBytes) {
    bdsAODC_r12Type result = new bdsAODC_r12Type();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    return "bdsAODC_r12Type = " + getInteger() + ";\n";
  }
}

  // Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//

/**
 *
 */
public static class bdsToc_r12Type extends Asn1Integer {
  //

  private static final Asn1Tag TAG_bdsToc_r12Type
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public bdsToc_r12Type() {
    super();
    setValueRange(new java.math.BigInteger("0"), new java.math.BigInteger("131071"));

  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_bdsToc_r12Type;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_bdsToc_r12Type != null) {
      return ImmutableList.of(TAG_bdsToc_r12Type);
    } else {
      return Asn1Integer.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new bdsToc_r12Type from encoded stream.
   */
  public static bdsToc_r12Type fromPerUnaligned(byte[] encodedBytes) {
    bdsToc_r12Type result = new bdsToc_r12Type();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new bdsToc_r12Type from encoded stream.
   */
  public static bdsToc_r12Type fromPerAligned(byte[] encodedBytes) {
    bdsToc_r12Type result = new bdsToc_r12Type();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    return "bdsToc_r12Type = " + getInteger() + ";\n";
  }
}

  // Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//

/**
 *
 */
public static class bdsA0_r12Type extends Asn1Integer {
  //

  private static final Asn1Tag TAG_bdsA0_r12Type
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public bdsA0_r12Type() {
    super();
    setValueRange(new java.math.BigInteger("-8388608"), new java.math.BigInteger("8388607"));

  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_bdsA0_r12Type;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_bdsA0_r12Type != null) {
      return ImmutableList.of(TAG_bdsA0_r12Type);
    } else {
      return Asn1Integer.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new bdsA0_r12Type from encoded stream.
   */
  public static bdsA0_r12Type fromPerUnaligned(byte[] encodedBytes) {
    bdsA0_r12Type result = new bdsA0_r12Type();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new bdsA0_r12Type from encoded stream.
   */
  public static bdsA0_r12Type fromPerAligned(byte[] encodedBytes) {
    bdsA0_r12Type result = new bdsA0_r12Type();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    return "bdsA0_r12Type = " + getInteger() + ";\n";
  }
}

  // Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//

/**
 *
 */
public static class bdsA1_r12Type extends Asn1Integer {
  //

  private static final Asn1Tag TAG_bdsA1_r12Type
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public bdsA1_r12Type() {
    super();
    setValueRange(new java.math.BigInteger("-2097152"), new java.math.BigInteger("2097151"));

  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_bdsA1_r12Type;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_bdsA1_r12Type != null) {
      return ImmutableList.of(TAG_bdsA1_r12Type);
    } else {
      return Asn1Integer.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new bdsA1_r12Type from encoded stream.
   */
  public static bdsA1_r12Type fromPerUnaligned(byte[] encodedBytes) {
    bdsA1_r12Type result = new bdsA1_r12Type();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new bdsA1_r12Type from encoded stream.
   */
  public static bdsA1_r12Type fromPerAligned(byte[] encodedBytes) {
    bdsA1_r12Type result = new bdsA1_r12Type();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    return "bdsA1_r12Type = " + getInteger() + ";\n";
  }
}

  // Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//

/**
 *
 */
public static class bdsA2_r12Type extends Asn1Integer {
  //

  private static final Asn1Tag TAG_bdsA2_r12Type
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public bdsA2_r12Type() {
    super();
    setValueRange(new java.math.BigInteger("-1024"), new java.math.BigInteger("1023"));

  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_bdsA2_r12Type;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_bdsA2_r12Type != null) {
      return ImmutableList.of(TAG_bdsA2_r12Type);
    } else {
      return Asn1Integer.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new bdsA2_r12Type from encoded stream.
   */
  public static bdsA2_r12Type fromPerUnaligned(byte[] encodedBytes) {
    bdsA2_r12Type result = new bdsA2_r12Type();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new bdsA2_r12Type from encoded stream.
   */
  public static bdsA2_r12Type fromPerAligned(byte[] encodedBytes) {
    bdsA2_r12Type result = new bdsA2_r12Type();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    return "bdsA2_r12Type = " + getInteger() + ";\n";
  }
}

  // Copyright 2008 Google Inc. All Rights Reserved.
/*
 * This class is AUTOMATICALLY GENERATED. Do NOT EDIT.
 */

//

/**
 *
 */
public static class bdsTgd1_r12Type extends Asn1Integer {
  //

  private static final Asn1Tag TAG_bdsTgd1_r12Type
      = Asn1Tag.fromClassAndNumber(-1, -1);

  public bdsTgd1_r12Type() {
    super();
    setValueRange(new java.math.BigInteger("-512"), new java.math.BigInteger("511"));

  }

  @Override
  @Nullable
  protected Asn1Tag getTag() {
    return TAG_bdsTgd1_r12Type;
  }

  @Override
  protected boolean isTagImplicit() {
    return true;
  }

  public static Collection<Asn1Tag> getPossibleFirstTags() {
    if (TAG_bdsTgd1_r12Type != null) {
      return ImmutableList.of(TAG_bdsTgd1_r12Type);
    } else {
      return Asn1Integer.getPossibleFirstTags();
    }
  }

  /**
   * Creates a new bdsTgd1_r12Type from encoded stream.
   */
  public static bdsTgd1_r12Type fromPerUnaligned(byte[] encodedBytes) {
    bdsTgd1_r12Type result = new bdsTgd1_r12Type();
    result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    return result;
  }

  /**
   * Creates a new bdsTgd1_r12Type from encoded stream.
   */
  public static bdsTgd1_r12Type fromPerAligned(byte[] encodedBytes) {
    bdsTgd1_r12Type result = new bdsTgd1_r12Type();
    result.decodePerAligned(new BitStreamReader(encodedBytes));
    return result;
  }

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    return "bdsTgd1_r12Type = " + getInteger() + ";\n";
  }
}

  @Override public Iterable<BitStream> encodePerUnaligned() {
    return super.encodePerUnaligned();
  }

  @Override public Iterable<BitStream> encodePerAligned() {
    return super.encodePerAligned();
  }

  @Override public void decodePerUnaligned(BitStreamReader reader) {
    super.decodePerUnaligned(reader);
  }

  @Override public void decodePerAligned(BitStreamReader reader) {
    super.decodePerAligned(reader);
  }

  @Override public String toString() {
    return toIndentedString("");
  }

  public String toIndentedString(String indent) {
    StringBuilder builder = new StringBuilder();
    builder.append("BDSClockModel_r12 = {\n");
    final String internalIndent = indent + "  ";
    for (SequenceComponent component : getComponents()) {
      if (component.isExplicitlySet()) {
        builder.append(internalIndent)
            .append(component.toIndentedString(internalIndent));
      }
    }
    if (isExtensible()) {
      builder.append(internalIndent).append("...\n");
      for (SequenceComponent component : getExtensionComponents()) {
        if (component.isExplicitlySet()) {
          builder.append(internalIndent)
              .append(component.toIndentedString(internalIndent));
        }
      }
    }
    builder.append(indent).append("};\n");
    return builder.toString();
  }
}


text:
import bottle

app = bottle.Bottle()

@app.route('/<filename:path>')
def hive_js(filename):
    '''
    Allows access to any file in the static directory
    '''
    return bottle.static_file(filename, root="static")

##################################################
# Settings & Stratup
##################################################
app_settings = {
    'debug': True,

    'host': 'localhost',
    'port': 7070,

    'quiet': True,
}

from optparse import OptionParser
app_parser = OptionParser(usage="usage: %prog [host] [options]")
app_parser.add_option(
    "-p", "--port",
    dest="port",
)
app_parser.add_option(
    "-v", "--debug", "--verbose",
    dest="debug",
    action="store_true",
)
app_parser.add_option(
    "-q", "--quiet",
    dest="debug",
    action="store_false",
)

def parse_options():
    '''
    Reads any commandline options, returning a final dict of options
    '''
    (options, args) = app_parser.parse_args()

    if len(args) > 1:
        app_parser.error("Too many arguments")
    elif len(args) == 1:
        app_settings['host'] = args[0]

    # Remove any unset options, using the defaults defined earlier instead
    options = vars(options)
    options = dict((key, options[key]) for key in options if options[key] is not None)

    return options

if __name__ == '__main__':
    app_settings.update(parse_options())

    # Debug only settings go here
    if app_settings["debug"]:
        bottle.debug(True)
        app_settings.update({
            'reloader': True,
            'quiet': False,
        })

    app.run(**app_settings)

redpajama_set_name: RedPajamaGithub


text:
This image makes it easy to custom build your own Sentry instance by copying in a custom `config.yml` and/or `sentry.conf.py` file and installing plugins from `requirements.txt`.

It's also possible to develop custom extensions within your `onbuild` package. If the build directory contains a `setup.py` file, this will also get installed.

See the [official Sentry documentation](https://docs.getsentry.com/on-premise/server/installation/) for more information.

To create your custom `sentry:onbuild` package, simply do the following:

1.	Create a Dockerfile containing `FROM sentry:onbuild`
2.	In the same directory, add your custom configuration files.
3.	You can get copies of those files to use as templates from the [docker-sentry GitHub repo](https://github.com/getsentry/docker-sentry/).
4.	Build your image: `docker build -t mysentry .`
5.	Run your custom image using `mysentry` instead of `sentry`.


text:
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticleTagTable extends Migration
{
	public function up () {
		Schema::create('article_tag', function (Blueprint $table) {
			$table->increments('id');
			$table->unsignedInteger('tag_id');
			$table->unsignedInteger('article_id');
		});
	}

	public function down () {
		Schema::dropIfExists('article_tag');
	}
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="editor" content="brix.io">

	<link rel="stylesheet" type="text/css" href="http://angular-ui.github.com/ng-grid/css/ng-grid.css" />
	<link rel="stylesheet" type="text/css" href="../css/style.css" />

	<title>Cadastro Produto Comercial</title>

	<link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
	<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap-theme.min.css" rel="stylesheet" >

	<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet">

	<link href="http://angular-ui.github.com/ng-grid/css/ng-grid.css" rel="stylesheet" type="text/css" />

	<link href="../css/style.css" rel="stylesheet">

Cadastros Gerais

Produto Comercial

Cria Produto Comercial

Produto Comercial "Em Desenvolvimento"

&nbspPorto Seguro

&nbspPatrimoniais

&nbspCompreensivo Condomínio

&nbspCondomínio Ver

&nbspCondomínio Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspResidencial Patrimoniais

&nbspResidência Habitual Ver

&nbspHabitual Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspApartamento Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspPremium Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspAcordos Especiais Ver

&nbspAcordos Especiais Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspVeraneio Ver

&nbspVeraneio Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspResidencial Simplificado Ver

&nbspSimplificado Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspCompreensivo Empresarial

&nbspPorto Empresas Ver

&nbspPorto Empresa Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspPorto Imobiliária Empresa Ver

Objeto do Risco

Coberturas

Claúsulas

&nbspAcordos Especiais Ver

Objeto do Risco

Coberturas

Claúsulas

Produto Comercial

								  <button type="button" class="btn btn-default">Versionar</button>

									<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
									  Versão 3 - Atual

									</button>

Versão 2

Versão 1

Listar Versões

						<form class="form-horizontal">
						<fieldset disabled>

							Empresa

							<select class="form-control" id="selectEmpresa" >
								<option>Porto Seguro</option>
							</select>

							Grupo Comercial

								<select class="form-control" id="selectGrupo" placeholder="Seleção do Ramo">
									<option>Lista de Valores</option>
								</select>

							Ramo

								<select class="form-control" id="selectRamo" placeholder="Seleção do Ramo">
									<option>Lista de Valores</option>
								</select>

							Modalidade

								<select class="form-control" id="selectModalidade" placeholder="Seleção da Modalidade">
									<option>Lista de Valores</option>
								</select>

							Descrição resumida

								<input type="text" class="form-control" id="inputDescricao" placeholder="Texto Livre">

							Descrição completa

								<input type="text" class="form-control" id="inputDescricaoLonga" placeholder="Texto Livre">

							Status

								<input disabled type="text" class="form-control" id="inputDescricaoLonga" placeholder="">

							Numero da Versão

								<input disabled type="text" class="form-control" id="inputDescricaoLonga" placeholder="">

							Vigência

								Início

									<input type="date" class="form-control" id="inputRestricao" >

								Fim

									<input type="date" class="form-control" id="inputRestricao" >

							Tipo de Proponente

								<select class="form-control" id="selectProponente" placeholder="Seleção do Tipo de Proponente">
									<option>Lista de Valores</option>
								</select>

							Permite Averbação?

								  <input type="radio" name="radioPermAverbacao" id="radioPermAverbacao1" value="S"> Sim

								  <input type="radio" name="radioPermAverbacao" id="radioPermAverbacao2" value="N"> Não

							LMI Único

								  <input type="radio" name="radioLmiUnico" id="radioLmiUnico1" value="S"> Sim

								  <input type="radio" name="radioLmiUnico" id="radioLmiUnico2" value="N"> Não

							Cancelamento por parte do cliente / seguradora?

								  <input type="radio" name="radioCancTerc" id="radioCancTerc1" value="S"> Sim

								  <input type="radio" name="radioCancTerc" id="radioCancTerc2" value="N"> Não

							Permite co-seguro?

								  <input type="radio" name="radioPermCoSeguro" id="radioPermCoSeguro1" value="S"> Sim

								  <input type="radio" name="radioPermCoSeguro" id="radioPermCoSeguro2" value="N"> Não

							Prorrogação da Vigência?

								  <input type="radio" name="radioProrrogVig" id="radioProrrogVig1" value="S"> Sim

								  <input type="radio" name="radioProrrogVig" id="radioProrrogVig2" value="N"> Não

							Titulo de Capitalização?

								  <input type="radio" name="radioTituloCap" id="radioTituloCap1" value="S"> Sim

								  <input type="radio" name="radioTituloCap" id="radioTituloCap2" value="N"> Não

						  	Moeda(s) de Comercialização

								<select multiple class="form-control" id="selectMoeda" placeholder="Seleção de Moeda">
									<option>Lista de Valores</option>
								</select>

							Limite Mín. de Comissão

								<input type="text" class="form-control" id="inputLimiteMinComissao" placeholder="Texto Livre">

							Limite Máx. de Comissão

								<input type="text" class="form-control" id="inputLimiteMaxComissao" placeholder="Texto Livre">

Última atualização realizado por: Gisele Ortiz; Matricula: P000000; Data da última atualização: 30/03/2015 14:30:45

						</fieldset>
						</form>


text:
const doesNotRepeat = (string) => {
  const repeatingRegex = /(.)\1/;
  return ! repeatingRegex.test(string);
};

export default doesNotRepeat;


text:
package com.google.gwt.aria.client;
/////////////////////////////////////////////////////////
// This is auto-generated code.  Do not manually edit! //
/////////////////////////////////////////////////////////

/**
 * A type that represents the alert
 * role in the ARIA specification.
 *
 * @see Role
 * @see Roles
 */
public interface AlertRole extends RegionRole {
}


text:
local capi = {client=client,awesome=awesome}
local ewmh = require("awful.ewmh")
local tyrannical = nil

-- Use Tyrannical policies instead of the default ones
capi.client.disconnect_signal("request::activate",ewmh.activate)
capi.client.connect_signal("request::activate",function(c,reason)
    if not tyrannical then
        tyrannical = require("tyrannical")
    end
    -- Always grant those request as it probably mean that it is a modal dialog
    if c.transient_for and capi.client.focus == c.transient_for then
        capi.client.focus = c
        c:raise()
    -- If it is not modal, then use the normal code path
    elseif reason == "rule" or reason == "ewmh" then
        tyrannical.focus_client(c)
    -- Tyrannical doesn't have enough information, grant the request
    else
        capi.client.focus = c
        c:raise()
    end
end)

capi.client.disconnect_signal("request::tag", ewmh.tag)
capi.client.connect_signal("request::tag", function(c)
--     if capi.awesome.startup then
--         --TODO create a tag on that screen
--     else
--         --TODO block invalid requests, let Tyrannical do its job
--         local tags = c:tags()
--         if #tags == 0 then
--             --TODO cannot happen
--         end
--     end
end)

--lib/awful/tag.lua.in:capi.tag.connect_signal("request::select", tag.viewonly)


text:
package ab.jobs;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public class DummyJob implements Job{

	public static int count=0;

    @Override
    public void execute(JobExecutionContext jec) throws JobExecutionException {
    	count++;
    }

}


text:
<?php

use yii\helpers\Html;
use app\components\DetailView;
use app\components\ViewButton;
use common\vendor\AppLabels;

/* @var $this yii\web\View */
/* @var $model backend\models\PpaPollutionLoadDecrease */

$this->title = sprintf('%s %s', AppLabels::BTN_VIEW, AppLabels::POLLUTION_LOAD_DECREASE);
$this->params['breadcrumbs'][] = ['label' => sprintf('%s - %s', AppLabels::PPA, $model->ppa->getSummary()), 'url' => ['/ppa/update', 'id' => $model->ppa->id]];
$this->params['breadcrumbs'][] = ['label' => AppLabels::POLLUTION_LOAD_DECREASE, 'url' => ['index', 'ppaId' => $model->ppa->id]];
$this->params['subtitle'] = $model->ppapld_activity;
$this->params['breadcrumbs'][] = $this->title;
?>

            <?= Html::encode($this->title) ?>
            <?php if (isset($this->params['subtitle'])): ?>

                    <?= $this->params['subtitle']; ?>

            <?php endif; ?>

<?= AppLabels::POLLUTION_LOAD_DECREASE; ?>

            <?= DetailView::widget([
                'model' => $model,
                'options' => [
                    'excluded' => ['ppa_id'],
                    'extraAttributes' => ['attachment' => $model->attachment],
                ]
            ]); ?>

<?= AppLabels::YEAR; ?>

            <?php foreach ($model->ppaPollutionLoadDecreaseYears as $pollutionLoadDecreaseYear): ?>

                    <?= $pollutionLoadDecreaseYear->ppapldy_year; ?>

<?= $pollutionLoadDecreaseYear->ppapldy_value; ?>

            <?php endforeach; ?>

            <?= ViewButton::widget([
                'model' => $model,
                'options' => [
                    'buttons' => [
                        'create' => Html::a(' ' . AppLabels::BTN_ADD, ['create', 'ppaId' => $model->ppa_id], ['class' => 'btn btn-white btn-success btn-bold']),
                        'index' => Html::a(' ' . AppLabels::BTN_BACK, ['index', 'ppaId' => $model->ppa_id], ['class' => 'btn btn-white btn-danger btn-bold']),
                    ]
                ]
            ]); ?>


text:
DIV.uiJsonPretty-object { font-size: 1.26em; font-family: monospace; }
UL.uiJsonPretty-object,
UL.uiJsonPretty-array { margin: 0; padding: 0 0 0 2em; list-style: none; }
UL.uiJsonPretty-object LI,
UL.uiJsonPretty-array LI { padding: 0; margin: 0; }
.expando > SPAN.uiJsonPretty-name:before { content: "\25bc\a0"; color: #555; position: relative; top: 2px; }
.expando.uiJsonPretty-minimised > SPAN.uiJsonPretty-name:before { content: "\25ba\a0"; top: 0; }
.uiJsonPretty-minimised > UL SPAN.uiJsonPretty-name:before,
.expando .uiJsonPretty-minimised > UL SPAN.uiJsonPretty-name:before { content: ""; }
UL.uiJsonPretty-object LI:after,
UL.uiJsonPretty-array LI:after { content: ','; }
UL.uiJsonPretty-object LI:last-child:after,
UL.uiJsonPretty-array LI:last-child:after { content: ''; }
SPAN.uiJsonPretty-string,
SPAN.uiJsonPretty-string A { color: green; }
SPAN.uiJsonPretty-string A { text-decoration: underline;}
SPAN.uiJsonPretty-string:before { content: '"'; }
SPAN.uiJsonPretty-string:after { content: '"'; }
SPAN.uiJsonPretty-number { color: blue; }
SPAN.uiJsonPretty-null { color: red; }
SPAN.uiJsonPretty-boolean { color: purple; }
.expando > .uiJsonPretty-name { cursor: pointer; }
.expando > .uiJsonPretty-name:hover { text-decoration: underline; }
.uiJsonPretty-minimised { white-space: nowrap; overflow: hidden; }
.uiJsonPretty-minimised > UL { opacity: 0.6; }
.uiJsonPretty-minimised .uiJsonPretty-minimised > UL { opacity: 1; }
.uiJsonPretty-minimised UL, .uiJsonPretty-minimised LI { display: inline; padding: 0; }


text:
<?php

namespace Haverkamp87\CoreBundle\Twig;

use Doctrine\ORM\Tools\Pagination\Paginator;

/**
 * Class CoreExtension
 * @package Haverkamp87\CoreBundle\Twig
 */
class CoreExtension extends \Twig_Extension
{

    /**
     * Render templates with Twig Environment
     *
     * @var \Twig_Environment
     */
    protected $twig;

    /**
     * @param \Twig_Environment $twig
     */
    public function __construct(\Twig_Environment $twig)
    {
        $this->twig = $twig;
    }

    /**
     * {@inheritdoc}
     */
    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('paginate', array($this, 'paginateFunction'), array('is_safe' => array('html'))),
        );
    }

    /**
     * Render a HTML paginator based on the Doctrine Paginator
     *
     * @param Paginator $paginator
     * @return string
     */
    public function paginateFunction(Paginator $paginator)
    {
        // get query from paginator
        $query = $paginator->getQuery();

        // calculate available pages
        $availablePages = ceil($paginator->count() / $query->getMaxResults());

        // get current page from request
        $currentPage = ($query->getFirstResult() + 1);

        // determine next page
        $nextPage = ($currentPage + 1);
        if ($nextPage > $availablePages) $nextPage = false;

        // determine previous page
        $prevPage = ($currentPage - 1);
        if ($prevPage < 1) $prevPage = false;

        return $this->twig->render('@Haverkamp87Core/Twig/paginate.html.twig', array(
            'availablePages' => $availablePages,
            'currentPage' => $currentPage,
            'nextPage' => $nextPage,
            'prevPage' => $prevPage,
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'core_extention';
    }

}


text:
package com.stratio.cassandra.index.schema.mapping;

import com.stratio.cassandra.index.schema.Schema;
import org.apache.lucene.document.Field;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

public class ColumnMapperLongTest {

    @Test
    public void testValueNull() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", null);
        Assert.assertNull(parsed);
    }

    @Test
    public void testValueInteger() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3);
        Assert.assertEquals(Long.valueOf(3), parsed);
    }

    @Test
    public void testValueLong() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3l);
        Assert.assertEquals(Long.valueOf(3), parsed);
    }

    @Test
    public void testValueFloatWithoutDecimal() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3f);
        Assert.assertEquals(Long.valueOf(3), parsed);
    }

    @Test
    public void testValueFloatWithDecimalFloor() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3.5f);
        Assert.assertEquals(Long.valueOf(3), parsed);

    }

    @Test
    public void testValueFloatWithDecimalCeil() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3.6f);
        Assert.assertEquals(Long.valueOf(3), parsed);

    }

    @Test
    public void testValueDoubleWithoutDecimal() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3d);
        Assert.assertEquals(Long.valueOf(3), parsed);
    }

    @Test
    public void testValueDoubleWithDecimalFloor() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3.5d);
        Assert.assertEquals(Long.valueOf(3), parsed);

    }

    @Test
    public void testValueDoubleWithDecimalCeil() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", 3.6d);
        Assert.assertEquals(Long.valueOf(3), parsed);

    }

    @Test
    public void testValueStringWithoutDecimal() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", "3");
        Assert.assertEquals(Long.valueOf(3), parsed);
    }

    @Test
    public void testValueStringWithDecimalFloor() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", "3.2");
        Assert.assertEquals(Long.valueOf(3), parsed);

    }

    @Test
    public void testValueStringWithDecimalCeil() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Long parsed = mapper.indexValue("test", "3.2");
        Assert.assertEquals(Long.valueOf(3), parsed);

    }

    @Test
    public void testField() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        Field field = mapper.field("name", "3.2");
        Assert.assertNotNull(field);
        Assert.assertEquals(3L, field.numericValue());
        Assert.assertEquals("name", field.name());
        Assert.assertEquals(false, field.fieldType().stored());
    }

    @Test
    public void testExtractAnalyzers() {
        ColumnMapperLong mapper = new ColumnMapperLong(1f);
        String analyzer = mapper.analyzer();
        Assert.assertEquals(ColumnMapper.KEYWORD_ANALYZER, analyzer);
    }

    @Test
    public void testParseJSON() throws IOException {
        String json = "{fields:{age:{type:\"long\"}}}";
        Schema schema = Schema.fromJson(json);
        ColumnMapper columnMapper = schema.getMapper("age");
        Assert.assertNotNull(columnMapper);
        Assert.assertEquals(ColumnMapperLong.class, columnMapper.getClass());
    }

    @Test
    public void testParseJSONEmpty() throws IOException {
        String json = "{fields:{}}";
        Schema schema = Schema.fromJson(json);
        ColumnMapper columnMapper = schema.getMapper("age");
        Assert.assertNull(columnMapper);
    }

    @Test(expected = IOException.class)
    public void testParseJSONInvalid() throws IOException {
        String json = "{fields:{age:{}}";
        Schema.fromJson(json);
    }
}


text:
[CmdletBinding(SupportsShouldProcess=$true)]
param(
    [Parameter()]
    [string[]]$ComputerName = $env:COMPUTERNAME,

    [Parameter()]
    [string]$RemoveCTRXmlPath = "$env:PUBLIC\Documents\RemoveCTRConfig.xml",

    [Parameter()]
    [bool] $WaitForInstallToFinish = $true,

    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [string] $TargetFilePath = $NULL,

    [Parameter()]
    [ValidateSet("All","O365ProPlusRetail","O365BusinessRetail","VisioProRetail","ProjectProRetail", "SPDRetail", "VisioProXVolume", "VisioStdXVolume",
                 "ProjectProXVolume", "ProjectStdXVolume", "InfoPathRetail", "SkypeforBusinessEntryRetail", "LyncEntryRetail", "AccessRuntimeRetail")]
    [string[]]$C2RProductsToRemove = "All",

    [Parameter()]
    [string]$LogFilePath
)

Function Remove-OfficeClickToRun {
<#
.Synopsis
    Removes the Click to Run version of Office installed.

.DESCRIPTION
    If Office Click-to-Run is installed the administrator will be prompted to confirm
    uninstallation. A configuration file will be generated and used to remove all Office CTR
    products.

.PARAMETER ComputerName
    The computer or list of computers from which to query

.EXAMPLE
    Remove-OfficeClickToRun

Description:
    Will uninstall Office Click-to-Run.
#>
[CmdletBinding()]
Param(
    [string[]] $ComputerName = $env:COMPUTERNAME,

    [string] $RemoveCTRXmlPath = "$env:PUBLIC\Documents\RemoveCTRConfig.xml",

    [Parameter()]
    [bool] $WaitForInstallToFinish = $true,

    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [string] $TargetFilePath = $NULL,

    [Parameter()]
    [ValidateSet("All","O365ProPlusRetail","O365BusinessRetail","VisioProRetail","ProjectProRetail", "SPDRetail", "VisioProXVolume", "VisioStdXVolume",
                 "ProjectProXVolume", "ProjectStdXVolume", "InfoPathRetail", "SkypeforBusinessEntryRetail", "LyncEntryRetail", "AccessRuntimeRetail")]
    [string[]]$C2RProductsToRemove = "All",

    [Parameter()]
    [string]$LogFilePath
)

     Process{
        $currentFileName = Get-CurrentFileName
        Set-Alias -name LINENUM -value Get-CurrentLineNumber

        $scriptRoot = GetScriptRoot

        newCTRRemoveXml | Out-File $RemoveCTRXmlPath

        if($C2RProductsToRemove -ne "All"){
            foreach($product in $C2RProductsToRemove){
                #Load the xml
                [System.Xml.XmlDocument]$ConfigFile = New-Object System.Xml.XmlDocument
                $content = Get-Content $RemoveCTRXmlPath
                $ConfigFile.LoadXml($content) | Out-Null

                #Set the values
                $RemoveElement = $ConfigFile.Configuration.Remove

                $isValidProduct = (Get-ODTOfficeProductLanguages | ? {$_.DisplayName -eq $product}).DisplayName

                if($isValidProduct  -ne $NULL){
                    [System.Xml.XmlElement]$ProductElement = $ConfigFile.Configuration.Remove.Product | where {$_.ID -eq $product}
                    if($ProductElement -eq $NULL){
                        [System.Xml.XmlElement]$ProductElement = $ConfigFile.CreateElement("Product")
                        $RemoveElement.appendChild($ProductElement) | Out-Null
                        $ProductElement.SetAttribute("ID", $product) | Out-Null
                    }

                    #Add the languages
                    $LanguageIds = (Get-ODTOfficeProductLanguages -ProductId $product).Languages
                    foreach($LanguageId in $LanguageIds){
                        [System.Xml.XmlElement]$LanguageElement = $ProductElement.Language | Where {$_.ID -eq $LanguageId}
                        if($LanguageElement -eq $NULL){
                            [System.Xml.XmlElement]$LanguageElement = $ConfigFile.CreateElement("Language")
                            $ProductElement.AppendChild($LanguageElement) | Out-Null
                            $LanguageElement.SetAttribute("ID", $LanguageId) | Out-Null
                        }
                    }

                    #Save the XML file
                    $ConfigFile.Save($RemoveCTRXmlPath) | Out-Null
                    $global:saveLastFilePath = $RemoveCTRXmlPath
                }
            }

            $RemoveAllElement = $ConfigFile.Configuration.Remove.All
            if($RemoveAllElement -ne $NULL){
                $ConfigFile.Configuration.Remove.RemoveAttribute("All") | Out-Null
            }

            #Save the XML file
            $ConfigFile.Save($RemoveCTRXmlPath) | Out-Null
            $global:saveLastFilePath = $RemoveCTRXmlPath
        }

        [bool] $isInPipe = $true
        if (($PSCmdlet.MyInvocation.PipelineLength -eq 1) -or ($PSCmdlet.MyInvocation.PipelineLength -eq $PSCmdlet.MyInvocation.PipelinePosition)) {
            $isInPipe = $false
        }

        $c2rVersion = Get-OfficeVersion | Where-Object {$_.ClickToRun -eq "True" -and $_.DisplayName -match "Microsoft Office 365"}
        if ( $c2rVersion.Count -gt 0) {
            $c2rVersion =  $c2rVersion[0]
        }

        $c2rName = $c2rVersion.DisplayName

        if($c2rVersion) {
            if(!($isInPipe)) {
                Write-Host "Please wait while $c2rName is being uninstalled..."
                WriteToLogFile -LNumber $(LINENUM) -FName $currentFileName -ActionError "Please wait while $c2rName is being uninstalled..." -LogFilePath $LogFilePath
            }
        }

        if($c2rVersion.Version -like "15*"){
            $OdtExe = "$scriptRoot\Office2013Setup.exe"
        }
        else{
            $OdtExe = "$scriptRoot\Office2016Setup.exe"
        }

        $cmdLine = '"' + $OdtExe + '"'
        $cmdArgs = "/configure " + '"' + $RemoveCTRXmlPath + '"'

        StartProcess -execFilePath $cmdLine -execParams $cmdArgs -WaitForExit $true

        [bool] $c2rTest = $false
        if( Get-OfficeVersion | Where-Object {$_.ClickToRun -eq "True"} ){
            $c2rTest = $true
        }

        if($c2rVersion){
            if(!($c2rTest)){
                if (!($isInPipe)) {
                    Write-Host "Office Click-to-Run has been successfully uninstalled."
                    WriteToLogFile -LNumber $(LINENUM) -FName $currentFileName -ActionError "Office Click-to-Run has been successfully uninstalled." -LogFilePath $LogFilePath
                }
            }
        }

        if ($isInPipe) {
            $results = new-object PSObject[] 0;
            $Result = New-Object -TypeName PSObject
            Add-Member -InputObject $Result -MemberType NoteProperty -Name "TargetFilePath" -Value $TargetFilePath
            $Result
        }
    }
}

Function Get-OfficeVersion {
<#
.Synopsis
    Gets the Office Version installed on the computer

.DESCRIPTION
    This function will query the local or a remote computer and return the information about Office Products installed on the computer

.NOTES
    Name: Get-OfficeVersion
    Version: 1.0.5
    DateCreated: 2015-07-01
    DateUpdated: 2016-10-14

.LINK
    https://github.com/OfficeDev/Office-IT-Pro-Deployment-Scripts

.PARAMETER ComputerName
    The computer or list of computers from which to query

.PARAMETER ShowAllInstalledProducts
    Will expand the output to include all installed Office products

.EXAMPLE
    Get-OfficeVersion

    Will return the locally installed Office product

.EXAMPLE
    Get-OfficeVersion -ComputerName client01,client02

    Will return the installed Office product on the remote computers

.EXAMPLE
    Get-OfficeVersion | select *

    Will return the locally installed Office product with all of the available properties
#>
[CmdletBinding(SupportsShouldProcess=$true)]
param(
    [Parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true, Position=0)]
    [string[]]$ComputerName = $env:COMPUTERNAME,
    [switch]$ShowAllInstalledProducts,
    [System.Management.Automation.PSCredential]$Credentials
)

begin {
    $HKLM = [UInt32] "0x80000002"
    $HKCR = [UInt32] "0x80000000"

    $excelKeyPath = "Excel\DefaultIcon"
    $wordKeyPath = "Word\DefaultIcon"

    $installKeys = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
                   'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'

    $officeKeys = 'SOFTWARE\Microsoft\Office',
                  'SOFTWARE\Wow6432Node\Microsoft\Office'

    $defaultDisplaySet = 'DisplayName','Version', 'ComputerName'

    $defaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$defaultDisplaySet)
    $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($defaultDisplayPropertySet)
}

process {

 $results = new-object PSObject[] 0;
 $MSexceptionList = "mui","visio","project","proofing","visual"

 foreach ($computer in $ComputerName) {
    if ($Credentials) {
       $os=Get-WMIObject win32_operatingsystem -computername $computer -Credential $Credentials
    } else {
       $os=Get-WMIObject win32_operatingsystem -computername $computer
    }

    $osArchitecture = $os.OSArchitecture

    if ($Credentials) {
       $regProv = Get-Wmiobject -list "StdRegProv" -namespace root\default -computername $computer -Credential $Credentials
    } else {
       $regProv = Get-Wmiobject -list "StdRegProv" -namespace root\default -computername $computer
    }

    [System.Collections.ArrayList]$VersionList = New-Object -TypeName System.Collections.ArrayList
    [System.Collections.ArrayList]$PathList = New-Object -TypeName System.Collections.ArrayList
    [System.Collections.ArrayList]$PackageList = New-Object -TypeName System.Collections.ArrayList
    [System.Collections.ArrayList]$ClickToRunPathList = New-Object -TypeName System.Collections.ArrayList
    [System.Collections.ArrayList]$ConfigItemList = New-Object -TypeName  System.Collections.ArrayList
    $ClickToRunList = new-object PSObject[] 0;

    foreach ($regKey in $officeKeys) {
       $officeVersion = $regProv.EnumKey($HKLM, $regKey)
       foreach ($key in $officeVersion.sNames) {
          if ($key -match "\d{2}\.\d") {
            if (!$VersionList.Contains($key)) {
              $AddItem = $VersionList.Add($key)
            }

            $path = join-path $regKey $key

            $configPath = join-path $path "Common\Config"
            $configItems = $regProv.EnumKey($HKLM, $configPath)
            if ($configItems) {
               foreach ($configId in $configItems.sNames) {
                 if ($configId) {
                    $Add = $ConfigItemList.Add($configId.ToUpper())
                 }
               }
            }

            $cltr = New-Object -TypeName PSObject
            $cltr | Add-Member -MemberType NoteProperty -Name InstallPath -Value ""
            $cltr | Add-Member -MemberType NoteProperty -Name UpdatesEnabled -Value $false
            $cltr | Add-Member -MemberType NoteProperty -Name UpdateUrl -Value ""
            $cltr | Add-Member -MemberType NoteProperty -Name StreamingFinished -Value $false
            $cltr | Add-Member -MemberType NoteProperty -Name Platform -Value ""
            $cltr | Add-Member -MemberType NoteProperty -Name ClientCulture -Value ""

            $packagePath = join-path $path "Common\InstalledPackages"
            $clickToRunPath = join-path $path "ClickToRun\Configuration"
            $virtualInstallPath = $regProv.GetStringValue($HKLM, $clickToRunPath, "InstallationPath").sValue

            [string]$officeLangResourcePath = join-path  $path "Common\LanguageResources"
            $mainLangId = $regProv.GetDWORDValue($HKLM, $officeLangResourcePath, "SKULanguage").uValue
            if ($mainLangId) {
                $mainlangCulture = [globalization.cultureinfo]::GetCultures("allCultures") | where {$_.LCID -eq $mainLangId}
                if ($mainlangCulture) {
                    $cltr.ClientCulture = $mainlangCulture.Name
                }
            }

            [string]$officeLangPath = join-path  $path "Common\LanguageResources\InstalledUIs"
            $langValues = $regProv.EnumValues($HKLM, $officeLangPath);
            if ($langValues) {
               foreach ($langValue in $langValues) {
                  $langCulture = [globalization.cultureinfo]::GetCultures("allCultures") | where {$_.LCID -eq $langValue}
               }
            }

            if ($virtualInstallPath) {

            } else {
              $clickToRunPath = join-path $regKey "ClickToRun\Configuration"
              $virtualInstallPath = $regProv.GetStringValue($HKLM, $clickToRunPath, "InstallationPath").sValue
            }

            if ($virtualInstallPath) {
               if (!$ClickToRunPathList.Contains($virtualInstallPath.ToUpper())) {
                  $AddItem = $ClickToRunPathList.Add($virtualInstallPath.ToUpper())
               }

               $cltr.InstallPath = $virtualInstallPath
               $cltr.StreamingFinished = $regProv.GetStringValue($HKLM, $clickToRunPath, "StreamingFinished").sValue
               $cltr.UpdatesEnabled = $regProv.GetStringValue($HKLM, $clickToRunPath, "UpdatesEnabled").sValue
               $cltr.UpdateUrl = $regProv.GetStringValue($HKLM, $clickToRunPath, "UpdateUrl").sValue
               $cltr.Platform = $regProv.GetStringValue($HKLM, $clickToRunPath, "Platform").sValue
               $cltr.ClientCulture = $regProv.GetStringValue($HKLM, $clickToRunPath, "ClientCulture").sValue
               $ClickToRunList += $cltr
            }

            $packageItems = $regProv.EnumKey($HKLM, $packagePath)
            $officeItems = $regProv.EnumKey($HKLM, $path)

            foreach ($itemKey in $officeItems.sNames) {
              $itemPath = join-path $path $itemKey
              $installRootPath = join-path $itemPath "InstallRoot"

              $filePath = $regProv.GetStringValue($HKLM, $installRootPath, "Path").sValue
              if (!$PathList.Contains($filePath)) {
                  $AddItem = $PathList.Add($filePath)
              }
            }

            foreach ($packageGuid in $packageItems.sNames) {
              $packageItemPath = join-path $packagePath $packageGuid
              $packageName = $regProv.GetStringValue($HKLM, $packageItemPath, "").sValue

              if (!$PackageList.Contains($packageName)) {
                if ($packageName) {
                   $AddItem = $PackageList.Add($packageName.Replace(' ', '').ToLower())
                }
              }
            }

          }
       }
    }

    foreach ($regKey in $installKeys) {
        $keyList = new-object System.Collections.ArrayList
        $keys = $regProv.EnumKey($HKLM, $regKey)

        foreach ($key in $keys.sNames) {
           $path = join-path $regKey $key
           $installPath = $regProv.GetStringValue($HKLM, $path, "InstallLocation").sValue
           if (!($installPath)) { continue }
           if ($installPath.Length -eq 0) { continue }

           $buildType = "64-Bit"
           if ($osArchitecture -eq "32-bit") {
              $buildType = "32-Bit"
           }

           if ($regKey.ToUpper().Contains("Wow6432Node".ToUpper())) {
              $buildType = "32-Bit"
           }

           if ($key -match "{.{8}-.{4}-.{4}-1000-0000000FF1CE}") {
              $buildType = "64-Bit"
           }

           if ($key -match "{.{8}-.{4}-.{4}-0000-0000000FF1CE}") {
              $buildType = "32-Bit"
           }

           if ($modifyPath) {
               if ($modifyPath.ToLower().Contains("platform=x86")) {
                  $buildType = "32-Bit"
               }

               if ($modifyPath.ToLower().Contains("platform=x64")) {
                  $buildType = "64-Bit"
               }
           }

           $primaryOfficeProduct = $false
           $officeProduct = $false
           foreach ($officeInstallPath in $PathList) {
             if ($officeInstallPath) {
                try{
                $installReg = "^" + $installPath.Replace('\', '\\')
                $installReg = $installReg.Replace('(', '\(')
                $installReg = $installReg.Replace(')', '\)')
                if ($officeInstallPath -match $installReg) { $officeProduct = $true }
                } catch {}
             }
           }

           if (!$officeProduct) { continue };

           $name = $regProv.GetStringValue($HKLM, $path, "DisplayName").sValue

           $primaryOfficeProduct = $true
           if ($ConfigItemList.Contains($key.ToUpper()) -and $name.ToUpper().Contains("MICROSOFT OFFICE")) {
              foreach($exception in $MSexceptionList){
                 if($name.ToLower() -match $exception.ToLower()){
                    $primaryOfficeProduct = $false
                 }
              }
           } else {
              $primaryOfficeProduct = $false
           }

           $clickToRunComponent = $regProv.GetDWORDValue($HKLM, $path, "ClickToRunComponent").uValue
           $uninstallString = $regProv.GetStringValue($HKLM, $path, "UninstallString").sValue
           if (!($clickToRunComponent)) {
              if ($uninstallString) {
                 if ($uninstallString.Contains("OfficeClickToRun")) {
                     $clickToRunComponent = $true
                 }
              }
           }

           $modifyPath = $regProv.GetStringValue($HKLM, $path, "ModifyPath").sValue
           $version = $regProv.GetStringValue($HKLM, $path, "DisplayVersion").sValue

           $cltrUpdatedEnabled = $NULL
           $cltrUpdateUrl = $NULL
           $clientCulture = $NULL;

           [string]$clickToRun = $false

           if ($clickToRunComponent) {
               $clickToRun = $true
               if ($name.ToUpper().Contains("MICROSOFT OFFICE")) {
                  $primaryOfficeProduct = $true
               }

               foreach ($cltr in $ClickToRunList) {
                 if ($cltr.InstallPath) {
                   if ($cltr.InstallPath.ToUpper() -eq $installPath.ToUpper()) {
                       $cltrUpdatedEnabled = $cltr.UpdatesEnabled
                       $cltrUpdateUrl = $cltr.UpdateUrl
                       if ($cltr.Platform -eq 'x64') {
                           $buildType = "64-Bit"
                       }
                       if ($cltr.Platform -eq 'x86') {
                           $buildType = "32-Bit"
                       }
                       $clientCulture = $cltr.ClientCulture
                   }
                 }
               }
           }

           if (!$primaryOfficeProduct) {
              if (!$ShowAllInstalledProducts) {
                  continue
              }
           }

           $object = New-Object PSObject -Property @{DisplayName = $name; Version = $version; InstallPath = $installPath; ClickToRun = $clickToRun;
                     Bitness=$buildType; ComputerName=$computer; ClickToRunUpdatesEnabled=$cltrUpdatedEnabled; ClickToRunUpdateUrl=$cltrUpdateUrl;
                     ClientCulture=$clientCulture }
           $object | Add-Member MemberSet PSStandardMembers $PSStandardMembers
           $results += $object

        }
    }
  }

  $results = Get-Unique -InputObject $results

  return $results;
}

}

Function newCTRRemoveXml {
#Create a xml configuration file to remove all Office CTR products.
@"
<Configuration>
  <Remove All="True">
  </Remove>
  <Display Level="None" AcceptEULA="TRUE" />
  <Property Name="FORCEAPPSHUTDOWN" Value="TRUE" />
</Configuration>
"@
}

function Get-ODTOfficeProductLanguages {
    Param(
        [Parameter()]
        [string]$ComputerName = $env:COMPUTERNAME,

        [Parameter()]
        [string]$ProductId
    )

    Begin {
        $defaultDisplaySet = 'DisplayName','Languages'
        $defaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$defaultDisplaySet)
        $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($defaultDisplayPropertySet)
        $results = New-Object PSObject[] 0
    }

    Process {
        $regProv = Get-Wmiobject -list "StdRegProv" -namespace root\default -ComputerName $ComputerName -ErrorAction Stop
        $officeConfig = getCTRConfig -regProv $regProv
        [System.XML.XMLDocument]$ConfigFile = New-Object System.XML.XMLDocument

        if(!$ProductId){
            $productReleaseIds = $officeConfig.ProductReleaseIds
            $splitProducts = $productReleaseIds.Split(',')
        } else {
            $splitProducts = $ProductId
        }

        foreach($product in $splitProducts){
            $officeAddLangs = odtGetOfficeLanguages -ConfigDoc $ConfigFile -OfficeKeyPath $officeConfig.OfficeKeyPath -ProductId $product

            $object = New-Object PSObject -Property @{DisplayName = $product; Languages = $officeAddLangs}
            $object | Add-Member MemberSet PSStandardMembers $PSStandardMembers
            $results += $object
        }

        return $results
    }
}

function getCTRConfig() {
    param(
       [Parameter(ValueFromPipelineByPropertyName=$true)]
       $regProv = $NULL
    )

    $HKLM = [UInt32] "0x80000002"
    $computerName = $env:COMPUTERNAME

    if (!($regProv)) {
        $regProv = Get-Wmiobject -list "StdRegProv" -namespace root\default -computername $computerName -ErrorAction Stop
    }

    $officeCTRKeys = 'SOFTWARE\Microsoft\Office\15.0\ClickToRun',
                     'SOFTWARE\Wow6432Node\Microsoft\Office\15.0\ClickToRun',
                     'SOFTWARE\Microsoft\Office\ClickToRun',
                     'SOFTWARE\Wow6432Node\Microsoft\Office\ClickToRun'

    $Object = New-Object PSObject
    $Object | Add-Member Noteproperty ClickToRunInstalled $false

    [string]$officeKeyPath = "";
    foreach ($regPath in $officeCTRKeys) {
       [string]$installPath = $regProv.GetStringValue($HKLM, $regPath, "InstallPath").sValue
       if ($installPath) {
          if ($installPath.Length -gt 0) {
              $officeKeyPath = $regPath;
              break;
          }
       }
    }

    if ($officeKeyPath.Length -gt 0) {
        $Object.ClickToRunInstalled = $true

        $configurationPath = join-path $officeKeyPath "Configuration"

        [string]$platform = $regProv.GetStringValue($HKLM, $configurationPath, "Platform").sValue
        [string]$clientCulture = $regProv.GetStringValue($HKLM, $configurationPath, "ClientCulture").sValue
        [string]$productIds = $regProv.GetStringValue($HKLM, $configurationPath, "ProductReleaseIds").sValue
        [string]$versionToReport = $regProv.GetStringValue($HKLM, $configurationPath, "VersionToReport").sValue
        [string]$updatesEnabled = $regProv.GetStringValue($HKLM, $configurationPath, "UpdatesEnabled").sValue
        [string]$updateUrl = $regProv.GetStringValue($HKLM, $configurationPath, "UpdateUrl").sValue
        [string]$updateDeadline = $regProv.GetStringValue($HKLM, $configurationPath, "UpdateDeadline").sValue

        if (!($productIds)) {
            $productIds = ""
            $officeActivePath = Join-Path $officeKeyPath "ProductReleaseIDs\Active"
            $officeProducts = $regProv.EnumKey($HKLM, $officeActivePath)

            foreach ($productName in $officeProducts.sNames) {
               if ($productName.ToLower() -eq "stream") { continue }
               if ($productName.ToLower() -eq "culture") { continue }
               if ($productIds.Length -gt 0) { $productIds += "," }
               $productIds += "$productName"
            }
        }

        $splitProducts = $productIds.Split(',');

        if ($platform.ToLower() -eq "x86") {
            $platform = "32"
        } else {
            $platform = "64"
        }

        $Object | add-member Noteproperty Platform $platform
        $Object | add-member Noteproperty ClientCulture $clientCulture
        $Object | add-member Noteproperty ProductReleaseIds $productIds
        $Object | add-member Noteproperty Version $versionToReport
        $Object | add-member Noteproperty UpdatesEnabled $updatesEnabled
        $Object | add-member Noteproperty UpdateUrl $updateUrl
        $Object | add-member Noteproperty UpdateDeadline $updateDeadline
        $Object | add-member Noteproperty OfficeKeyPath $officeKeyPath

    }

    return $Object

}

function odtGetOfficeLanguages() {
    param(
       [Parameter(ValueFromPipelineByPropertyName=$true)]
       [System.XML.XMLDocument]$ConfigDoc = $NULL,

       [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
       [string]$OfficeKeyPath = $NULL,

       [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
       [string]$ProductId = $NULL
    )

    begin {
        $HKLM = [UInt32] "0x80000002"
        $HKCR = [UInt32] "0x80000000"
    }

    process {
        [System.Collections.ArrayList]$appLanguages1 = New-Object System.Collections.ArrayList

        #SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Common\LanguageResources\InstalledUIs

        $productsPath = join-path $officeKeyPath "ProductReleaseIDs\Active\$ProductId"
        $installedCultures = $regProv.EnumKey($HKLM, $productsPath)

        foreach ($installedCulture in $installedCultures.sNames) {
        if($installedCulture){
            if ($installedCulture.Contains("-") -and !($installedCulture.ToLower() -eq "x-none")) {
                $addItem = $appLanguages1.Add($installedCulture)
            }
            }
        }

        if ($appLanguages1.Count) {
            $productsPath = join-path $officeKeyPath "ProductReleaseIDs\Active\$ProductId"
        } else {
            $productReleasePath = Join-Path $officeKeyPath "ProductReleaseIDs"
            $guids= $regProv.EnumKey($HKLM, $productReleasePath)

            foreach ($guid in $guids.sNames) {

                $productsPath = Join-Path $officeKeyPath "ProductReleaseIDs\$guid\$ProductId.16"
                $installedCultures = $regProv.EnumKey($HKLM, $productsPath)

                foreach ($installedCulture in $installedCultures.sNames) {
                   if($installedCulture){
                      if ($installedCulture.Contains("-") -and !($installedCulture.ToLower() -eq "x-none")) {
                            $addItem = $appLanguages1.Add($installedCulture)
                      }
                   }
                }

                if ($appLanguages1.Count) {
                   $productsPath = Join-Path $officeKeyPath "ProductReleaseIDs\Culture\$ProductId"
                }

            }
        }

        return $appLanguages1;
    }
}

Function GetScriptRoot() {
 process {
     [string]$scriptPath = "."

     if ($PSScriptRoot) {
       $scriptPath = $PSScriptRoot
     } else {
       $scriptPath = (Get-Item -Path ".\").FullName
     }
     return $scriptPath
 }
}

Function StartProcess {
	Param
	(
        [Parameter()]
		[String]$execFilePath,

        [Parameter()]
        [String]$execParams,

        [Parameter()]
        [bool]$WaitForExit = $false,

        [Parameter()]
        [string]$LogFilePath
	)

    $currentFileName = Get-CurrentFileName
    Set-Alias -name LINENUM -value Get-CurrentLineNumber

    Try
    {
        $startExe = new-object System.Diagnostics.ProcessStartInfo
        $startExe.FileName = $execFilePath
        $startExe.Arguments = $execParams
        $startExe.CreateNoWindow = $false
        $startExe.UseShellExecute = $false

        $execStatement = [System.Diagnostics.Process]::Start($startExe)
        if ($WaitForExit) {
           $execStatement.WaitForExit()
        }
    }
    Catch
    {
        Write-Log -Message $_.Exception.Message -severity 1 -component "Office 365 Update Anywhere"
        WriteToLogFile -LNumber $_.InvocationInfo.ScriptLineNumber -FName $currentFileName -ActionError $_
    }
}

Function IsDotSourced() {
  [CmdletBinding(SupportsShouldProcess=$true)]
  param(
    [Parameter(ValueFromPipelineByPropertyName=$true)]
    [string]$InvocationLine = ""
  )
  $cmdLine = $InvocationLine.Trim()
  Do {
    $cmdLine = $cmdLine.Replace(" ", "")
  } while($cmdLine.Contains(" "))

  $dotSourced = $false
  if ($cmdLine -match '^\.\\') {
     $dotSourced = $false
  } else {
     $dotSourced = ($cmdLine -match '^\.')
  }

  return $dotSourced
}

function Get-CurrentLineNumber {
    $MyInvocation.ScriptLineNumber
}

function Get-CurrentFileName{
    $MyInvocation.ScriptName.Substring($MyInvocation.ScriptName.LastIndexOf("\")+1)
}

Function WriteToLogFile() {
    param(
        [Parameter(Mandatory=$true)]
        [string]$LNumber,

        [Parameter(Mandatory=$true)]
        [string]$FName,

        [Parameter(Mandatory=$true)]
        [string]$ActionError,

        [Parameter()]
        [string]$LogFilePath
    )

    try{
        $headerString = "Time".PadRight(30, ' ') + "Line Number".PadRight(15,' ') + "FileName".PadRight(60,' ') + "Action"
        $stringToWrite = $(Get-Date -Format G).PadRight(30, ' ') + $($LNumber).PadRight(15, ' ') + $($FName).PadRight(60,' ') + $ActionError

        if(!$LogFilePath){
            $LogFilePath = "$env:windir\Temp\" + (Get-Date -Format u).Substring(0,10)+"_OfficeDeploymentLog.txt"
        }
        if(Test-Path $LogFilePath){
             Add-Content $LogFilePath $stringToWrite
        }
        else{#if not exists, create new
             Add-Content $LogFilePath $headerString
             Add-Content $LogFilePath $stringToWrite
        }
    } catch [Exception]{
        Write-Host $_
    }
}

$dotSourced = IsDotSourced -InvocationLine $MyInvocation.Line

if (!($dotSourced)) {
   Remove-OfficeClickToRun -ComputerName $ComputerName -RemoveCTRXmlPath $RemoveCTRXmlPath -WaitForInstallToFinish $WaitForInstallToFinish -TargetFilePath $TargetFilePath -C2RProductsToRemove $C2RProductsToRemove -LogFilePath $LogFilePath
}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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 com.cloud.network.security;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.InternalIdentity;

/**
 * Records the intent to update a VM's ingress ruleset
 *
 */
@Entity
@Table(name="op_vm_ruleset_log")
public class VmRulesetLogVO implements InternalIdentity {
	@Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="id")
    private Long id;

    @Column(name="instance_id", updatable=false, nullable=false)
    private Long instanceId;    // vm_instance id

    @Column(name=GenericDao.CREATED_COLUMN)
    private Date created;

    @Column(name="logsequence")
    long logsequence;

    protected VmRulesetLogVO() {

    }

	public VmRulesetLogVO(Long instanceId) {
		super();
		this.instanceId = instanceId;
	}

	public long getId() {
		return id;
	}

	public Long getInstanceId() {
		return instanceId;
	}

	public Date getCreated() {
		return created;
	}

	public long getLogsequence() {
		return logsequence;
	}

	public void incrLogsequence() {
		logsequence++;
	}

}


text:
package org.apache.kafka.connect.util.clusters;

import kafka.server.KafkaConfig;
import kafka.server.KafkaConfig$;
import kafka.server.KafkaServer;
import kafka.utils.CoreUtils;
import kafka.utils.TestUtils;
import kafka.zk.EmbeddedZookeeper;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.DescribeTopicsResult;
import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.KafkaFuture;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.config.SslConfigs;
import org.apache.kafka.common.config.types.Password;
import org.apache.kafka.common.errors.InvalidReplicationFactorException;
import org.apache.kafka.common.errors.UnknownTopicOrPartitionException;
import org.apache.kafka.common.network.ListenerName;
import org.apache.kafka.common.utils.MockTime;
import org.apache.kafka.common.utils.Time;
import org.apache.kafka.connect.errors.ConnectException;
import org.apache.kafka.metadata.BrokerState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Collectors;

import static org.apache.kafka.clients.consumer.ConsumerConfig.AUTO_OFFSET_RESET_CONFIG;
import static org.apache.kafka.clients.consumer.ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG;
import static org.apache.kafka.clients.consumer.ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG;
import static org.apache.kafka.clients.consumer.ConsumerConfig.GROUP_ID_CONFIG;
import static org.apache.kafka.clients.consumer.ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG;
import static org.apache.kafka.clients.consumer.ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG;

/**
 * Setup an embedded Kafka cluster with specified number of brokers and specified broker properties. To be used for
 * integration tests.
 */
public class EmbeddedKafkaCluster {

    private static final Logger log = LoggerFactory.getLogger(EmbeddedKafkaCluster.class);

    private static final long DEFAULT_PRODUCE_SEND_DURATION_MS = TimeUnit.SECONDS.toMillis(120);

    // Kafka Config
    private final KafkaServer[] brokers;
    private final Properties brokerConfig;
    private final Time time = new MockTime();
    private final int[] currentBrokerPorts;
    private final String[] currentBrokerLogDirs;

    private EmbeddedZookeeper zookeeper = null;
    private ListenerName listenerName = new ListenerName("PLAINTEXT");
    private KafkaProducer<byte[], byte[]> producer;

    public EmbeddedKafkaCluster(final int numBrokers,
                                final Properties brokerConfig) {
        brokers = new KafkaServer[numBrokers];
        currentBrokerPorts = new int[numBrokers];
        currentBrokerLogDirs = new String[numBrokers];
        this.brokerConfig = brokerConfig;
    }

    /**
     * Starts the Kafka cluster alone using the ports that were assigned during initialization of
     * the harness.
     *
     * @throws ConnectException if a directory to store the data cannot be created
     */
    public void startOnlyKafkaOnSamePorts() {
        start(currentBrokerPorts, currentBrokerLogDirs);
    }

    public void start() {
        // pick a random port
        zookeeper = new EmbeddedZookeeper();
        Arrays.fill(currentBrokerPorts, 0);
        Arrays.fill(currentBrokerLogDirs, null);
        start(currentBrokerPorts, currentBrokerLogDirs);
    }

    private void start(int[] brokerPorts, String[] logDirs) {
        brokerConfig.put(KafkaConfig$.MODULE$.ZkConnectProp(), zKConnectString());

        putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.HostNameProp(), "localhost");
        putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.DeleteTopicEnableProp(), true);
        putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.GroupInitialRebalanceDelayMsProp(), 0);
        putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.OffsetsTopicReplicationFactorProp(), (short) brokers.length);
        putIfAbsent(brokerConfig, KafkaConfig$.MODULE$.AutoCreateTopicsEnableProp(), false);

        Object listenerConfig = brokerConfig.get(KafkaConfig$.MODULE$.InterBrokerListenerNameProp());
        if (listenerConfig != null) {
            listenerName = new ListenerName(listenerConfig.toString());
        }

        for (int i = 0; i < brokers.length; i++) {
            brokerConfig.put(KafkaConfig$.MODULE$.BrokerIdProp(), i);
            currentBrokerLogDirs[i] = logDirs[i] == null ? createLogDir() : currentBrokerLogDirs[i];
            brokerConfig.put(KafkaConfig$.MODULE$.LogDirProp(), currentBrokerLogDirs[i]);
            brokerConfig.put(KafkaConfig$.MODULE$.PortProp(), brokerPorts[i]);
            brokers[i] = TestUtils.createServer(new KafkaConfig(brokerConfig, true), time);
            currentBrokerPorts[i] = brokers[i].boundPort(listenerName);
        }

        Map<String, Object> producerProps = new HashMap<>();
        producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers());
        producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer");
        producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArraySerializer");
        if (sslEnabled()) {
            producerProps.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, brokerConfig.get(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG));
            producerProps.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, brokerConfig.get(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG));
            producerProps.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL");
        }
        producer = new KafkaProducer<>(producerProps);
    }

    public void stopOnlyKafka() {
        stop(false, false);
    }

    public void stop() {
        stop(true, true);
    }

    private void stop(boolean deleteLogDirs, boolean stopZK) {
        try {
            if (producer != null) {
                producer.close();
            }
        } catch (Exception e) {
            log.error("Could not shutdown producer ", e);
            throw new RuntimeException("Could not shutdown producer", e);
        }

        for (KafkaServer broker : brokers) {
            try {
                broker.shutdown();
            } catch (Throwable t) {
                String msg = String.format("Could not shutdown broker at %s", address(broker));
                log.error(msg, t);
                throw new RuntimeException(msg, t);
            }
        }

        if (deleteLogDirs) {
            for (KafkaServer broker : brokers) {
                try {
                    log.info("Cleaning up kafka log dirs at {}", broker.config().logDirs());
                    CoreUtils.delete(broker.config().logDirs());
                } catch (Throwable t) {
                    String msg = String.format("Could not clean up log dirs for broker at %s",
                            address(broker));
                    log.error(msg, t);
                    throw new RuntimeException(msg, t);
                }
            }
        }

        try {
            if (stopZK) {
                zookeeper.shutdown();
            }
        } catch (Throwable t) {
            String msg = String.format("Could not shutdown zookeeper at %s", zKConnectString());
            log.error(msg, t);
            throw new RuntimeException(msg, t);
        }
    }

    private static void putIfAbsent(final Properties props, final String propertyKey, final Object propertyValue) {
        if (!props.containsKey(propertyKey)) {
            props.put(propertyKey, propertyValue);
        }
    }

    private String createLogDir() {
        try {
            return Files.createTempDirectory(getClass().getSimpleName()).toString();
        } catch (IOException e) {
            log.error("Unable to create temporary log directory", e);
            throw new ConnectException("Unable to create temporary log directory", e);
        }
    }

    public String bootstrapServers() {
        return Arrays.stream(brokers)
                .map(this::address)
                .collect(Collectors.joining(","));
    }

    public String address(KafkaServer server) {
        return server.config().hostName() + ":" + server.boundPort(listenerName);
    }

    public String zKConnectString() {
        return "127.0.0.1:" + zookeeper.port();
    }

    /**
     * Get the brokers that have a {@link BrokerState#RUNNING} state.
     *
     * @return the list of {@link KafkaServer} instances that are running;
     *         never null but  possibly empty
     */
    public Set<KafkaServer> runningBrokers() {
        return brokersInState(state -> state == BrokerState.RUNNING);
    }

    /**
     * Get the brokers whose state match the given predicate.
     *
     * @return the list of {@link KafkaServer} instances with states that match the predicate;
     *         never null but  possibly empty
     */
    public Set<KafkaServer> brokersInState(Predicate<BrokerState> desiredState) {
        return Arrays.stream(brokers)
                     .filter(b -> hasState(b, desiredState))
                     .collect(Collectors.toSet());
    }

    protected boolean hasState(KafkaServer server, Predicate<BrokerState> desiredState) {
        try {
            return desiredState.test(server.brokerState());
        } catch (Throwable e) {
            // Broker failed to respond.
            return false;
        }
    }

    public boolean sslEnabled() {
        final String listeners = brokerConfig.getProperty(KafkaConfig$.MODULE$.ListenersProp());
        return listeners != null && listeners.contains("SSL");
    }

    /**
     * Get the topic descriptions of the named topics. The value of the map entry will be empty
     * if the topic does not exist.
     *
     * @param topicNames the names of the topics to describe
     * @return the map of optional {@link TopicDescription} keyed by the topic name
     */
    public Map<String, Optional<TopicDescription>> describeTopics(String... topicNames) {
        return describeTopics(new HashSet<>(Arrays.asList(topicNames)));
    }

    /**
     * Get the topic descriptions of the named topics. The value of the map entry will be empty
     * if the topic does not exist.
     *
     * @param topicNames the names of the topics to describe
     * @return the map of optional {@link TopicDescription} keyed by the topic name
     */
    public Map<String, Optional<TopicDescription>> describeTopics(Set<String> topicNames) {
        Map<String, Optional<TopicDescription>> results = new HashMap<>();
        log.info("Describing topics {}", topicNames);
        try (Admin admin = createAdminClient()) {
            DescribeTopicsResult result = admin.describeTopics(topicNames);
            Map<String, KafkaFuture<TopicDescription>> byName = result.values();
            for (Map.Entry<String, KafkaFuture<TopicDescription>> entry : byName.entrySet()) {
                String topicName = entry.getKey();
                try {
                    TopicDescription desc = entry.getValue().get();
                    results.put(topicName, Optional.of(desc));
                    log.info("Found topic {} : {}", topicName, desc);
                } catch (ExecutionException e) {
                    Throwable cause = e.getCause();
                    if (cause instanceof UnknownTopicOrPartitionException) {
                        results.put(topicName, Optional.empty());
                        log.info("Found non-existant topic {}", topicName);
                        continue;
                    }
                    throw new AssertionError("Could not describe topic(s)" + topicNames, e);
                }
            }
        } catch (Exception e) {
            throw new AssertionError("Could not describe topic(s) " + topicNames, e);
        }
        log.info("Found topics {}", results);
        return results;
    }

    /**
     * Create a Kafka topic with 1 partition and a replication factor of 1.
     *
     * @param topic The name of the topic.
     */
    public void createTopic(String topic) {
        createTopic(topic, 1);
    }

    /**
     * Create a Kafka topic with given partition and a replication factor of 1.
     *
     * @param topic The name of the topic.
     */
    public void createTopic(String topic, int partitions) {
        createTopic(topic, partitions, 1, new HashMap<>());
    }

    /**
     * Create a Kafka topic with the given parameters.
     *
     * @param topic       The name of the topic.
     * @param partitions  The number of partitions for this topic.
     * @param replication The replication factor for (partitions of) this topic.
     * @param topicConfig Additional topic-level configuration settings.
     */
    public void createTopic(String topic, int partitions, int replication, Map<String, String> topicConfig) {
        if (replication > brokers.length) {
            throw new InvalidReplicationFactorException("Insufficient brokers ("
                    + brokers.length + ") for desired replication (" + replication + ")");
        }

        log.debug("Creating topic { name: {}, partitions: {}, replication: {}, config: {} }",
                topic, partitions, replication, topicConfig);
        final NewTopic newTopic = new NewTopic(topic, partitions, (short) replication);
        newTopic.configs(topicConfig);

        try (final Admin adminClient = createAdminClient()) {
            adminClient.createTopics(Collections.singletonList(newTopic)).all().get();
        } catch (final InterruptedException | ExecutionException e) {
            throw new RuntimeException(e);
        }
    }

    public void produce(String topic, String value) {
        produce(topic, null, null, value);
    }

    public void produce(String topic, String key, String value) {
        produce(topic, null, key, value);
    }

    public void produce(String topic, Integer partition, String key, String value) {
        ProducerRecord<byte[], byte[]> msg = new ProducerRecord<>(topic, partition, key == null ? null : key.getBytes(), value == null ? null : value.getBytes());
        try {
            producer.send(msg).get(DEFAULT_PRODUCE_SEND_DURATION_MS, TimeUnit.MILLISECONDS);
        } catch (Exception e) {
            throw new KafkaException("Could not produce message: " + msg, e);
        }
    }

    public Admin createAdminClient() {
        final Properties adminClientConfig = new Properties();
        adminClientConfig.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers());
        final Object listeners = brokerConfig.get(KafkaConfig$.MODULE$.ListenersProp());
        if (listeners != null && listeners.toString().contains("SSL")) {
            adminClientConfig.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, brokerConfig.get(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG));
            adminClientConfig.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, ((Password) brokerConfig.get(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG)).value());
            adminClientConfig.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL");
        }
        return Admin.create(adminClientConfig);
    }

    /**
     * Consume at least n records in a given duration or throw an exception.
     *
     * @param n the number of expected records in this topic.
     * @param maxDuration the max duration to wait for these records (in milliseconds).
     * @param topics the topics to subscribe and consume records from.
     * @return a {@link ConsumerRecords} collection containing at least n records.
     */
    public ConsumerRecords<byte[], byte[]> consume(int n, long maxDuration, String... topics) {
        Map<TopicPartition, List<ConsumerRecord<byte[], byte[]>>> records = new HashMap<>();
        int consumedRecords = 0;
        try (KafkaConsumer<byte[], byte[]> consumer = createConsumerAndSubscribeTo(Collections.emptyMap(), topics)) {
            final long startMillis = System.currentTimeMillis();
            long allowedDuration = maxDuration;
            while (allowedDuration > 0) {
                log.debug("Consuming from {} for {} millis.", Arrays.toString(topics), allowedDuration);
                ConsumerRecords<byte[], byte[]> rec = consumer.poll(Duration.ofMillis(allowedDuration));
                if (rec.isEmpty()) {
                    allowedDuration = maxDuration - (System.currentTimeMillis() - startMillis);
                    continue;
                }
                for (TopicPartition partition: rec.partitions()) {
                    final List<ConsumerRecord<byte[], byte[]>> r = rec.records(partition);
                    records.computeIfAbsent(partition, t -> new ArrayList<>()).addAll(r);
                    consumedRecords += r.size();
                }
                if (consumedRecords >= n) {
                    return new ConsumerRecords<>(records);
                }
                allowedDuration = maxDuration - (System.currentTimeMillis() - startMillis);
            }
        }

        throw new RuntimeException("Could not find enough records. found " + consumedRecords + ", expected " + n);
    }

    public KafkaConsumer<byte[], byte[]> createConsumer(Map<String, Object> consumerProps) {
        Map<String, Object> props = new HashMap<>(consumerProps);

        putIfAbsent(props, GROUP_ID_CONFIG, UUID.randomUUID().toString());
        putIfAbsent(props, BOOTSTRAP_SERVERS_CONFIG, bootstrapServers());
        putIfAbsent(props, ENABLE_AUTO_COMMIT_CONFIG, "false");
        putIfAbsent(props, AUTO_OFFSET_RESET_CONFIG, "earliest");
        putIfAbsent(props, KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer");
        putIfAbsent(props, VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer");
        if (sslEnabled()) {
            putIfAbsent(props, SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, brokerConfig.get(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG));
            putIfAbsent(props, SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, brokerConfig.get(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG));
            putIfAbsent(props, CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL");
        }
        KafkaConsumer<byte[], byte[]> consumer;
        try {
            consumer = new KafkaConsumer<>(props);
        } catch (Throwable t) {
            throw new ConnectException("Failed to create consumer", t);
        }
        return consumer;
    }

    public KafkaConsumer<byte[], byte[]> createConsumerAndSubscribeTo(Map<String, Object> consumerProps, String... topics) {
        KafkaConsumer<byte[], byte[]> consumer = createConsumer(consumerProps);
        consumer.subscribe(Arrays.asList(topics));
        return consumer;
    }

    private static void putIfAbsent(final Map<String, Object> props, final String propertyKey, final Object propertyValue) {
        if (!props.containsKey(propertyKey)) {
            props.put(propertyKey, propertyValue);
        }
    }
}