当前位置: 首页>>代码示例>>Java>>正文


Java Symbol.valueOf方法代码示例

本文整理汇总了Java中org.apache.qpid.proton.amqp.Symbol.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Symbol.valueOf方法的具体用法?Java Symbol.valueOf怎么用?Java Symbol.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.qpid.proton.amqp.Symbol的用法示例。


在下文中一共展示了Symbol.valueOf方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTestDecodeSymbolArrayType

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
private void doTestDecodeSymbolArrayType(int size) throws IOException {
    Symbol[] source = new Symbol[size];
    for (int i = 0; i < size; ++i) {
        source[i] = Symbol.valueOf("test->" + i);
    }

    encoder.writeArray(source);

    buffer.clear();

    Object result = decoder.readObject();
    assertNotNull(result);
    assertTrue(result.getClass().isArray());

    Symbol[] array = (Symbol[]) result;
    assertEquals(size, array.length);

    for (int i = 0; i < size; ++i) {
        assertEquals(source[i], array[i]);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:22,代码来源:ArrayTypeCodecTest.java

示例2: benchmarkSymbols

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
private void benchmarkSymbols() throws IOException {
    Symbol symbol1 = Symbol.valueOf("Symbol-1");
    Symbol symbol2 = Symbol.valueOf("Symbol-2");
    Symbol symbol3 = Symbol.valueOf("Symbol-3");

    resultSet.start();
    for (int i = 0; i < ITERATIONS; i++) {
        byteBuf.clear();
        encoder.writeSymbol(symbol1);
        encoder.writeSymbol(symbol2);
        encoder.writeSymbol(symbol3);
    }
    resultSet.encodesComplete();

    resultSet.start();
    for (int i = 0; i < ITERATIONS; i++) {
        byteBuf.flip();
        decoder.readSymbol();
        decoder.readSymbol();
        decoder.readSymbol();
    }
    resultSet.decodesComplete();

    time("Symbol", resultSet);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:26,代码来源:Benchmark.java

示例3: testEncodeDecodeSymbolArrayUsingPutObject

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Test
public void testEncodeDecodeSymbolArrayUsingPutObject()
{
    Symbol symbol1 = Symbol.valueOf("testRoundtripSymbolArray1");
    Symbol symbol2 = Symbol.valueOf("testRoundtripSymbolArray2");
    Symbol[] input = new Symbol[]{symbol1, symbol2};

    Data data1 = new DataImpl();
    data1.putObject(input);

    Binary encoded = data1.encode();
    encoded.asByteBuffer();

    Data data2 = new DataImpl();
    data2.decode(encoded.asByteBuffer());

    assertEquals("unexpected array length", 2, data2.getArray());
    assertEquals("unexpected array length", Data.DataType.SYMBOL, data2.getArrayType());

    Object[] array = data2.getJavaArray();
    assertArrayEquals("Array not as expected", input, array);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:23,代码来源:DataImplTest.java

示例4: plain

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Override
public void plain(String username, String password)
{
    client();
    _chosenMechanism = Symbol.valueOf("PLAIN");
    byte[] usernameBytes = username.getBytes(StandardCharsets.UTF_8);
    byte[] passwordBytes = password.getBytes(StandardCharsets.UTF_8);
    byte[] data = new byte[usernameBytes.length+passwordBytes.length+2];
    System.arraycopy(usernameBytes, 0, data, 1, usernameBytes.length);
    System.arraycopy(passwordBytes, 0, data, 2+usernameBytes.length, passwordBytes.length);

    setChallengeResponse(new Binary(data));
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:14,代码来源:SaslImpl.java

示例5: doTestDecodeMessageAnnotationsSeries

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void doTestDecodeMessageAnnotationsSeries(int size) throws IOException {

    final Symbol SYMBOL_1 = Symbol.valueOf("test1");
    final Symbol SYMBOL_2 = Symbol.valueOf("test2");
    final Symbol SYMBOL_3 = Symbol.valueOf("test3");

    MessageAnnotations annotations = new MessageAnnotations(new HashMap());
    annotations.getValue().put(SYMBOL_1, UnsignedByte.valueOf((byte) 128));
    annotations.getValue().put(SYMBOL_2, UnsignedShort.valueOf((short) 128));
    annotations.getValue().put(SYMBOL_3, UnsignedInteger.valueOf(128));

    for (int i = 0; i < size; ++i) {
        encoder.writeObject(annotations);
    }

    buffer.clear();

    for (int i = 0; i < size; ++i) {
        final Object result = decoder.readObject();

        assertNotNull(result);
        assertTrue(result instanceof MessageAnnotations);

        MessageAnnotations readAnnotations = (MessageAnnotations) result;

        Map<Symbol, Object> resultMap = readAnnotations.getValue();

        assertEquals(annotations.getValue().size(), resultMap.size());
        assertEquals(resultMap.get(SYMBOL_1), UnsignedByte.valueOf((byte) 128));
        assertEquals(resultMap.get(SYMBOL_2), UnsignedShort.valueOf((short) 128));
        assertEquals(resultMap.get(SYMBOL_3), UnsignedInteger.valueOf(128));
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:35,代码来源:MessageAnnotationsTypeCodecTest.java

示例6: testEncodeDecodeSymbolArrayUsingPutArray

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Test
public void testEncodeDecodeSymbolArrayUsingPutArray()
{
    Symbol symbol1 = Symbol.valueOf("testRoundtripSymbolArray1");
    Symbol symbol2 = Symbol.valueOf("testRoundtripSymbolArray2");

    Data data1 = new DataImpl();
    data1.putArray(false, Data.DataType.SYMBOL);
    data1.enter();
    data1.putSymbol(symbol1);
    data1.putSymbol(symbol2);
    data1.exit();

    Binary encoded = data1.encode();
    encoded.asByteBuffer();

    Data data2 = new DataImpl();
    data2.decode(encoded.asByteBuffer());

    assertEquals("unexpected array length", 2, data2.getArray());
    assertEquals("unexpected array length", Data.DataType.SYMBOL, data2.getArrayType());

    Object[] array = data2.getJavaArray();
    assertNotNull("Array should not be null", array);
    assertEquals("Expected a Symbol array", Symbol[].class, array.getClass());
    assertEquals("unexpected array length", 2, array.length);
    assertEquals("unexpected value", symbol1, array[0]);
    assertEquals("unexpected value", symbol2, array[1]);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:30,代码来源:DataImplTest.java

示例7: getDescriptor

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Override
public Object getDescriptor() {
  return Symbol.valueOf("apache.org:selector-filter:string");
}
 
开发者ID:ppatierno,项目名称:amqp-kafka-demo,代码行数:5,代码来源:Receiver.java

示例8: getDescriptor

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Override
public Object getDescriptor() {
    return Symbol.valueOf("apache.org:selector-filter:string");
}
 
开发者ID:EnMasseProject,项目名称:enmasse,代码行数:5,代码来源:TopicTest.java

示例9: testCapabilities

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Test
public void testCapabilities() throws Exception
{
    final Symbol clientOfferedCap = Symbol.valueOf("clientOfferedCapability");
    final Symbol clientDesiredCap = Symbol.valueOf("clientDesiredCapability");
    final Symbol serverOfferedCap = Symbol.valueOf("serverOfferedCapability");
    final Symbol serverDesiredCap = Symbol.valueOf("serverDesiredCapability");

    Symbol[] clientOfferedCapabilities = new Symbol[] { clientOfferedCap };
    Symbol[] clientDesiredCapabilities = new Symbol[] { clientDesiredCap };

    Symbol[] serverOfferedCapabilities = new Symbol[] { serverOfferedCap };
    Symbol[] serverDesiredCapabilities = new Symbol[] { serverDesiredCap };

    LOGGER.fine(bold("======== About to create transports"));

    getClient().transport = Proton.transport();
    ProtocolTracerEnabler.setProtocolTracer(getClient().transport, TestLoggingHelper.CLIENT_PREFIX);

    getServer().transport = Proton.transport();
    ProtocolTracerEnabler.setProtocolTracer(getServer().transport, "            " + TestLoggingHelper.SERVER_PREFIX);

    doOutputInputCycle();

    getClient().connection = Proton.connection();
    getClient().transport.bind(getClient().connection);

    getServer().connection = Proton.connection();
    getServer().transport.bind(getServer().connection);

    LOGGER.fine(bold("======== About to open connections"));
    getClient().connection.open();
    getServer().connection.open();

    doOutputInputCycle();

    LOGGER.fine(bold("======== About to open sessions"));
    getClient().session = getClient().connection.session();

    // Set the client session capabilities
    getClient().session.setOfferedCapabilities(clientOfferedCapabilities);
    getClient().session.setDesiredCapabilities(clientDesiredCapabilities);

    getClient().session.open();

    pumpClientToServer();

    getServer().session = getServer().connection.sessionHead(of(UNINITIALIZED), of(ACTIVE));
    assertEndpointState(getServer().session, UNINITIALIZED, ACTIVE);

    // Set the server session capabilities
    getServer().session.setOfferedCapabilities(serverOfferedCapabilities);
    getServer().session.setDesiredCapabilities(serverDesiredCapabilities);

    getServer().session.open();
    assertEndpointState(getServer().session, ACTIVE, ACTIVE);

    pumpServerToClient();

    // Verify server side got the clients session capabilities as expected
    Symbol[] serverRemoteOfferedCapabilities = getServer().session.getRemoteOfferedCapabilities();
    assertNotNull("Server had no remote offered capabilities", serverRemoteOfferedCapabilities);
    assertEquals("Server remote offered capabilities not expected size", 1, serverRemoteOfferedCapabilities.length);
    assertTrue("Server remote offered capabilities lack expected value: " + clientOfferedCap, Arrays.asList(serverRemoteOfferedCapabilities).contains(clientOfferedCap));

    Symbol[] serverRemoteDesiredCapabilities = getServer().session.getRemoteDesiredCapabilities();
    assertNotNull("Server had no remote desired capabilities", serverRemoteDesiredCapabilities);
    assertEquals("Server remote desired capabilities not expected size", 1, serverRemoteDesiredCapabilities.length);
    assertTrue("Server remote desired capabilities lack expected value: " + clientDesiredCap, Arrays.asList(serverRemoteDesiredCapabilities).contains(clientDesiredCap));

    // Verify the client side got the servers session capabilities as expected
    Symbol[]  clientRemoteOfferedCapabilities = getClient().session.getRemoteOfferedCapabilities();
    assertNotNull("Client had no remote offered capabilities", clientRemoteOfferedCapabilities);
    assertEquals("Client remote offered capabilities not expected size", 1, clientRemoteOfferedCapabilities.length);
    assertTrue("Client remote offered capabilities lack expected value: " + serverOfferedCap, Arrays.asList(clientRemoteOfferedCapabilities).contains(serverOfferedCap));

    Symbol[]  clientRemoteDesiredCapabilities = getClient().session.getRemoteDesiredCapabilities();
    assertNotNull("Client had no remote desired capabilities", clientRemoteDesiredCapabilities);
    assertEquals("Client remote desired capabilities not expected size", 1, clientRemoteDesiredCapabilities.length);
    assertTrue("Client remote desired capabilities lack expected value: " + serverDesiredCap, Arrays.asList(clientRemoteDesiredCapabilities).contains(serverDesiredCap));
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:82,代码来源:SessionTest.java

示例10: testProperties

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
@Test
public void testProperties() throws Exception
{
    final Symbol clientPropName = Symbol.valueOf("ClientPropName");
    final Integer clientPropValue = 1234;
    final Symbol serverPropName = Symbol.valueOf("ServerPropName");
    final Integer serverPropValue = 5678;

    Map<Symbol, Object> clientProps = new HashMap<>();
    clientProps.put(clientPropName, clientPropValue);

    Map<Symbol, Object> serverProps = new HashMap<>();
    serverProps.put(serverPropName, serverPropValue);

    LOGGER.fine(bold("======== About to create transports"));

    getClient().transport = Proton.transport();
    ProtocolTracerEnabler.setProtocolTracer(getClient().transport, TestLoggingHelper.CLIENT_PREFIX);

    getServer().transport = Proton.transport();
    ProtocolTracerEnabler.setProtocolTracer(getServer().transport, "            " + TestLoggingHelper.SERVER_PREFIX);

    doOutputInputCycle();

    getClient().connection = Proton.connection();
    getClient().transport.bind(getClient().connection);

    getServer().connection = Proton.connection();
    getServer().transport.bind(getServer().connection);

    LOGGER.fine(bold("======== About to open connections"));
    getClient().connection.open();
    getServer().connection.open();

    doOutputInputCycle();

    LOGGER.fine(bold("======== About to open sessions"));
    getClient().session = getClient().connection.session();

    // Set the client session properties
    getClient().session.setProperties(clientProps);

    getClient().session.open();

    pumpClientToServer();

    getServer().session = getServer().connection.sessionHead(of(UNINITIALIZED), of(ACTIVE));
    assertEndpointState(getServer().session, UNINITIALIZED, ACTIVE);

    // Set the server session properties
    getServer().session.setProperties(serverProps);

    getServer().session.open();

    assertEndpointState(getServer().session, ACTIVE, ACTIVE);

    pumpServerToClient();

    assertEndpointState(getClient().session, ACTIVE, ACTIVE);

    // Verify server side got the clients session properties as expected
    Map<Symbol, Object> serverRemoteProperties = getServer().session.getRemoteProperties();
    assertNotNull("Server had no remote properties", serverRemoteProperties);
    assertEquals("Server remote properties not expected size", 1, serverRemoteProperties.size());
    assertTrue("Server remote properties lack expected key: " + clientPropName, serverRemoteProperties.containsKey(clientPropName));
    assertEquals("Server remote properties contain unexpected value for key: " + clientPropName, clientPropValue, serverRemoteProperties.get(clientPropName));

    // Verify the client side got the servers session properties as expected
    Map<Symbol, Object> clientRemoteProperties = getClient().session.getRemoteProperties();
    assertNotNull("Client had no remote properties", clientRemoteProperties);
    assertEquals("Client remote properties not expected size", 1, clientRemoteProperties.size());
    assertTrue("Client remote properties lack expected key: " + serverPropName, clientRemoteProperties.containsKey(serverPropName));
    assertEquals("Client remote properties contain unexpected value for key: " + serverPropName, serverPropValue, clientRemoteProperties.get(serverPropName));
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:75,代码来源:SessionTest.java

示例11: initSymbols

import org.apache.qpid.proton.amqp.Symbol; //导入方法依赖的package包/类
private void initSymbols()
{
    symbol1 = Symbol.valueOf("Symbol-1");
    symbol2 = Symbol.valueOf("Symbol-2");
    symbol3 = Symbol.valueOf("Symbol-3");
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:7,代码来源:SymbolsBenchmark.java


注:本文中的org.apache.qpid.proton.amqp.Symbol.valueOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。