Exemplo n.º 1
0
 private NetworkApplicationEntity mkStgCmtAE(Association as) {
   NetworkApplicationEntity stgcmtAE = new NetworkApplicationEntity();
   NetworkConnection stgcmtNC = new NetworkConnection();
   stgcmtNC.setHostname(as.getSocket().getInetAddress().getHostAddress());
   stgcmtNC.setPort(stgcmtPort);
   stgcmtNC.setTlsCipherSuite(nc.getTlsCipherSuite());
   stgcmtAE.setNetworkConnection(stgcmtNC);
   stgcmtAE.setAETitle(as.getRemoteAET());
   stgcmtAE.setTransferCapability(
       new TransferCapability[] {
         new TransferCapability(
             UID.StorageCommitmentPushModelSOPClass, ONLY_DEF_TS, TransferCapability.SCU)
       });
   return stgcmtAE;
 }
Exemplo n.º 2
0
 public final void setHostname(String hostname) {
   nc.setHostname(hostname);
 }
Exemplo n.º 3
0
  public void testRetrieveInputObjectsFromObjectStore() {
    String[] DEF_TS = {UID.ImplicitVRLittleEndian, UID.ExplicitVRLittleEndian};

    PlanArchiveSim pas = new PlanArchiveSim("PAS", "localhost", 40406);
    try {
      pas.start();
    } catch (IOException e1) {
      e1.printStackTrace();
      assertTrue(false);
    }

    PlanHolderSim phs = new PlanHolderSim("PHS", "localhost", 40407);
    try {
      phs.start();
    } catch (IOException e1) {
      e1.printStackTrace();
      assertTrue(false);
    }

    String name = "TestSCUCMovePlan";
    Device device = new Device(name);

    Executor executor = new NewThreadExecutor(name);
    NetworkApplicationEntity ae = new NetworkApplicationEntity();
    NetworkConnection localConn = new NetworkConnection();

    device.setNetworkApplicationEntity(ae);
    device.setNetworkConnection(localConn);

    ae.setNetworkConnection(localConn);
    ae.setAssociationInitiator(true);
    ae.setAssociationAcceptor(false);
    ae.setAETitle(name);
    ae.setTransferCapability(
        new TransferCapability[] {
          new TransferCapability(
              UID.StudyRootQueryRetrieveInformationModelMOVE, DEF_TS, TransferCapability.SCU)
        });

    NetworkApplicationEntity remoteAE = new NetworkApplicationEntity();
    NetworkConnection remoteConn = new NetworkConnection();

    remoteAE.setInstalled(true);
    remoteAE.setAssociationAcceptor(true);
    remoteConn.setHostname("localhost");
    remoteConn.setPort(40406);
    remoteAE.setNetworkConnection(remoteConn);
    remoteAE.setAETitle("PAS");

    // **
    // start Cmove Association
    // **
    String abstractSyntaxUID = UID.StudyRootQueryRetrieveInformationModelMOVE;
    DicomObject attrs = setCmoveAttributes();
    String transferSyntaxUid = UID.ImplicitVRLittleEndian;
    DimseRSP rsp = null;
    String movedUID = "";

    Association assoc = null;
    try {
      assoc = ae.connect(remoteAE, executor);
    } catch (ConfigurationException e) {
      assertTrue(false);
    } catch (IOException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (InterruptedException e) {
      assertTrue(false);
    }
    movedUID = phs.getPlanUID();
    assertTrue(movedUID.equalsIgnoreCase("empty"));
    try {
      rsp = assoc.cmove(abstractSyntaxUID, 0, attrs, transferSyntaxUid, "PHS");
      while (!rsp.next()) {}
    } catch (IOException e) {
      System.out.println(e.getMessage());
      assertTrue(false);
    } catch (InterruptedException e) {
      System.out.println(e.getMessage());
      assertTrue(false);
    }
    movedUID = phs.getPlanUID();

    assertTrue(movedUID.equalsIgnoreCase("1.2.34.56"));
    phs.stop();
    pas.stop();
  }