本文整理汇总了Java中org.apache.directory.api.ldap.model.message.SearchResultEntry.getEntry方法的典型用法代码示例。如果您正苦于以下问题:Java SearchResultEntry.getEntry方法的具体用法?Java SearchResultEntry.getEntry怎么用?Java SearchResultEntry.getEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.message.SearchResultEntry
的用法示例。
在下文中一共展示了SearchResultEntry.getEntry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testResponseWith1Attr0Value
import org.apache.directory.api.ldap.model.message.SearchResultEntry; //导入方法依赖的package包/类
/**
* Test parsing of a response with 1 Attr 0 Value
*/
@Test
public void testResponseWith1Attr0Value()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput(
SearchResultEntryTest.class.getResource( "response_with_1_attr_0_value.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
.getDecorated() )
.getCurrentSearchResultEntry();
Entry entry = searchResultEntry.getEntry();
assertEquals( 1, entry.size() );
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "dc", attribute.getUpId() );
}
示例2: testResponseWith1Attr1Value
import org.apache.directory.api.ldap.model.message.SearchResultEntry; //导入方法依赖的package包/类
/**
* Test parsing of a response with 1 Attr 1 Value
*/
@Test
public void testResponseWith1Attr1Value()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput(
SearchResultEntryTest.class.getResource( "response_with_1_attr_1_value.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
.getDecorated() )
.getCurrentSearchResultEntry();
Entry entry = searchResultEntry.getEntry();
assertEquals( 1, entry.size() );
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "dc", attribute.getUpId() );
Iterator<Value> valueIterator = attribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
assertEquals( "example", value.getValue() );
}
示例3: testResponseWith1Attr1Base64Value
import org.apache.directory.api.ldap.model.message.SearchResultEntry; //导入方法依赖的package包/类
/**
* Test parsing of a response with 1 Attr 1 Base64 Value
*/
@Test
public void testResponseWith1Attr1Base64Value()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_base64_value.xml" )
.openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
.getDecorated() )
.getCurrentSearchResultEntry();
Entry entry = searchResultEntry.getEntry();
assertEquals( 1, entry.size() );
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "cn", attribute.getUpId() );
assertEquals( 1, attribute.size() );
Iterator<Value> valueIterator = attribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
String expected = new String( new byte[]
{ 'E', 'm', 'm', 'a', 'n', 'u', 'e', 'l', ' ', 'L', ( byte ) 0xc3, ( byte ) 0xa9, 'c', 'h', 'a', 'r', 'n',
'y' }, StandardCharsets.UTF_8 );
assertEquals( expected, value.getValue() );
}
示例4: testResponseWith1Attr1EmptyValue
import org.apache.directory.api.ldap.model.message.SearchResultEntry; //导入方法依赖的package包/类
/**
* Test parsing of a response with 1 Attr 1 empty Value
*/
@Test
public void testResponseWith1Attr1EmptyValue()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput( SearchResultEntryTest.class.getResource( "response_with_1_attr_1_empty_value.xml" )
.openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
.getDecorated() )
.getCurrentSearchResultEntry();
Entry entry = searchResultEntry.getEntry();
assertEquals( 1, entry.size() );
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "dc", attribute.getUpId() );
assertEquals( 1, attribute.size() );
Iterator<Value> valueIterator = attribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
assertEquals( "", value.getValue() );
}
示例5: testResponseWith1Attr2Value
import org.apache.directory.api.ldap.model.message.SearchResultEntry; //导入方法依赖的package包/类
/**
* Test parsing of a response with 1 Attr 2 Value
*/
@Test
public void testResponseWith1Attr2Value()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput(
SearchResultEntryTest.class.getResource( "response_with_1_attr_2_value.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
.getDecorated() )
.getCurrentSearchResultEntry();
Entry entry = searchResultEntry.getEntry();
assertEquals( 1, entry.size() );
Iterator<Attribute> attributeIterator = entry.iterator();
Attribute attribute = attributeIterator.next();
assertEquals( "objectclass", attribute.getUpId() );
assertEquals( 2, attribute.size() );
Iterator<Value> valueIterator = attribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
assertEquals( "top", value.getValue() );
assertTrue( valueIterator.hasNext() );
value = valueIterator.next();
assertEquals( "domain", value.getValue() );
assertFalse( valueIterator.hasNext() );
}
示例6: testResponseWith2Attr1Value
import org.apache.directory.api.ldap.model.message.SearchResultEntry; //导入方法依赖的package包/类
/**
* Test parsing of a response with 2 Attr 1 Value
*/
@Test
public void testResponseWith2Attr1Value()
{
Dsmlv2ResponseParser parser = null;
try
{
parser = new Dsmlv2ResponseParser( getCodec() );
parser.setInput(
SearchResultEntryTest.class.getResource( "response_with_2_attr_1_value.xml" ).openStream(), "UTF-8" );
parser.parse();
}
catch ( Exception e )
{
fail( e.getMessage() );
}
SearchResultEntry searchResultEntry = ( ( SearchResponse ) parser.getBatchResponse().getCurrentResponse()
.getDecorated() )
.getCurrentSearchResultEntry();
Entry entry = searchResultEntry.getEntry();
assertEquals( 2, entry.size() );
Attribute objectClassAttribute = entry.get( "objectclass" );
assertEquals( 1, objectClassAttribute.size() );
Iterator<Value> valueIterator = objectClassAttribute.iterator();
assertTrue( valueIterator.hasNext() );
Value value = valueIterator.next();
assertEquals( "top", value.getValue() );
assertFalse( valueIterator.hasNext() );
Attribute dcAttribute = entry.get( "dc" );
assertEquals( 1, objectClassAttribute.size() );
valueIterator = dcAttribute.iterator();
assertTrue( valueIterator.hasNext() );
value = valueIterator.next();
assertEquals( "example", value.getValue() );
assertFalse( valueIterator.hasNext() );
}