Package org.jscsi.parser.datasegment

Examples of org.jscsi.parser.datasegment.SettingsMap


     * @throws InternetSCSIException This exception should be never thrown.
     */
    @Test
    public void testDeserialize () throws IOException , InternetSCSIException , DigestException {

        SettingsMap expectedKeyValuePair = new SettingsMap();
        expectedKeyValuePair.add(OperationalTextKey.TARGET_NAME, "iqn.1987-05.com.cisco.00.58031e1d068ac226d385847592c0b670.IBM-Disk");

        super.setUp(TEST_CASE_1);
        super.testDeserialize(false, true, OperationCode.TEXT_RESPONSE, 0x00000000, 0x0000004E, 0x03000000);
        super.testDataSegment(expectedKeyValuePair);

View Full Code Here


     * @throws InternetSCSIException This exception should be never thrown.
     */
    @Test
    public void testDeserialize1 () throws IOException , InternetSCSIException , DigestException {

        SettingsMap expectedKeyValuePair = new SettingsMap();
        expectedKeyValuePair.add(OperationalTextKey.SEND_TARGETS, "all");

        super.setUp(TEST_CASE_1);
        super.testDeserialize(true, true, OperationCode.TEXT_REQUEST, 0x00000000, 0x00000010, 0x03000000);
        super.testDataSegment(expectedKeyValuePair);

View Full Code Here

     * @throws DigestException This exception should be never thrown.
     */
    @Test
    public void testDeserialize () throws IOException , InternetSCSIException , DigestException {

        SettingsMap expectedKeyValuePair = new SettingsMap();
        expectedKeyValuePair.add(OperationalTextKey.AUTH_METHOD, "None");

        super.setUp(TEST_CASE_1);
        // final flag is here the transit flag
        super.testDeserialize(false, false, OperationCode.LOGIN_RESPONSE, 0x00000000, 0x00000010, 0xC8D04B81);
        super.testDataSegment(expectedKeyValuePair);
View Full Code Here

     * @throws DigestException This exception should be never thrown.
     */
    @Test
    public void testDeserialize2 () throws IOException , InternetSCSIException , DigestException {

        SettingsMap expectedKeyValuePair = new SettingsMap();
        expectedKeyValuePair.add(OperationalTextKey.TARGET_PORTAL_GROUP_TAG, "1");
        expectedKeyValuePair.add(OperationalTextKey.HEADER_DIGEST, "None");
        expectedKeyValuePair.add(OperationalTextKey.DATA_DIGEST, "None");
        expectedKeyValuePair.add(OperationalTextKey.DEFAULT_TIME_2_WAIT, "2");
        expectedKeyValuePair.add(OperationalTextKey.DEFAULT_TIME_2_RETAIN, "0");
        expectedKeyValuePair.add(OperationalTextKey.IF_MARKER, "No");
        expectedKeyValuePair.add(OperationalTextKey.OF_MARKER, "No");
        expectedKeyValuePair.add(OperationalTextKey.ERROR_RECOVERY_LEVEL, "0");
        expectedKeyValuePair.add(OperationalTextKey.INITIAL_R2T, "Yes");
        expectedKeyValuePair.add(OperationalTextKey.IMMEDIATE_DATA, "Yes");
        expectedKeyValuePair.add(OperationalTextKey.MAX_BURST_LENGTH, "262144");
        expectedKeyValuePair.add(OperationalTextKey.FIRST_BURST_LENGTH, "65536");
        expectedKeyValuePair.add(OperationalTextKey.MAX_OUTSTANDING_R2T, "1");
        expectedKeyValuePair.add(OperationalTextKey.MAX_CONNECTIONS, "1");
        expectedKeyValuePair.add(OperationalTextKey.DATA_PDU_IN_ORDER, "Yes");
        expectedKeyValuePair.add(OperationalTextKey.DATA_SEQUENCE_IN_ORDER, "Yes");

        super.setUp(TEST_CASE_2);
        // final flag is here the transit flag
        super.testDeserialize(false, true, OperationCode.LOGIN_RESPONSE, 0x00000000, 0x0000012C, 0x000A0000);
        super.testDataSegment(expectedKeyValuePair);
View Full Code Here

                    update = max - maxConnections;
                    maxConnections = max;
                }
            }

            SettingsMap sm = new SettingsMap();
            sm.add(OperationalTextKey.MAX_CONNECTIONS, String.valueOf(maxConnections));
            conn.update(sm);
            taskBalancer.releaseConnection(conn);

            if (update > 0) {
                addConnections(update);
View Full Code Here

    public final void execute () throws InternetSCSIException {

        final ProtocolDataUnit protocolDataUnit = protocolDataUnitFactory.create(false, true, OperationCode.TEXT_REQUEST, connection.getSetting(OperationalTextKey.HEADER_DIGEST), connection.getSetting(OperationalTextKey.DATA_DIGEST));
        final TextRequestParser parser = (TextRequestParser) protocolDataUnit.getBasicHeaderSegment().getParser();

        final SettingsMap settings = new SettingsMap();
        settings.add(OperationalTextKey.SEND_TARGETS, "");

        final IDataSegment dataSegment = DataSegmentFactory.create(settings.asByteBuffer(), DataSegmentFormat.TEXT, connection.getSettingAsInt(OperationalTextKey.MAX_RECV_DATA_SEGMENT_LENGTH));

        int bytes2Process = dataSegment.getLength();
        for (IDataSegmentIterator dataSegmentIterator = dataSegment.iterator(); dataSegmentIterator.hasNext();) {
            IDataSegmentChunk dataSegmentChunk = dataSegmentIterator.next(bytes2Process);
            protocolDataUnit.setDataSegment(dataSegmentChunk);
View Full Code Here

    // --------------------------------------------------------------------------

    /** {@inheritDoc} */
    public final void execute () throws InternetSCSIException {

        final SettingsMap loginParameters = connection.getSettings();
        LOGGER.info("Sending these login parameters:\n" + loginParameters);

        final int maxRecvDataSegmentLength = connection.getSettingAsInt(OperationalTextKey.MAX_RECV_DATA_SEGMENT_LENGTH);
        final ISID isid = ISID.createRandom(System.currentTimeMillis());

        LoginRequestParser loginRequest;
        boolean continueFlag;
        // here the finalFlag represents the transitFlag
        boolean finalFlag;
        final IDataSegment dataSegment = DataSegmentFactory.create(loginParameters.asByteBuffer(), DataSegmentFormat.TEXT, maxRecvDataSegmentLength);
        final IDataSegmentIterator iterator = dataSegment.iterator();
        final Queue<ProtocolDataUnit> protocolDataUnits = new LinkedList<ProtocolDataUnit>();

        IDataSegmentChunk dataSegmentChunk;
        ProtocolDataUnit protocolDataUnit;
View Full Code Here

     * @param connectionID The ID of the connection to retrieve.
     * @return All unified parameters in one single <code>SettingsMap</code>.
     */
    public final SettingsMap getSettings (final String targetName, final int connectionID) {

        final SettingsMap sm = new SettingsMap();

        // set all default settings
        synchronized (globalConfig) {
            for (Map.Entry<OperationalTextKey , SettingEntry> e : globalConfig.entrySet()) {
                sm.add(e.getKey(), e.getValue().getValue());
            }
        }

        // set all further settings
        final SessionConfiguration sc;
        synchronized (sessionConfigs) {
            sc = sessionConfigs.get(targetName);

            synchronized (sc) {
                if (sc != null) {
                    final SettingsMap furtherSettings = sc.getSettings(connectionID);
                    for (Map.Entry<OperationalTextKey , String> e : furtherSettings.entrySet()) {
                        sm.add(e.getKey(), e.getValue());
                    }
                }
            }
        }
View Full Code Here

        /**
         * Default constructor to create a new, empty <code>SessionConfiguration</code> object.
         */
        SessionConfiguration () {

            sessionConfiguration = new SettingsMap();
            connectionConfiguration = new LinkedHashMap<Integer , SettingsMap>(0);
        }
View Full Code Here

         * @param textValue The value of the response.
         * @param resultFunction The <code>IResultFunction</code> instance to use to obtain the result.
         */
        final void updateConnectionSetting (final int connectionID, final OperationalTextKey textKey, final String textValue, final IResultFunction resultFunction) {

            SettingsMap sm = connectionConfiguration.get(connectionID);
            if (sm == null) {
                sm = new SettingsMap();
                connectionConfiguration.put(connectionID, sm);
            }

            sm.update(textKey, textValue, resultFunction);
        }
View Full Code Here

TOP

Related Classes of org.jscsi.parser.datasegment.SettingsMap

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.