Package org.jscsi.scsi.protocol

Examples of org.jscsi.scsi.protocol.Command


   @Test
   public void TestReadWriteCompare6()
   {
      CDB cdb1 = new Write6(false, true, 10, NUM_BLOCKS_TRANSFER);
      Command cmd1 =
            new Command(this.transport.createNexus(this.cmdRef), cdb1, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      this.transport.createReadData(NUM_BLOCKS_TRANSFER * STORE_BLOCK_SIZE, this.cmdRef);
      lu.enqueue(this.transport, cmd1);
      this.cmdRef++;

      CDB cdb2 = new Read6(false, true, 10, NUM_BLOCKS_TRANSFER);
      Command cmd2 =
            new Command(this.transport.createNexus(this.cmdRef), cdb2, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      lu.enqueue(this.transport, cmd2);

      try
      {
View Full Code Here


   @Test
   public void TestReadWriteCompare10()
   {
      CDB cdb1 = new Write10(0, false, false, false, false, false, 10, NUM_BLOCKS_TRANSFER);
      Command cmd1 =
            new Command(this.transport.createNexus(this.cmdRef), cdb1, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      this.transport.createReadData(NUM_BLOCKS_TRANSFER * STORE_BLOCK_SIZE, this.cmdRef);
      lu.enqueue(this.transport, cmd1);
      this.cmdRef++;

      CDB cdb2 = new Read10(0, false, false, false, false, false, 10, NUM_BLOCKS_TRANSFER);
      Command cmd2 =
            new Command(this.transport.createNexus(this.cmdRef), cdb2, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      lu.enqueue(this.transport, cmd2);

      try
      {
View Full Code Here

   @Test
   public void TestReadWriteCompare12()
   {
      CDB cdb1 = new Write12(0, false, false, false, false, false, 10, NUM_BLOCKS_TRANSFER);
      Command cmd1 =
            new Command(this.transport.createNexus(this.cmdRef), cdb1, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      this.transport.createReadData(NUM_BLOCKS_TRANSFER * STORE_BLOCK_SIZE, this.cmdRef);
      lu.enqueue(this.transport, cmd1);
      this.cmdRef++;

      CDB cdb2 = new Read12(0, false, false, false, false, false, 10, NUM_BLOCKS_TRANSFER);
      Command cmd2 =
            new Command(this.transport.createNexus(this.cmdRef), cdb2, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      lu.enqueue(this.transport, cmd2);

      try
      {
View Full Code Here

   @Test
   public void TestReadWriteCompare16()
   {
      CDB cdb1 = new Write16(0, false, false, false, false, false, 10, NUM_BLOCKS_TRANSFER);
      Command cmd1 =
            new Command(this.transport.createNexus(this.cmdRef), cdb1, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      this.transport.createReadData(NUM_BLOCKS_TRANSFER * STORE_BLOCK_SIZE, this.cmdRef);
      lu.enqueue(this.transport, cmd1);
      this.cmdRef++;

      CDB cdb2 = new Read16(0, false, false, false, false, false, 10, NUM_BLOCKS_TRANSFER);
      Command cmd2 =
            new Command(this.transport.createNexus(this.cmdRef), cdb2, TaskAttribute.ORDERED,
                  this.cmdRef, 0);
      lu.enqueue(this.transport, cmd2);

      try
      {
View Full Code Here

            }
            else
            {
               // on timeout, we write TASK SET FULL to the transport port
               lock.unlock(); // we don't want to block on transport port operations
               Command command = task.getCommand();
               task.getTargetTransportPort().writeResponse(command.getNexus(),
                     command.getCommandReferenceNumber(), Status.TASK_SET_FULL, null);
               _logger.debug("task set is full, rejecting task: " + task);
               return false;
            }
         }

         // Check that untagged tasks have the SIMPLE task attribute
         long taskTag = task.getCommand().getNexus().getTaskTag();
         if (taskTag < 0 && task.getCommand().getTaskAttribute() != TaskAttribute.SIMPLE)
         {
            throw new RuntimeException("Transport layer should have set untagged task as SIMPLE");
         }

         // check for duplicate task tags; 'null' key is the untagged task
         if (this.tasks.containsKey(taskTag < 0 ? null : taskTag))
         {
            // Note that we treat two untagged tasks as an overlapped command condition.
            // FIXME: Is treating overlapping untagged tasks in this way actually proper?
            lock.unlock(); // we don't want to block on transport port operations
            Command command = task.getCommand();
            task.getTargetTransportPort().writeResponse(command.getNexus(),
                  command.getCommandReferenceNumber(), Status.CHECK_CONDITION,
                  ByteBuffer.wrap((new OverlappedCommandsAttemptedException(true)).encode()));
            if (_logger.isDebugEnabled())
               _logger.debug("command not accepted due to preexisting untagged task: " + task);
            return false;
         }
View Full Code Here

      public TestTask(Nexus nexus, TaskAttribute attribute, long delay)
      {
         this.port = null;
         this.delay = delay;
         this.command = new Command(nexus, (CDB) null, attribute, 0, 0);
         _logger.debug("constructed TestTask: " + this);
      }
View Full Code Here

      public TestTask(TargetTransportPort port, Nexus nexus, TaskAttribute attribute, long delay)
      {
         this.port = port;
         this.delay = delay;
         this.command = new Command(nexus, (CDB) null, attribute, 0, 0);
         _logger.debug("constructed TestTask: " + this);
      }
View Full Code Here

   {
      // We allocate 200 bytes for return data
      CDB cdb = new ModeSense6(true, 0, pageCode, subPageCode, 200);

      TestTargetTransportPort port = new TestTargetTransportPort(null, false);
      Command command =
            new Command(new Nexus("initiator", "target", 0, 0), cdb, TaskAttribute.SIMPLE, 0, 0);
      InquiryDataRegistry inqreg = new StaticInquiryDataRegistry();

      _logger.debug("Creating ModeSenseTask from MODE SENSE (6) command");
      Task task = new ModeSenseTask(port, command, registry, inqreg);
      _logger.debug("Running mode sense task");
View Full Code Here

   }

   public static Command getTestUnitReadyCommand(Nexus nexus)
   {
      return new Command(nexus, new TestUnitReady(), TaskAttribute.SIMPLE, 0, 0);
   }
View Full Code Here

      return new Command(nexus, new TestUnitReady(), TaskAttribute.SIMPLE, 0, 0);
   }

   public static Command getReportLunsCommand(Nexus nexus)
   {
      return new Command(nexus, new ReportLuns(), TaskAttribute.SIMPLE, 0, 0);
   }
View Full Code Here

TOP

Related Classes of org.jscsi.scsi.protocol.Command

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.