Ejemplo n.º 1
0
 /**
  * This function analyses an event and calls the right methods to take care of the user's
  * requests.
  *
  * @param event The incoming ActionEvent.
  */
 @Override
 public void actionPerformed(ActionEvent event) {
   final String FAIL = "FAIL";
   if (colony.getOwner() == getMyPlayer()) {
     String command = event.getActionCommand();
     List<BuildableType> buildables = getBuildableTypes(buildQueueList);
     while (!buildables.isEmpty() && lockReasons.get(buildables.get(0)) != null) {
       getGUI()
           .showInformationMessage(
               buildables.get(0),
               StringTemplate.template("colonyPanel.unbuildable")
                   .addName("%colony%", colony.getName())
                   .add("%object%", buildables.get(0).getNameKey()));
       command = FAIL;
       removeBuildable(buildables.remove(0));
     }
     getController().setBuildQueue(colony, buildables);
     if (FAIL.equals(command)) { // Let the user reconsider.
       updateAllLists();
       return;
     } else if (OK.equals(command)) {
       // do nothing?
     } else if (BUY.equals(command)) {
       getController().payForBuilding(colony);
     } else {
       logger.warning("Unsupported command " + command);
     }
   }
   getGUI().removeFromCanvas(this);
 }
Ejemplo n.º 2
0
 /**
  * Get a ResponseStatus enum from it's representative String. <br>
  * Not cross locale safe.
  *
  * @param statusName
  * @return
  */
 public static final ResponseStatus getStatus(String statusName) {
   if (statusName.equals(OK.name())) {
     return ResponseStatus.OK;
   }
   if (statusName.equals(NONE.name())) {
     return ResponseStatus.NONE;
   } else if (statusName.equals(PRE_REQUEST.name())) {
     return ResponseStatus.PRE_REQUEST;
   } else if (statusName.equals(REQUEST_ERROR.name())) {
     return ResponseStatus.REQUEST_ERROR;
   } else if (statusName.equals(REQUESTING.name())) {
     return ResponseStatus.REQUESTING;
   } else if (statusName.equals(NO_CONNECTION.name())) {
     return ResponseStatus.NO_CONNECTION;
   } else if (statusName.equals(REQUESTED.name())) {
     return ResponseStatus.REQUESTED;
   } else if (statusName.equals(JSON_PARSE_ERROR.name())) {
     return ResponseStatus.JSON_PARSE_ERROR;
   } else if (statusName.equals(INVALID_CALL.name())) {
     return ResponseStatus.INVALID_CALL;
   } else if (statusName.equals(INVALID_URL.name())) {
     return ResponseStatus.INVALID_URL;
   } else {
     return ResponseStatus.UNKNOWN;
   }
 }
Ejemplo n.º 3
0
  @Test
  public void test_1_UpdateItem_1_WithFile_Attached() throws IOException {
    FileDataBodyPart filePart = new FileDataBodyPart("file", ATTACHED_FILE);
    FormDataMultiPart multiPart = new FormDataMultiPart();
    multiPart.bodyPart(filePart);
    multiPart.field(
        "json",
        getStringFromPath(UPDATE_ITEM_FILE_JSON)
            .replace("___FILE_NAME___", ATTACHED_FILE.getName())
            .replace("___FETCH_URL___", "")
            .replaceAll("\"id\"\\s*:\\s*\"__ITEM_ID__\",", "")
            .replace("___REFERENCE_URL___", ""));

    Response response =
        target(PATH_PREFIX)
            .path("/" + itemId)
            .register(authAsUser)
            .register(MultiPartFeature.class)
            .register(JacksonFeature.class)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .put(Entity.entity(multiPart, multiPart.getMediaType()));

    assertEquals(OK.getStatusCode(), response.getStatus());
    DefaultItemTO itemWithFileTO = response.readEntity(DefaultItemTO.class);
    assertThat("Wrong file name", itemWithFileTO.getFilename(), equalTo(ATTACHED_FILE.getName()));
    storedFileURL = target().getUri() + itemWithFileTO.getFileUrl().getPath().substring(1);
    assertEquals(ATTACHED_FILE.length(), itemWithFileTO.getFileSize());
    // LOGGER.info(RestProcessUtils.buildJSONFromObject(itemWithFileTO));
  }
Ejemplo n.º 4
0
  @Test
  public void test_1_UpdateItem_2_WithFile_Fetched() throws ImejiException, IOException {

    initCollection();
    initItem();
    final String fileURL = target().getUri() + STATIC_CONTEXT_PATH.substring(1) + "/test2.jpg";

    FormDataMultiPart multiPart = new FormDataMultiPart();
    multiPart.field(
        "json",
        getStringFromPath(UPDATE_ITEM_FILE_JSON)
            .replace("___FILE_NAME___", UPDATED_FILE_NAME)
            .replace("___FETCH_URL___", fileURL)
            .replaceAll("\"id\"\\s*:\\s*\"__ITEM_ID__\",", "")
            .replace("___REFERENCE_URL___", ""));

    Response response =
        target(PATH_PREFIX)
            .path("/" + itemId)
            .register(authAsUser)
            .register(MultiPartFeature.class)
            .register(JacksonFeature.class)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .put(Entity.entity(multiPart, multiPart.getMediaType()));

    assertEquals(OK.getStatusCode(), response.getStatus());
    DefaultItemTO itemWithFileTO = response.readEntity(DefaultItemTO.class);
    assertThat(
        "Checksum of stored file deos not match the source file",
        itemWithFileTO.getChecksumMd5(),
        equalTo(calculateChecksum(ATTACHED_FILE)));
    // LOGGER.info(RestProcessUtils.buildJSONFromObject(itemWithFileTO));
  }
Ejemplo n.º 5
0
  @Test
  public void testCreateAndTimeoutTransaction() throws IOException, InterruptedException {

    /* create a short-lived tx */
    final long testTimeout = min(500, REAP_INTERVAL / 2);
    System.setProperty(TIMEOUT_SYSTEM_PROPERTY, Long.toString(testTimeout));

    /* create a tx */
    final String location = createTransaction();

    try (CloseableHttpResponse resp = execute(new HttpGet(location))) {
      assertEquals(OK.getStatusCode(), getStatus(resp));
      assertTrue(
          stream(resp.getHeaders(LINK))
              .anyMatch(i -> i.getValue().contains("<" + serverAddress + ">;rel=\"canonical\"")));
      consume(resp.getEntity());
    }

    sleep(REAP_INTERVAL * 2);
    try {
      assertEquals(
          "Transaction did not expire", GONE.getStatusCode(), getStatus(new HttpGet(location)));
    } finally {
      System.setProperty(TIMEOUT_SYSTEM_PROPERTY, DEFAULT_TIMEOUT);
      System.clearProperty("fcrepo.transactions.timeout");
    }
  }
Ejemplo n.º 6
0
  @Test
  public void test_2_UpdateItem_1_TypeDetection_JPG() throws IOException {

    FileDataBodyPart filePart = new FileDataBodyPart("file", ATTACHED_FILE);
    FormDataMultiPart multiPart = new FormDataMultiPart();
    multiPart.bodyPart(filePart);
    multiPart.field(
        "json",
        getStringFromPath(UPDATE_ITEM_FILE_JSON)
            .replace("___FILE_NAME___", ATTACHED_FILE.getName())
            .replace("___FETCH_URL___", "")
            .replaceAll("\"id\"\\s*:\\s*\"__ITEM_ID__\",", "")
            .replace("___REFERENCE_URL___", ""));

    Response response =
        target(PATH_PREFIX)
            .path("/" + itemId)
            .register(authAsUser)
            .register(MultiPartFeature.class)
            .register(JacksonFeature.class)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .put(Entity.entity(multiPart, multiPart.getMediaType()));

    assertEquals(OK.getStatusCode(), response.getStatus());
    DefaultItemTO itemWithFileTO = response.readEntity(DefaultItemTO.class);
    assertThat("Wrong file name", itemWithFileTO.getFilename(), equalTo(ATTACHED_FILE.getName()));
  }
Ejemplo n.º 7
0
  private boolean handleConnectOKAndExit(
      int statusCode,
      Realm realm,
      final Request request,
      HttpRequest httpRequest,
      HttpResponse response,
      final NettyResponseFuture<?> future,
      ProxyServer proxyServer,
      final Channel channel)
      throws IOException {
    if (statusCode == OK.code() && httpRequest.getMethod() == HttpMethod.CONNECT) {

      LOGGER.debug("Connected to {}:{}", proxyServer.getHost(), proxyServer.getPort());

      if (future.isKeepAlive()) {
        future.attachChannel(channel, true);
      }

      try {
        LOGGER.debug("Connecting to proxy {} for scheme {}", proxyServer, request.getUrl());
        channels.upgradeProtocol(channel.pipeline(), request.getURI().getScheme());
      } catch (Throwable ex) {
        channels.abort(future, ex);
      }
      future.setReuseChannel(true);
      future.setConnectAllowed(false);
      requestSender.sendNextRequest(new RequestBuilder(future.getRequest()).build(), future);
      return true;
    }

    return false;
  }
Ejemplo n.º 8
0
 /** {@inheritDoc} */
 public void actionPerformed(ActionEvent event) {
   String command = event.getActionCommand();
   if (OK.equals(command)) {
     getGUI().removeFromCanvas(this);
   } else {
     select(command);
   }
 }
 public void action(String command) {
   if (!OK.equalsIgnoreCase(command)) {
     super.action(command);
   } else {
     lists.saveTarget();
     setCode(0);
     dispose();
   }
 }
Ejemplo n.º 10
0
 /** {@inheritDoc} */
 @Override
 public void actionPerformed(ActionEvent event) {
   String command = event.getActionCommand();
   if (OK.equals(command)) {
     super.actionPerformed(event);
   } else {
     UnitType unitType = getSpecification().getUnitType(command);
     getGUI().showReportLabourDetailPanel(unitType, this.data, this.unitCount, this.colonies);
   }
 }
Ejemplo n.º 11
0
  @Test
  public void signOut_shouldReturnTrue_ifSignsOutBeingSignedIn() throws Exception {
    HttpRequest signUpRequest = signUpRequest("*****@*****.**", "pass");
    assertThat(signUpRequest.code()).isEqualTo(CREATED.getStatusCode());
    String token = signUpRequest.body().toString();
    assertThat(token).isNotEmpty();

    HttpRequest signOutRequest = signOutRequest(token);
    assertThat(signOutRequest.code()).isEqualTo(OK.getStatusCode());
    assertThat(signOutRequest.body()).isEqualTo("true");
  }
Ejemplo n.º 12
0
  @Test(priority = 1)
  public void givenValidGreetingHolidaysGreetingsResourceShouldReturnOK() {
    User greeting = new User("firstname", "lastname", "*****@*****.**");
    Response response =
        target("greetings")
            .path("holidays")
            .request()
            .post(entity(greeting, MediaType.APPLICATION_JSON_TYPE));

    assertThat(response.getStatus()).isEqualTo(OK.getStatusCode());
  }
Ejemplo n.º 13
0
  @Test(expected = RealmAuthenticationException.class)
  public void testNotAuthenticateWithEmptyResponse() throws RealmAuthenticationException {

    stubFor(
        post(urlEqualTo(WS_CUSTOMER_SERVICE_URL))
            .willReturn(
                aResponse()
                    .withStatus(OK.value())
                    .withHeader(ContentTypeHeader.KEY, TEXT_XML_VALUE)
                    .withBody(SOAP_EMPTY_RESPONSE)));

    customerUserRealm.authenticate(EMAIL, PASSWORD, newHashSet(UID), emptySet());
  }
Ejemplo n.º 14
0
  @Test
  public void testAuthenticate() throws RealmAuthenticationException {

    stubFor(
        post(urlEqualTo(WS_CUSTOMER_SERVICE_URL))
            .willReturn(
                aResponse()
                    .withStatus(OK.value())
                    .withHeader(ContentTypeHeader.KEY, TEXT_XML_VALUE)
                    .withBody(SOAP_RESPONSE)));

    Map<String, String> authenticate =
        customerUserRealm.authenticate(EMAIL, PASSWORD, newHashSet(UID), emptySet());
    assertThat(authenticate.get(SUB)).isEqualTo(CUSTOMER_NUMBER);
  }
 @Override
 public void operationFailed(DataOperation type, MetricOperation identifier, String message) {
   if ((type == DataOperation.Custom)
       && ((identifier == MetricOperation.WorkEffectivenessCalculated)
           || (identifier == MetricOperation.EarnedValueCalculated))) {
     _resultInput.setSelectedItem(_previous.toEngineeringString());
     OK.requestFocus();
   } else if ((type == DataOperation.Insert)
       && ((identifier == MetricOperation.ReleaseMeasure)
           || (identifier == MetricOperation.SprintMeasure)
           || (identifier == MetricOperation.TaskMeasure)
           || (identifier == MetricOperation.PBIMeasure))) {
     Util.showError(this, i18n.tr("Error while adding new measure: ") + message, i18n.tr("Error"));
   }
 }
Ejemplo n.º 16
0
  @Test
  public void test_1_UpdateItem_7_WithFile_Attached_Fetched_Referenced()
      throws IOException, ImejiException {
    initCollection();
    initItem();

    File newFile = new File(STATIC_CONTEXT_STORAGE + "/test1.jpg");
    FileDataBodyPart filePart = new FileDataBodyPart("file", newFile);

    final String fileURL = target().getUri() + STATIC_CONTEXT_PATH.substring(1) + "/test1.jpg";

    FormDataMultiPart multiPart = new FormDataMultiPart();
    multiPart.bodyPart(filePart);
    multiPart.field(
        "json",
        getStringFromPath(UPDATE_ITEM_FILE_JSON)
            .replaceAll("\"id\"\\s*:\\s*\"__ITEM_ID__\",", "")
            .replace("___FILE_NAME___", newFile.getName())
            .replace("___FETCH_URL___", fileURL)
            .replace("___REFERENCE_URL___", storedFileURL));

    Response response =
        target(PATH_PREFIX)
            .path("/" + itemId)
            .register(authAsUser)
            .register(MultiPartFeature.class)
            .register(JacksonFeature.class)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .put(Entity.entity(multiPart, multiPart.getMediaType()));

    assertEquals(OK.getStatusCode(), response.getStatus());
    DefaultItemTO itemWithFileTO = response.readEntity(DefaultItemTO.class);
    assertThat(
        "Checksum of stored file does not match the source file",
        itemWithFileTO.getChecksumMd5(),
        equalTo(calculateChecksum(newFile)));
    assertThat(itemWithFileTO.getFileUrl().toString(), not(equalTo(fileURL)));
    assertThat(itemWithFileTO.getFileUrl().toString(), not(equalTo(storedFileURL)));
    assertThat(
        itemWithFileTO.getThumbnailUrl().toString(),
        not(containsString(ItemController.NO_THUMBNAIL_URL)));
    assertThat(
        itemWithFileTO.getWebResolutionUrlUrl().toString(),
        not(containsString(ItemController.NO_THUMBNAIL_URL)));
  }
Ejemplo n.º 17
0
  /**
   * Tests that transactions are treated as atomic with regards to nodes. A common use case for
   * applications written against fedora is that an operation checks some property of a fedora
   * object and acts on it accordingly. In order for this to work in a multi-client or
   * multi-threaded environment that comparison+action combination needs to be atomic. Imagine a
   * scenario where we have one process that deletes all objects in the repository that don't have a
   * "preserve" property set to the literal "true", and we have any number of other clients that add
   * such a property. We want to ensure that there is no way for a client to successfully add this
   * property between when the "deleter" process has determined that no such property exists and
   * when it deletes the object. In other words, if there are only clients adding properties and the
   * "deleter" deleting objects it should not be possible for an object to be deleted if a client
   * has added a title and received a successful http response code.
   *
   * @throws IOException exception thrown during this function
   */
  @Test
  @Ignore("Until we implement some kind of record level locking.")
  public void testTransactionAndConcurrentConflictingUpdate() throws IOException {
    final String preserveProperty = "preserve";
    final String preserveValue = "true";

    /* create the object in question */
    final String objId = getRandomUniqueId();
    createObject(objId);

    /* create the deleter transaction */
    final String deleterTxLocation = createTransaction();
    final String deleterTxId = deleterTxLocation.substring(serverAddress.length());

    /* assert that the object is eligible for delete in the transaction */
    verifyProperty(
        "No preserve property should be set!",
        objId,
        deleterTxId,
        preserveProperty,
        preserveValue,
        false);

    /* delete that object in the transaction */
    assertEquals(
        NO_CONTENT.getStatusCode(), getStatus(new HttpDelete(deleterTxLocation + "/" + objId)));

    /* fetch the object-deleted-in-tx outside of the tx */
    assertEquals(
        "Expected to find our object outside the scope of the tx,"
            + " despite it being deleted in the uncommitted transaction.",
        OK.getStatusCode(),
        getStatus(new HttpGet(serverAddress + objId)));

    /* mark the object as not deletable outside the context of the transaction */
    setProperty(objId, preserveProperty, preserveValue);
    /* commit that transaction */
    assertNotEquals(
        "Transaction is not atomic with regards to the object!",
        NO_CONTENT.getStatusCode(),
        getStatus(new HttpPost(deleterTxLocation + "/fcr:tx/fcr:commit")));
  }
  public ImpedimentStatusRemove(JFrame parent) {
    super(parent);
    setTitle(i18n.tr("Remove Impediment Status"));

    Models m = Scrummer.getModels();
    _impedimentModel = m.getImpedimentModel();
    _impedimentModel.addImpedimentListener(this);

    int k = 10;
    Panel.setBorder(
        Util.createSpacedTitleBorder(k, k, k, k, i18n.tr("Impediment Status"), 0, k, k, k));

    FormBuilder fb = new FormBuilder(Panel);
    _impedimentStatusInput = fb.addComboBoxInput(i18n.tr("Status") + ":");
    _impedimentStatusInput.setIVModel(_impedimentModel.getImpedimentStatusComboBoxModel());

    BottomPanel.setBorder(BorderFactory.createEmptyBorder(0, k, k, k - 3));

    OK.setText(i18n.tr("Remove"));
    setSize(320, 150);
  }
Ejemplo n.º 19
0
  /** {@code host} header is not specified in HTTP 1.0 */
  @Test
  public void noHostHeaderOn10Request() throws Exception {
    final AtomicReference<RequestHandler> requestHandlerRef = new AtomicReference<>();
    when(mockHttpListenerConfig.addRequestHandler(
            any(ListenerRequestMatcher.class), any(RequestHandler.class)))
        .then(
            new Answer<RequestHandlerManager>() {
              @Override
              public RequestHandlerManager answer(InvocationOnMock invocation) throws Throwable {
                requestHandlerRef.set((RequestHandler) invocation.getArguments()[1]);
                return null;
              }
            });
    usePath("/");

    HttpRequest request = buildGetRootRequest(HTTP_1_0);
    HttpRequestContext requestContext = buildRequestContext(request);

    HttpResponseReadyCallback responseCallback = mock(HttpResponseReadyCallback.class);
    requestHandlerRef.get().handleRequest(requestContext, responseCallback);
    assertResponse(responseCallback, OK.getStatusCode());
  }
Ejemplo n.º 20
0
  @Test
  public void test_1_UpdateItem_3_WithFile_Referenced() throws IOException {

    FormDataMultiPart multiPart = new FormDataMultiPart();
    multiPart.field(
        "json",
        getStringFromPath(UPDATE_ITEM_FILE_JSON)
            .replace("___FILE_NAME___", UPDATED_FILE_NAME)
            .replace("___FETCH_URL___", "")
            .replaceAll("\"id\"\\s*:\\s*\"__ITEM_ID__\",", "")
            .replace("___REFERENCE_URL___", storedFileURL));

    Response response =
        target(PATH_PREFIX)
            .path("/" + itemId)
            .register(authAsUser)
            .register(MultiPartFeature.class)
            .register(JacksonFeature.class)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .put(Entity.entity(multiPart, multiPart.getMediaType()));

    assertEquals(OK.getStatusCode(), response.getStatus());
    DefaultItemTO itemWithFileTO = response.readEntity(DefaultItemTO.class);
    assertThat(
        "Reference URL does not match",
        storedFileURL,
        equalTo(itemWithFileTO.getFileUrl().toString()));
    assertThat(
        "Should be link to NO_THUMBNAIL image:",
        itemWithFileTO.getWebResolutionUrlUrl().toString(),
        endsWith(ItemController.NO_THUMBNAIL_URL));
    assertThat(
        "Should be link to NO_THUMBNAIL image:",
        itemWithFileTO.getThumbnailUrl().toString(),
        endsWith(ItemController.NO_THUMBNAIL_URL));
  }
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  private void initComponents() { // GEN-BEGIN:initComponents
    java.awt.GridBagConstraints gridBagConstraints;

    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    TopPanel = new javax.swing.JPanel();
    TopRightPanel = new javax.swing.JPanel();
    OtherDateChooser = new com.toedter.calendar.JDateChooser();
    TopLeftPanel = new javax.swing.JPanel();
    InvoiceLB = new javax.swing.JLabel();
    InvoiceTF = new javax.swing.JTextField();
    BottomPanel = new javax.swing.JPanel();
    Cancel = new javax.swing.JButton();
    OK = new javax.swing.JButton();
    DummyLeftLabel = new javax.swing.JLabel();
    RightDummyLabel = new javax.swing.JLabel();
    TaxPanel = new javax.swing.JPanel();
    AmountLabel = new javax.swing.JLabel();
    AmountTF = new javax.swing.JTextField();
    DescriptionLabel = new javax.swing.JLabel();
    DescriptionArea = new javax.swing.JTextArea();
    IncomeTransactionLabel = new javax.swing.JLabel();

    jMenu1.setText("Menu");
    jMenuBar1.add(jMenu1);

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Income Dialog");
    TopPanel.setLayout(new java.awt.BorderLayout());

    TopRightPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10));

    OtherDateChooser.setPreferredSize(new java.awt.Dimension(151, 20));
    TopRightPanel.add(OtherDateChooser);

    TopPanel.add(TopRightPanel, java.awt.BorderLayout.EAST);

    TopLeftPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10));

    InvoiceLB.setText("Invoice : ");
    TopLeftPanel.add(InvoiceLB);

    InvoiceTF.setColumns(12);
    TopLeftPanel.add(InvoiceTF);

    TopPanel.add(TopLeftPanel, java.awt.BorderLayout.WEST);

    getContentPane().add(TopPanel, java.awt.BorderLayout.NORTH);

    BottomPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 10, 10));

    Cancel.setText("Cancel");
    Cancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelActionPerformed(evt);
          }
        });

    BottomPanel.add(Cancel);

    OK.setText("OK");
    OK.setPreferredSize(new java.awt.Dimension(75, 25));
    OK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKActionPerformed(evt);
          }
        });

    BottomPanel.add(OK);

    getContentPane().add(BottomPanel, java.awt.BorderLayout.SOUTH);

    DummyLeftLabel.setText("     ");
    getContentPane().add(DummyLeftLabel, java.awt.BorderLayout.WEST);

    RightDummyLabel.setText("     ");
    getContentPane().add(RightDummyLabel, java.awt.BorderLayout.EAST);

    TaxPanel.setLayout(new java.awt.GridBagLayout());

    AmountLabel.setText("Amount of Transactions :");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    TaxPanel.add(AmountLabel, gridBagConstraints);

    AmountTF.setColumns(24);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    TaxPanel.add(AmountTF, gridBagConstraints);

    DescriptionLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    DescriptionLabel.setText("Description :");
    DescriptionLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10);
    TaxPanel.add(DescriptionLabel, gridBagConstraints);

    DescriptionArea.setColumns(24);
    DescriptionArea.setLineWrap(true);
    DescriptionArea.setRows(5);
    DescriptionArea.setWrapStyleWord(true);
    DescriptionArea.setBorder(new javax.swing.border.EtchedBorder());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridheight = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    TaxPanel.add(DescriptionArea, gridBagConstraints);

    IncomeTransactionLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    IncomeTransactionLabel.setText("Income Transaction");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    TaxPanel.add(IncomeTransactionLabel, gridBagConstraints);

    getContentPane().add(TaxPanel, java.awt.BorderLayout.CENTER);

    pack();
  } // GEN-END:initComponents
  // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    BottomPanel = new javax.swing.JPanel();
    Cancel = new javax.swing.JButton();
    OK = new javax.swing.JButton();
    DummyTopLabel = new javax.swing.JLabel();
    LeftDummyLabel = new javax.swing.JLabel();
    RightDummyLabel = new javax.swing.JLabel();
    ItemTabbedPane = new javax.swing.JTabbedPane();
    ItemPanel = new javax.swing.JPanel();
    ItemCodeLabel = new javax.swing.JLabel();
    itemCodeTF = new javax.swing.JTextField();
    nameLabel = new javax.swing.JLabel();
    nameTF = new javax.swing.JTextField();
    buyingPriceLabel = new javax.swing.JLabel();
    buyingPriceTF = new javax.swing.JTextField();
    salePriceLabel = new javax.swing.JLabel();
    salePriceTF = new javax.swing.JTextField();
    commentLabel = new javax.swing.JLabel();
    commentTA = new javax.swing.JTextArea();
    Notes1 = new javax.swing.JLabel();
    Notes2 = new javax.swing.JLabel();
    categoryLabel = new javax.swing.JLabel();
    categoryTF = new javax.swing.JTextField();
    AdditionalPropertiesPanel = new javax.swing.JPanel();
    DetailSizeCheckBox = new javax.swing.JCheckBox();
    LengthLabel = new javax.swing.JLabel();
    LengthTF = new javax.swing.JTextField();
    WidthLabel = new javax.swing.JLabel();
    WidthTF = new javax.swing.JTextField();
    HeightLabel = new javax.swing.JLabel();
    HeightTF = new javax.swing.JTextField();
    VolumeCheckBox = new javax.swing.JCheckBox();
    VolumeLabel = new javax.swing.JLabel();
    VolumeTF = new javax.swing.JTextField();
    PrimaryMeasurementLabel = new javax.swing.JLabel();
    PrimaryTF = new javax.swing.JTextField();
    MeasurementLabel = new javax.swing.JLabel();
    MeasurementTF = new javax.swing.JTextField();
    SecondaryMeasurementLabel = new javax.swing.JLabel();
    SecondaryTF = new javax.swing.JTextField();
    Notes3 = new javax.swing.JLabel();
    Notes4 = new javax.swing.JLabel();
    Secondary_Third_Measurement_Label = new javax.swing.JLabel();
    Third_Measurement_Label = new javax.swing.JLabel();
    SecondaryThirdMeasurementTF = new javax.swing.JTextField();
    ThirdTF = new javax.swing.JTextField();
    OtherPanel = new javax.swing.JPanel();
    ProducerLB = new javax.swing.JLabel();
    AvailableSeller = new javax.swing.JScrollPane();
    AvSel = new javax.swing.JList(listModel);
    AddSeller = new javax.swing.JButton();
    RemoveSeller = new javax.swing.JButton();
    ListSeller = new javax.swing.JScrollPane();
    LsSel = new javax.swing.JList(itemsellerModel);
    AvailableSellers = new javax.swing.JLabel();
    ItemSellers = new javax.swing.JLabel();
    ProducerCoB = new javax.swing.JComboBox();
    QuantityPanel = new javax.swing.JPanel();
    QuantityTablePanel = new javax.swing.JPanel();
    QuantityScrollPane = new javax.swing.JScrollPane();
    QuantityTB = new javax.swing.JTable();
    PropertiesPanel = new javax.swing.JPanel();
    WarehouseCB = new javax.swing.JComboBox();
    QuantityLB = new javax.swing.JLabel();
    QuantityButtonPanel = new javax.swing.JPanel();
    QuantityAddButton = new javax.swing.JButton();
    QuantityEditButton = new javax.swing.JButton();
    QuantityDeleteButton = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Edit Item");
    BottomPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 10, 10));

    Cancel.setText("Cancel");
    Cancel.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CancelActionPerformed(evt);
          }
        });

    BottomPanel.add(Cancel);

    OK.setText("OK");
    OK.setPreferredSize(new java.awt.Dimension(75, 25));
    OK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            OKActionPerformed(evt);
          }
        });

    BottomPanel.add(OK);

    getContentPane().add(BottomPanel, java.awt.BorderLayout.SOUTH);

    DummyTopLabel.setText("                ");
    getContentPane().add(DummyTopLabel, java.awt.BorderLayout.NORTH);

    LeftDummyLabel.setText("     ");
    getContentPane().add(LeftDummyLabel, java.awt.BorderLayout.WEST);

    RightDummyLabel.setText("     ");
    getContentPane().add(RightDummyLabel, java.awt.BorderLayout.EAST);

    ItemPanel.setLayout(new java.awt.GridBagLayout());

    ItemPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    ItemCodeLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    ItemCodeLabel.setText("* Item Code : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 10);
    ItemPanel.add(ItemCodeLabel, gridBagConstraints);

    itemCodeTF.setColumns(12);
    itemCodeTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0);
    ItemPanel.add(itemCodeTF, gridBagConstraints);

    nameLabel.setText("* Name : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    ItemPanel.add(nameLabel, gridBagConstraints);

    nameTF.setColumns(12);
    nameTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    ItemPanel.add(nameTF, gridBagConstraints);

    buyingPriceLabel.setText("* Buying Price : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 10);
    ItemPanel.add(buyingPriceLabel, gridBagConstraints);

    buyingPriceTF.setColumns(12);
    buyingPriceTF.setFont(new java.awt.Font("Dialog", 1, 12));
    buyingPriceTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 0);
    ItemPanel.add(buyingPriceTF, gridBagConstraints);

    salePriceLabel.setText("* Sale Price : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 10);
    ItemPanel.add(salePriceLabel, gridBagConstraints);

    salePriceTF.setColumns(12);
    salePriceTF.setFont(new java.awt.Font("Dialog", 1, 12));
    salePriceTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 20, 0);
    ItemPanel.add(salePriceTF, gridBagConstraints);

    commentLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    commentLabel.setText("Comment : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10);
    ItemPanel.add(commentLabel, gridBagConstraints);

    commentTA.setColumns(16);
    commentTA.setLineWrap(true);
    commentTA.setRows(6);
    commentTA.setTabSize(4);
    commentTA.setWrapStyleWord(true);
    commentTA.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    ItemPanel.add(commentTA, gridBagConstraints);

    Notes1.setText("Fields marked with an asterisk * are required.");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.gridwidth = 2;
    ItemPanel.add(Notes1, gridBagConstraints);

    Notes2.setText(
        "<html><center>Choose either Detail of Size checkbox <br>\nor Volume checkbox then fill all the text <br>\nfields of that checkbox!</center></html>");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.gridwidth = 2;
    ItemPanel.add(Notes2, gridBagConstraints);

    categoryLabel.setText("* Category : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    ItemPanel.add(categoryLabel, gridBagConstraints);

    categoryTF.setColumns(12);
    categoryTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    ItemPanel.add(categoryTF, gridBagConstraints);

    ItemTabbedPane.addTab("Item", ItemPanel);

    AdditionalPropertiesPanel.setLayout(new java.awt.GridBagLayout());

    DetailSizeCheckBox.setText("Detail of Size");
    DetailSizeCheckBox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            DetailSizeCheckBoxActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    AdditionalPropertiesPanel.add(DetailSizeCheckBox, gridBagConstraints);

    LengthLabel.setText("Length : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(LengthLabel, gridBagConstraints);

    LengthTF.setColumns(12);
    LengthTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(LengthTF, gridBagConstraints);

    WidthLabel.setText("Width : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(WidthLabel, gridBagConstraints);

    WidthTF.setColumns(12);
    WidthTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(WidthTF, gridBagConstraints);

    HeightLabel.setText("Height : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(HeightLabel, gridBagConstraints);

    HeightTF.setColumns(12);
    HeightTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(HeightTF, gridBagConstraints);

    VolumeCheckBox.setText("Volume");
    VolumeCheckBox.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            VolumeCheckBoxActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    AdditionalPropertiesPanel.add(VolumeCheckBox, gridBagConstraints);

    VolumeLabel.setText("Volume : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(VolumeLabel, gridBagConstraints);

    VolumeTF.setColumns(12);
    VolumeTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(VolumeTF, gridBagConstraints);

    PrimaryMeasurementLabel.setText("* Primary Measurement : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(PrimaryMeasurementLabel, gridBagConstraints);

    PrimaryTF.setColumns(12);
    PrimaryTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(PrimaryTF, gridBagConstraints);

    MeasurementLabel.setText("* P = S : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(MeasurementLabel, gridBagConstraints);

    MeasurementTF.setColumns(12);
    MeasurementTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 7;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(MeasurementTF, gridBagConstraints);

    SecondaryMeasurementLabel.setText("* Secondary Measurement : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(SecondaryMeasurementLabel, gridBagConstraints);

    SecondaryTF.setColumns(12);
    SecondaryTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 8;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(SecondaryTF, gridBagConstraints);

    Notes3.setText(
        "<html><center>Choose either Detail of Size checkbox <br>\nor Volume checkbox then fill all the text <br>\nfields of that checkbox!</center></html>");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 12;
    gridBagConstraints.gridwidth = 2;
    AdditionalPropertiesPanel.add(Notes3, gridBagConstraints);

    Notes4.setText("Fields marked with an asterisk * are required.");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 11;
    gridBagConstraints.gridwidth = 2;
    AdditionalPropertiesPanel.add(Notes4, gridBagConstraints);

    Secondary_Third_Measurement_Label.setText("S = T : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(Secondary_Third_Measurement_Label, gridBagConstraints);

    Third_Measurement_Label.setText("Third Measurement : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 10);
    AdditionalPropertiesPanel.add(Third_Measurement_Label, gridBagConstraints);

    SecondaryThirdMeasurementTF.setColumns(12);
    SecondaryThirdMeasurementTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 9;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(SecondaryThirdMeasurementTF, gridBagConstraints);

    ThirdTF.setColumns(12);
    ThirdTF.setHorizontalAlignment(javax.swing.JTextField.LEFT);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 10;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0);
    AdditionalPropertiesPanel.add(ThirdTF, gridBagConstraints);

    ItemTabbedPane.addTab("Additional Properties", AdditionalPropertiesPanel);

    OtherPanel.setLayout(new java.awt.GridBagLayout());

    ProducerLB.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    ProducerLB.setText("Producer : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    OtherPanel.add(ProducerLB, gridBagConstraints);

    AvailableSeller.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    AvailableSeller.setPreferredSize(new java.awt.Dimension(200, 100));
    AvSel.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    AvSel.setVisibleRowCount(-1);
    AvailableSeller.setViewportView(AvSel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(10, 20, 0, 20);
    OtherPanel.add(AvailableSeller, gridBagConstraints);

    AddSeller.setText(">");
    AddSeller.setName("toRight");
    AddSeller.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            MoveSellerActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
    OtherPanel.add(AddSeller, gridBagConstraints);

    RemoveSeller.setText("<");
    RemoveSeller.setName("toLeft");
    RemoveSeller.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            MoveSellerActionPerformed(evt);
          }
        });

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    OtherPanel.add(RemoveSeller, gridBagConstraints);

    ListSeller.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    ListSeller.setPreferredSize(new java.awt.Dimension(200, 100));
    LsSel.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    LsSel.setVisibleRowCount(-1);
    ListSeller.setViewportView(LsSel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(10, 20, 0, 20);
    OtherPanel.add(ListSeller, gridBagConstraints);

    AvailableSellers.setText("Available Sellers : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
    OtherPanel.add(AvailableSellers, gridBagConstraints);

    ItemSellers.setText("Item Sellers : ");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
    OtherPanel.add(ItemSellers, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    OtherPanel.add(ProducerCoB, gridBagConstraints);

    ItemTabbedPane.addTab("Producer & Seller", OtherPanel);

    QuantityTablePanel.setLayout(new java.awt.BorderLayout());

    QuantityTB.setModel(
        new javax.swing.table.DefaultTableModel(
            new Object[][] {
              {null, null},
              {null, null},
              {null, null},
              {null, null}
            },
            new String[] {"Date", "Quantity"}) {
          Class[] types = new Class[] {java.lang.String.class, java.lang.Integer.class};
          boolean[] canEdit = new boolean[] {false, false};

          public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
          }

          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
          }
        });
    QuantityScrollPane.setViewportView(QuantityTB);

    QuantityTablePanel.add(QuantityScrollPane, java.awt.BorderLayout.CENTER);

    WarehouseCB.setModel(
        new javax.swing.DefaultComboBoxModel(
            new String[] {"Item 1", "Item 2", "Item 3", "Item 4"}));
    WarehouseCB.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            WarehouseCBActionPerformed(evt);
          }
        });

    PropertiesPanel.add(WarehouseCB);

    QuantityLB.setText("jLabel1");
    PropertiesPanel.add(QuantityLB);

    QuantityTablePanel.add(PropertiesPanel, java.awt.BorderLayout.NORTH);

    QuantityAddButton.setText("Add");
    QuantityAddButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            QuantityAddButtonActionPerformed(evt);
          }
        });

    QuantityButtonPanel.add(QuantityAddButton);

    QuantityEditButton.setText("Edit");
    QuantityEditButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            QuantityEditButtonActionPerformed(evt);
          }
        });

    QuantityButtonPanel.add(QuantityEditButton);

    QuantityDeleteButton.setText("Delete");
    QuantityDeleteButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            QuantityDeleteButtonActionPerformed(evt);
          }
        });

    QuantityButtonPanel.add(QuantityDeleteButton);

    QuantityTablePanel.add(QuantityButtonPanel, java.awt.BorderLayout.SOUTH);

    QuantityPanel.add(QuantityTablePanel);

    ItemTabbedPane.addTab("Quantity", QuantityPanel);

    getContentPane().add(ItemTabbedPane, java.awt.BorderLayout.CENTER);

    pack();
  } // </editor-fold>//GEN-END:initComponents
Ejemplo n.º 23
0
@Test(groups = "unit", testName = "ZoneApiExpectTest")
public class ZoneApiExpectTest extends BaseDynECTApiExpectTest {
  HttpRequest get =
      HttpRequest.builder()
          .method(GET)
          .endpoint("https://api2.dynect.net/REST/Zone/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader(CONTENT_TYPE, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .build();

  HttpResponse getResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(payloadFromResourceWithContentType("/get_zone.json", APPLICATION_JSON))
          .build();

  public void testGetWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, get, getResponse);
    assertEquals(
        success.getZoneApi().get("jclouds.org").toString(),
        new GetZoneResponseTest().expected().toString());
  }

  HttpRequest create =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://api2.dynect.net/REST/Zone/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader(ACCEPT, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .payload(
              stringPayload(
                  "{\"rname\":\"[email protected]\",\"serial_style\":\"increment\",\"ttl\":3600}"))
          .build();

  HttpResponse createResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(payloadFromResourceWithContentType("/new_zone.json", APPLICATION_JSON))
          .build();

  public void testCreateWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, create, createResponse);
    assertEquals(
        success
            .getZoneApi()
            .scheduleCreate(
                CreatePrimaryZone.builder()
                    .fqdn("jclouds.org")
                    .contact("*****@*****.**")
                    .build()),
        Job.success(285351593L));
  }

  public void testCreateWithContactWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, create, createResponse);
    assertEquals(
        success.getZoneApi().scheduleCreateWithContact("jclouds.org", "*****@*****.**"),
        Job.success(285351593L));
  }

  public void testGetWhenResponseIs404() {
    DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, get, notFound);
    assertNull(fail.getZoneApi().get("jclouds.org"));
  }

  HttpRequest list =
      HttpRequest.builder()
          .method(GET)
          .endpoint("https://api2.dynect.net/REST/Zone")
          .addHeader("API-Version", "3.3.8")
          .addHeader(CONTENT_TYPE, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .build();

  HttpResponse listResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(payloadFromResourceWithContentType("/list_zones.json", APPLICATION_JSON))
          .build();

  public void testListWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, list, listResponse);
    assertEquals(
        success.getZoneApi().list().toString(), new ListZonesResponseTest().expected().toString());
  }

  HttpRequest deleteChanges =
      HttpRequest.builder()
          .method(DELETE)
          .endpoint("https://api2.dynect.net/REST/ZoneChanges/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader(ACCEPT, APPLICATION_JSON)
          .addHeader(CONTENT_TYPE, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .build();

  HttpResponse deleteChangesResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(
              payloadFromResourceWithContentType("/delete_zone_changes.json", APPLICATION_JSON))
          .build();

  public void testDeleteChangesWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(
            createSession, createSessionResponse, deleteChanges, deleteChangesResponse);
    assertEquals(
        success.getZoneApi().deleteChanges("jclouds.org").toString(),
        new DeleteZoneChangesResponseTest().expected().toString());
  }

  HttpRequest delete =
      HttpRequest.builder()
          .method(DELETE)
          .endpoint("https://api2.dynect.net/REST/Zone/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader(ACCEPT, APPLICATION_JSON)
          .addHeader(CONTENT_TYPE, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .build();

  HttpResponse deleteResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(payloadFromResourceWithContentType("/delete_zone.json", APPLICATION_JSON))
          .build();

  public void testDeleteWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, delete, deleteResponse);
    assertEquals(
        success.getZoneApi().delete("jclouds.org").toString(),
        new DeleteZoneResponseTest().expected().toString());
  }

  public void testDeleteWhenResponseIs404() {
    DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, delete, notFound);
    assertNull(fail.getZoneApi().delete("jclouds.org"));
  }

  HttpRequest publish =
      HttpRequest.builder()
          .method(PUT)
          .endpoint("https://api2.dynect.net/REST/Zone/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader("Auth-Token", authToken)
          .payload(stringPayload("{\"publish\":true}"))
          .build();

  public void testPublishWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, publish, getResponse);
    assertEquals(
        success.getZoneApi().publish("jclouds.org").toString(),
        new GetZoneResponseTest().expected().toString());
  }

  HttpRequest freeze =
      HttpRequest.builder()
          .method(PUT)
          .endpoint("https://api2.dynect.net/REST/Zone/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader(ACCEPT, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .payload(stringPayload("{\"freeze\":true}"))
          .build();

  public void testFreezeWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, freeze, deleteResponse);
    assertEquals(
        success.getZoneApi().freeze("jclouds.org").toString(),
        new DeleteZoneResponseTest().expected().toString());
  }

  HttpRequest thaw =
      HttpRequest.builder()
          .method(PUT)
          .endpoint("https://api2.dynect.net/REST/Zone/jclouds.org")
          .addHeader("API-Version", "3.3.8")
          .addHeader(ACCEPT, APPLICATION_JSON)
          .addHeader("Auth-Token", authToken)
          .payload(stringPayload("{\"thaw\":true}"))
          .build();

  public void testThawWhenResponseIs2xx() {
    DynECTApi success =
        requestsSendResponses(createSession, createSessionResponse, thaw, deleteResponse);
    assertEquals(
        success.getZoneApi().thaw("jclouds.org").toString(),
        new DeleteZoneResponseTest().expected().toString());
  }
}
/** @author Adrian Cole */
@Test(groups = "unit", testName = "DirectionalPoolApiExpectTest")
public class DirectionalPoolApiExpectTest extends BaseUltraDNSWSApiExpectTest {
  HttpRequest create =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType("/create_directionalpool.xml", "application/xml"))
          .build();

  HttpResponse createResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(
              payloadFromResourceWithContentType("/directionalpool_created.xml", "application/xml"))
          .build();

  public void testCreateWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(create, createResponse);
    assertEquals(
        success
            .getDirectionalPoolApiForZone("jclouds.org.")
            .createForDNameAndType("foo", "www.jclouds.org.", IPV4.getCode()),
        "06063DC355055E68");
  }

  HttpResponse alreadyCreated =
      HttpResponse.builder()
          .statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
          .payload(
              payloadFromResourceWithContentType(
                  "/directionalpool_already_exists.xml", "application/xml"))
          .build();

  @Test(
      expectedExceptions = ResourceAlreadyExistsException.class,
      expectedExceptionsMessageRegExp =
          "Pool already created for this host name : www.jclouds.org.")
  public void testCreateWhenResponseError2912() {
    UltraDNSWSApi already = requestSendsResponse(create, alreadyCreated);
    already
        .getDirectionalPoolApiForZone("jclouds.org.")
        .createForDNameAndType("foo", "www.jclouds.org.", IPV4.getCode());
  }

  HttpRequest addFirstRecordInNonConfiguredGroup =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType(
                  "/create_directionalrecord.xml", "application/xml"))
          .build();

  HttpResponse recordCreatedResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(
              payloadFromResourceWithContentType(
                  "/directionalrecord_created.xml", "application/xml"))
          .build();

  DirectionalPoolRecord record =
      DirectionalPoolRecord.drBuilder().type("A").ttl(300).rdata("1.1.0.1").build();

  public void testAddFirstRecordInNonConfiguredGroupWhenResponseIs2xx() {
    UltraDNSWSApi success =
        requestSendsResponse(addFirstRecordInNonConfiguredGroup, recordCreatedResponse);
    assertEquals(
        success
            .getDirectionalPoolApiForZone("jclouds.org.")
            .addFirstRecordInNonConfiguredGroup("06063DC355055E68", record),
        "06063DC355058294");
  }

  HttpResponse recordAlreadyCreated =
      HttpResponse.builder()
          .statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
          .payload(
              payloadFromResourceWithContentType(
                  "/directionalrecord_already_exists.xml", "application/xml"))
          .build();

  @Test(
      expectedExceptions = ResourceAlreadyExistsException.class,
      expectedExceptionsMessageRegExp = "Resource Record already exists.")
  public void testAddFirstRecordInNonConfiguredGroupWhenResponseError1802() {
    UltraDNSWSApi already =
        requestSendsResponse(addFirstRecordInNonConfiguredGroup, recordAlreadyCreated);
    already
        .getDirectionalPoolApiForZone("jclouds.org.")
        .addFirstRecordInNonConfiguredGroup("06063DC355055E68", record);
  }

  HttpRequest addRecordIntoNewGroup =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType(
                  "/create_directionalrecord_newgroup.xml", "application/xml"))
          .build();

  DirectionalGroup group =
      DirectionalGroup.builder()
          .name("Mexas")
          .description("Clients we classify as being in US")
          .mapRegionToTerritories("United States (US)", ImmutableSet.of("Maryland", "Texas"))
          .build();

  public void testAddRecordIntoNewGroupWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(addRecordIntoNewGroup, recordCreatedResponse);
    assertEquals(
        success
            .getDirectionalPoolApiForZone("jclouds.org.")
            .addRecordIntoNewGroup("06063DC355055E68", record, group),
        "06063DC355058294");
  }

  HttpRequest addRecordIntoExistingGroup =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType(
                  "/create_directionalrecord_existinggroup.xml", "application/xml"))
          .build();

  public void testAddRecordIntoExistingGroupWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(addRecordIntoExistingGroup, recordCreatedResponse);
    assertEquals(
        success
            .getDirectionalPoolApiForZone("jclouds.org.")
            .addRecordIntoExistingGroup("06063DC355055E68", record, "AAABBBCCCDDDEEE"),
        "06063DC355058294");
  }

  HttpRequest updateRecord =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType(
                  "/update_directionalrecord.xml", "application/xml"))
          .build();

  HttpResponse updateRecordResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(
              payloadFromResourceWithContentType(
                  "/directionalrecord_updated.xml", "application/xml"))
          .build();

  public void testUpdateRecordWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(updateRecord, updateRecordResponse);
    success.getDirectionalPoolApiForZone("jclouds.org.").updateRecord("04053D8E57C7931F", record);
  }

  HttpResponse recordDoesntExist =
      HttpResponse.builder()
          .message("Server Error")
          .statusCode(INTERNAL_SERVER_ERROR.getStatusCode())
          .payload(payloadFromResource("/directionalrecord_doesnt_exist.xml"))
          .build();

  @Test(
      expectedExceptions = ResourceNotFoundException.class,
      expectedExceptionsMessageRegExp = "Directional Pool Record does not exist in the system")
  public void testUpdateRecordWhenResponseNotFound() {
    UltraDNSWSApi notFound = requestSendsResponse(updateRecord, recordDoesntExist);
    notFound.getDirectionalPoolApiForZone("jclouds.org.").updateRecord("04053D8E57C7931F", record);
  }

  HttpRequest updateRecordAndGroup =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType(
                  "/update_directionalrecord_group.xml", "application/xml"))
          .build();

  public void testUpdateRecordAndGroupWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(updateRecordAndGroup, updateRecordResponse);
    success
        .getDirectionalPoolApiForZone("jclouds.org.")
        .updateRecordAndGroup("04053D8E57C7931F", record, group);
  }

  HttpRequest deleteRecord =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType(
                  "/delete_directionalrecord.xml", "application/xml"))
          .build();

  HttpResponse deleteRecordResponse =
      HttpResponse.builder()
          .statusCode(404)
          .payload(
              payloadFromResourceWithContentType(
                  "/directionalrecord_deleted.xml", "application/xml"))
          .build();

  public void testDeleteRecordWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(deleteRecord, deleteRecordResponse);
    success.getDirectionalPoolApiForZone("jclouds.org.").deleteRecord("04053D8E57C7931F");
  }

  public void testDeleteRecordWhenResponseNotFound() {
    UltraDNSWSApi notFound = requestSendsResponse(deleteRecord, recordDoesntExist);
    notFound.getDirectionalPoolApiForZone("jclouds.org.").deleteRecord("04053D8E57C7931F");
  }

  HttpRequest list =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType("/list_directionalpools.xml", "application/xml"))
          .build();

  HttpResponse listResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(payloadFromResourceWithContentType("/directionalpools.xml", "application/xml"))
          .build();

  public void testListWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(list, listResponse);

    assertEquals(
        success.getDirectionalPoolApiForZone("jclouds.org.").list().toString(),
        new GetDirectionalPoolsByZoneResponseTest().expected().toString());
  }

  HttpRequest listRecords =
      HttpRequest.builder()
          .method(POST)
          .endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
          .addHeader(HOST, "ultra-api.ultradns.com:8443")
          .payload(
              payloadFromResourceWithContentType("/list_directionalrecords.xml", "application/xml"))
          .build();

  HttpResponse listRecordsResponse =
      HttpResponse.builder()
          .statusCode(OK.getStatusCode())
          .payload(payloadFromResourceWithContentType("/directionalrecords.xml", "application/xml"))
          .build();

  public void testListRecordsWhenResponseIs2xx() {
    UltraDNSWSApi success = requestSendsResponse(listRecords, listRecordsResponse);

    assertEquals(
        success
            .getDirectionalPoolApiForZone("jclouds.org.")
            .listRecordsByDNameAndType("www.jclouds.org.", 1)
            .toString(),
        new GetDirectionalDNSRecordsForHostResponseTest().expected().toString());
  }
}