Package com.google.testing.testify.risk.frontend.model

Examples of com.google.testing.testify.risk.frontend.model.Attribute


      for (int aIndex = 0; aIndex < attributes.size(); aIndex++) {
        int row = cIndex + 1;
        int column = aIndex + 1;

        Component component = components.get(cIndex);
        Attribute attribute = attributes.get(aIndex);
        Integer key = Capability.getCapabilityIntersectionKey(component, attribute);

        grid.getCellFormatter().setStyleName(row, column, "tty-GridCell");
        if (row == highlightedCellRow && column == highlightedCellColumn) {
          grid.getCellFormatter().addStyleName(row, column, "tty-GridCellSelected");
View Full Code Here


    };
  }

  private void cellClicked(int row, int column) {
    final Component component = components.get(row - 1);
    final Attribute attribute = attributes.get(column - 1);

    if (highlightedCellRow != -1 && highlightedCellColumn != -1) {
      grid.getCellFormatter().removeStyleName(
          highlightedCellRow, highlightedCellColumn, "tty-GridCellSelected");
    }
View Full Code Here

    Long projectId = projectService.createProject(project);

    // Attributes.
    LOG.info("Creating attributes.");
    List<Attribute> attributes = Lists.newArrayList();
    Attribute attr1 = new Attribute();
    attr1.setParentProjectId(projectId);
    attr1.setName("Fast");
    attr1.setDescription("This should be speedy.");
    attr1.addLabel("owner: alaska@example");
    attr1.addLabel("pm: will@example");
    attr1.setAttributeId(projectService.createAttribute(attr1));
    attributes.add(attr1);

    Attribute attr2 = new Attribute();
    attr2.setParentProjectId(projectId);
    attr2.setName("Simple");
    attr2.addLabel("owner: alaska@example");
    attr2.setAttributeId(projectService.createAttribute(attr2));
    attributes.add(attr2);

    Attribute attr3 = new Attribute();
    attr3.setParentProjectId(projectId);
    attr3.setName("Secure");
    attr3.addLabel("owner: margo@example");
    attr3.addLabel("tester: quentin@example");
    attr3.setAttributeId(projectService.createAttribute(attr3));
    attributes.add(attr3);

    // Components.
    LOG.info("Creating components.");
    ArrayList<Component> components = Lists.newArrayList();
View Full Code Here

      Window.alert("Error: Please enter a name for the Attribute.");
      return;
    }

    // Create new Attribute and attach to UI
    Attribute newAttribute = new Attribute();
    newAttribute.setParentProjectId(presenter.getProjectId());
    newAttribute.setName(newAttributeName.getText());

    presenter.createAttribute(newAttribute);
    newAttributeName.setText("");
    // Don't display the new attribute widget. Instead, wait for a full refresh from the presenter.
  }
View Full Code Here

   */
  private void tryToPopulateCapabilitiesPanel() {
    if (selectedIntersection != null && attributes != null && components != null
          && capabilities != null) {
      Component component = selectedIntersection.getFirst();
      Attribute attribute = selectedIntersection.getSecond();

      capabilitiesContainer.setVisible(true);
      capabilitiesContainerTitle.setText(component.getName() + " is " + attribute.getName());

      List<EditCapabilityWidget> widgets = Lists.newArrayList();
      for (final Capability capability : capabilities) {
        // If we're interested in this capability (it matches our current filter).
        if (capability.getComponentId() == component.getComponentId()
            && capability.getAttributeId() == attribute.getAttributeId()) {
          // Create and populate a capability widget for this capability.
          final EditCapabilityWidget widget = new EditCapabilityWidget(capability);
          widget.addValueChangeHandler(new ValueChangeHandler<Capability>() {
              @Override
              public void onValueChange(ValueChangeEvent<Capability> event) {
View Full Code Here

    ServletUtils.requireAccess(userService.hasEditAccess(attribute.getParentProjectId()));

    log.info("Updating Attribute: " + attribute.getAttributeId().toString());
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      Attribute oldAttribute = pm.getObjectById(Attribute.class, attribute.getAttributeId());
      if (oldAttribute.getParentProjectId() != attribute.getParentProjectId()) {
        log.severe("Possible attack -- attribute sent in and attribute being overwritten had"
            + " different project IDs.");
        ServletUtils.requireAccess(false);
      }
View Full Code Here

    }

    log.info("Removing Attribute: " + attribute.getAttributeId().toString());
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      Attribute attributeToDelete = pm.getObjectById(Attribute.class, attribute.getAttributeId());
      ServletUtils.requireAccess(userService.hasEditAccess(attributeToDelete.getParentProjectId()));

      pm.deletePersistent(attributeToDelete);
      deleteLabels(attribute, pm);

      // Delete any child capabilities.
View Full Code Here

    int aIndex = column - 1;
    if (aIndex < 0 || aIndex >= attributes.size() || cIndex < 0 || cIndex >= components.size()) {
      return null;
    }

    Attribute attribute = attributes.get(aIndex);
    Component component = components.get(cIndex);
    Integer key = Capability.getCapabilityIntersectionKey(component, attribute);
    return dataMap.get(key);
  }
View Full Code Here

  protected void refreshRiskCalculation(List<RiskProvider> providers) {
    for (int cIndex = 0; cIndex < components.size(); cIndex++) {
      for (int aIndex = 0; aIndex < attributes.size(); aIndex++) {
        int row = cIndex + 1;
        int column = aIndex + 1;
        Attribute attribute = attributes.get(aIndex);
        Component component = components.get(cIndex);
        Integer key = Capability.getCapabilityIntersectionKey(component, attribute);
        CapabilityIntersectionData data = dataMap.get(key);

        double risk = 0.0;
View Full Code Here

    // Test setup
    ProjectRpcAsync projServiceObserver = EasyMock.createMock(ProjectRpcAsync.class);
    AttributesView.Presenter mockParent = EasyMock.createMock(AttributesView.Presenter.class);

    AttributeView mockAttributeView = EasyMock.createMock(AttributeView.class);
    Attribute targetAttribute = new Attribute();
    targetAttribute.setParentProjectId(0L);
    targetAttribute.setAttributeId(1234L);
    targetAttribute.setDescription("Test");

    // Verify this initialization sequence
    mockAttributeView.setPresenter((Presenter) EasyMock.anyObject());
    mockAttributeView.setAttributeName(targetAttribute.getName());
    mockAttributeView.setDescription("Test");
    mockAttributeView.setAttributeId(1234L);
    mockAttributeView.setLabels(new ArrayList<AccLabel>());

    EasyMock.replay(mockAttributeView, mockParent);
View Full Code Here

TOP

Related Classes of com.google.testing.testify.risk.frontend.model.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.