@Before
  public void init() throws URISyntaxException {

    adapterFactory =
        new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ConfigurationAdapterFactory());
    adapterFactory.addAdapterFactory(new ReqIF10ItemProviderAdapterFactory());
    // FIXME (mj) I would prefer not to generate these - does it work
    // without?
    // adapterFactory.addAdapterFactory(new
    // XhtmlItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());

    adapterFactory.addAdapterFactory(new HeadlineAdapterFactory());
    adapterFactory.addAdapterFactory(new LinewrapAdapterFactory());
    adapterFactory.addAdapterFactory(new IdAdapterFactory());

    reqif = this.getTestReqif("Integration-Release-Checklist.reqif");
    specification = reqif.getCoreContent().getSpecifications().get(0);
    specObject = reqif.getCoreContent().getSpecObjects().get(0);
    specHierarchy = specification.getChildren().get(0);

    // Build up the data structures that hold specViewConfig
    // ProrToolExtension prorToolExtension =
    // ConfigurationFactory.eINSTANCE.createProrToolExtension();
    specViewConfig = ConfigurationUtil.createSpecViewConfiguration(specification, editingDomain);
    // prorToolExtension.getSpecViewConfigurations().add(specViewConfig);
    // ReqIFToolExtensionUtil.addToolExtension(reqif, prorToolExtension);

    contentProvider = new ProrAgileGridContentProvider(specification, specViewConfig);
  }
  @Test
  public void firstTest() throws Exception {
    ArrayList<Map<String, ?>> specMapList = new ArrayList<Map<String, ?>>();

    // printRecursive(new StringBuilder(), specViewConfig, "",
    // specification.getChildren(), adapterFactory, specMapList);
    fillRecursive(specification.getChildren(), specViewConfig, specMapList);
    Reporter.makeMapReport(specMapList);
  }
Exemple #3
0
  /**
   * Create a new model.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  protected EObject createInitialModel() {
    ReqIF root = reqif10Factory.createReqIF();

    ReqIFHeader header = reqif10Factory.createReqIFHeader();
    root.setTheHeader(header);

    XMLGregorianCalendar reqIFLastChange = ReqIF10Util.getReqIFLastChange();

    header.setCreationTime(reqIFLastChange);
    header.setSourceToolId("ProR (http://pror.org)");
    header.setIdentifier("rmf-" + UUID.randomUUID());
    header.setReqIFVersion("1.0.1");
    header.setReqIFToolId("ProR (http://pror.org)");
    header.setComment("Created by: " + System.getProperty("user.name"));

    ReqIFContent content = reqif10Factory.createReqIFContent();
    root.setCoreContent(content);

    // Add a DatatypeDefinition
    DatatypeDefinitionString ddString = reqif10Factory.createDatatypeDefinitionString();
    ddString.setLongName("T_String32k");
    ddString.setMaxLength(new BigInteger("32000"));
    ddString.setLastChange(reqIFLastChange);
    content.getDatatypes().add(ddString);

    // Add a SpecObjectType
    SpecObjectType specObjectType = reqif10Factory.createSpecObjectType();
    specObjectType.setLongName("Requirement Type");
    specObjectType.setLastChange(reqIFLastChange);
    content.getSpecTypes().add(specObjectType);

    // Add an AttributeDefinition
    AttributeDefinitionString ad1 = reqif10Factory.createAttributeDefinitionString();
    ad1.setType(ddString);
    ad1.setLongName("Description");
    ad1.setLastChange(reqIFLastChange);
    specObjectType.getSpecAttributes().add(ad1);

    // Add a SpecificationType
    SpecificationType specificationType = reqif10Factory.createSpecificationType();
    specificationType.setLongName("Specification Type");
    specificationType.setLastChange(reqIFLastChange);
    content.getSpecTypes().add(specificationType);

    // Add an AttributeDefinition
    AttributeDefinitionString ad2 = reqif10Factory.createAttributeDefinitionString();
    ad2.setType(ddString);
    ad2.setLongName("Description");
    ad2.setLastChange(reqIFLastChange);
    specificationType.getSpecAttributes().add(ad2);

    // Add a Specification
    Specification spec = reqif10Factory.createSpecification();
    spec.setLongName("Specification Document");
    spec.setType(specificationType);
    spec.setLastChange(reqIFLastChange);
    AttributeValueString value1 = reqif10Factory.createAttributeValueString();
    value1.setTheValue("Requirements Document");
    value1.setDefinition(ad2);
    spec.getValues().add(value1);

    content.getSpecifications().add(spec);

    // Configure the Specification View
    ProrToolExtension extension = ConfigurationFactory.eINSTANCE.createProrToolExtension();
    ReqIFToolExtensionUtil.addToolExtension(root, extension);
    ProrSpecViewConfiguration prorSpecViewConfiguration =
        ConfigurationFactory.eINSTANCE.createProrSpecViewConfiguration();
    extension.getSpecViewConfigurations().add(prorSpecViewConfiguration);
    prorSpecViewConfiguration.setSpecification(spec);
    Column col = ConfigurationFactory.eINSTANCE.createColumn();
    col.setLabel("Description");
    col.setWidth(400);
    prorSpecViewConfiguration.getColumns().add(col);

    Column leftHeaderColumn = ConfigurationFactory.eINSTANCE.createColumn();
    leftHeaderColumn.setWidth(ConfigurationUtil.DEFAULT_LEFT_HEADER_COLUMN_WIDTH);
    leftHeaderColumn.setLabel(ConfigurationUtil.DEFAULT_LEFT_HEADER_COLUMN_NAME);
    prorSpecViewConfiguration.setLeftHeaderColumn(leftHeaderColumn);

    // Configure the Label configuration
    ProrGeneralConfiguration generalConfig =
        ConfigurationFactory.eINSTANCE.createProrGeneralConfiguration();
    LabelConfiguration labelConfig = ConfigurationFactory.eINSTANCE.createLabelConfiguration();
    labelConfig.getDefaultLabel().add("Description");
    generalConfig.setLabelConfiguration(labelConfig);
    extension.setGeneralConfiguration(generalConfig);

    // Create one Requirement
    SpecObject specObject = reqif10Factory.createSpecObject();
    specObject.setType(specObjectType);
    specObject.setLastChange(reqIFLastChange);
    content.getSpecObjects().add(specObject);
    AttributeValueString value2 = reqif10Factory.createAttributeValueString();
    value2.setTheValue("Start editing here.");
    value2.setDefinition(ad1);
    specObject.getValues().add(value2);

    // Add the requirement to the Specification
    SpecHierarchy specHierarchy = reqif10Factory.createSpecHierarchy();
    specHierarchy.setLastChange(reqIFLastChange);
    spec.getChildren().add(specHierarchy);
    specHierarchy.setObject(specObject);
    return root;
  }