// Path: cm-schema/src/main/java/com/cloudera/parcel/descriptors/ParcelInfoDescriptor.java
// public interface ParcelInfoDescriptor {
// 
//   @NotBlank
//   String getParcelName();
// 
//   @NotBlank
//   String getHash();
// 
//   @UniqueField("name")
//   @Valid
//   @NotNull
//   List<ComponentDescriptor> getComponents();
// 
//   Instant getReleased();
// 
//   String getDepends();
// 
//   String getReplaces();
// 
//   String getConflicts();
// 
//   String getReleaseNotes();
// 
//   ServicesRestartDescriptor getServicesRestartInfo();
// }
// 
// Path: cm-schema/src/main/java/com/cloudera/parcel/descriptors/VersionServicesRestartDescriptor.java
// public interface VersionServicesRestartDescriptor {
// 
//   enum Scope {
//     SERVICE_ONLY,
//     DEPENDENTS_ONLY,
//     SERVICE_AND_DEPENDENTS
//   }
// 
//   /**
//    * Contains a map of service type to {@link Scope}
//    * @return a map of service type to {@link Scope}
//    */
//   @NotNull
//   Map<String, Scope> getServiceInfo();
// 
//   /**
//    * Parent parcel version of this version descriptor.
//    *
//    * Can be null, in which case this is determined to be the oldest version
//    * supported from which the restart information will be used for selective restarts.
//    *
//    * @return parent version, if specified.
//    */
//   String getParentVersion();
// 
//   /**
//    * Child parcel version of this version descriptor.
//    *
//    * Can be null, in which case this is determined to be the newest version
//    * supported from which the restart information will be used for selective restarts.
//    *
//    * @return child version, if specified.
//    */
//   String getChildVersion();
// }
// 
// Path: cm-schema/src/main/java/com/cloudera/parcel/descriptors/VersionServicesRestartDescriptor.java
// enum Scope {
//   SERVICE_ONLY,
//   DEPENDENTS_ONLY,
//   SERVICE_AND_DEPENDENTS
// }


import static org.junit.Assert.*;
import com.cloudera.parcel.descriptors.ManifestDescriptor;
import com.cloudera.parcel.descriptors.ParcelInfoDescriptor;
import com.cloudera.parcel.descriptors.VersionServicesRestartDescriptor;
import com.cloudera.parcel.descriptors.VersionServicesRestartDescriptor.Scope;
import com.cloudera.parcel.validation.ParcelTestUtils;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.joda.time.Instant;
import org.junit.Test;
    assertEquals("IMPALA, SOLR, SPARK", parcelInfo.getReplaces());
    assertEquals(27, parcelInfo.getComponents().size());

    parcelInfo = parcels.get(2);
    assertEquals("CDH-5.5.0-0.cdh5b2.p0.1-el6.parcel", parcelInfo.getParcelName());
    assertEquals("f4asdas146e00c2d3ff19e95476f3485be64fd0f", parcelInfo.getHash());
    assertEquals("IMPALA, SOLR, SPARK", parcelInfo.getReplaces());
    assertEquals(27, parcelInfo.getComponents().size());

    assertNotNull(parcelInfo.getServicesRestartInfo());
    assertNotNull(parcelInfo.getServicesRestartInfo().getVersionInfo());

    Map<String, VersionServicesRestartDescriptor> versionServicesRestartDescriptorMap =
      parcelInfo.getServicesRestartInfo().getVersionInfo();
    assertEquals(3, versionServicesRestartDescriptorMap.size());
    assertTrue(versionServicesRestartDescriptorMap.containsKey("5.5.0-0.cdh5b2.p0.1"));
    assertTrue(versionServicesRestartDescriptorMap.containsKey("5.5.0-0.cdh5b2"));
    assertTrue(versionServicesRestartDescriptorMap.containsKey("5.5.0-0.cdh5b"));


    VersionServicesRestartDescriptor p01 =
      versionServicesRestartDescriptorMap.get("5.5.0-0.cdh5b2.p0.1");
    VersionServicesRestartDescriptor p00 =
      versionServicesRestartDescriptorMap.get("5.5.0-0.cdh5b2");
    VersionServicesRestartDescriptor base =
      versionServicesRestartDescriptorMap.get("5.5.0-0.cdh5b");

    assertNull(p01.getChildVersion());
    assertEquals("5.5.0-0.cdh5b2", p01.getParentVersion());
    assertTrue(p01.getServiceInfo().containsKey("IMPALA"));
// Path: cm-schema/src/main/java/com/cloudera/parcel/descriptors/ParcelInfoDescriptor.java
// public interface ParcelInfoDescriptor {
// 
//   @NotBlank
//   String getParcelName();
// 
//   @NotBlank
//   String getHash();
// 
//   @UniqueField("name")
//   @Valid
//   @NotNull
//   List<ComponentDescriptor> getComponents();
// 
//   Instant getReleased();
// 
//   String getDepends();
// 
//   String getReplaces();
// 
//   String getConflicts();
// 
//   String getReleaseNotes();
// 
//   ServicesRestartDescriptor getServicesRestartInfo();
// }
// 
// Path: cm-schema/src/main/java/com/cloudera/parcel/descriptors/VersionServicesRestartDescriptor.java
// public interface VersionServicesRestartDescriptor {
// 
//   enum Scope {
//     SERVICE_ONLY,
//     DEPENDENTS_ONLY,
//     SERVICE_AND_DEPENDENTS
//   }
// 
//   /**
//    * Contains a map of service type to {@link Scope}
//    * @return a map of service type to {@link Scope}
//    */
//   @NotNull
//   Map<String, Scope> getServiceInfo();
// 
//   /**
//    * Parent parcel version of this version descriptor.
//    *
//    * Can be null, in which case this is determined to be the oldest version
//    * supported from which the restart information will be used for selective restarts.
//    *
//    * @return parent version, if specified.
//    */
//   String getParentVersion();
// 
//   /**
//    * Child parcel version of this version descriptor.
//    *
//    * Can be null, in which case this is determined to be the newest version
//    * supported from which the restart information will be used for selective restarts.
//    *
//    * @return child version, if specified.
//    */
//   String getChildVersion();
// }
// 
// Path: cm-schema/src/main/java/com/cloudera/parcel/descriptors/VersionServicesRestartDescriptor.java
// enum Scope {
//   SERVICE_ONLY,
//   DEPENDENTS_ONLY,
//   SERVICE_AND_DEPENDENTS
// }


// Path: cm-schema/src/test/java/com/cloudera/parcel/components/JsonManifestParserTest.java
import static org.junit.Assert.*;
import com.cloudera.parcel.descriptors.ManifestDescriptor;
import com.cloudera.parcel.descriptors.ParcelInfoDescriptor;
import com.cloudera.parcel.descriptors.VersionServicesRestartDescriptor;
import com.cloudera.parcel.descriptors.VersionServicesRestartDescriptor.Scope;
import com.cloudera.parcel.validation.ParcelTestUtils;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.joda.time.Instant;
import org.junit.Test;

    assertEquals("IMPALA, SOLR, SPARK", parcelInfo.getReplaces());
    assertEquals(27, parcelInfo.getComponents().size());

    parcelInfo = parcels.get(2);
    assertEquals("CDH-5.5.0-0.cdh5b2.p0.1-el6.parcel", parcelInfo.getParcelName());
    assertEquals("f4asdas146e00c2d3ff19e95476f3485be64fd0f", parcelInfo.getHash());
    assertEquals("IMPALA, SOLR, SPARK", parcelInfo.getReplaces());
    assertEquals(27, parcelInfo.getComponents().size());

    assertNotNull(parcelInfo.getServicesRestartInfo());
    assertNotNull(parcelInfo.getServicesRestartInfo().getVersionInfo());

    Map<String, VersionServicesRestartDescriptor> versionServicesRestartDescriptorMap =
      parcelInfo.getServicesRestartInfo().getVersionInfo();
    assertEquals(3, versionServicesRestartDescriptorMap.size());
    assertTrue(versionServicesRestartDescriptorMap.containsKey("5.5.0-0.cdh5b2.p0.1"));
    assertTrue(versionServicesRestartDescriptorMap.containsKey("5.5.0-0.cdh5b2"));
    assertTrue(versionServicesRestartDescriptorMap.containsKey("5.5.0-0.cdh5b"));


    VersionServicesRestartDescriptor p01 =
      versionServicesRestartDescriptorMap.get("5.5.0-0.cdh5b2.p0.1");
    VersionServicesRestartDescriptor p00 =
      versionServicesRestartDescriptorMap.get("5.5.0-0.cdh5b2");
    VersionServicesRestartDescriptor base =
      versionServicesRestartDescriptorMap.get("5.5.0-0.cdh5b");

    assertNull(p01.getChildVersion());
    assertEquals("5.5.0-0.cdh5b2", p01.getParentVersion());
    assertTrue(p01.getServiceInfo().containsKey("IMPALA"));
    assertTrue(p01.getServiceInfo().containsValue(Scope.DEPENDENTS_ONLY));