本文整理汇总了Java中org.opensaml.saml2.metadata.AttributeConsumingService.setIsDefault方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeConsumingService.setIsDefault方法的具体用法?Java AttributeConsumingService.setIsDefault怎么用?Java AttributeConsumingService.setIsDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml2.metadata.AttributeConsumingService
的用法示例。
在下文中一共展示了AttributeConsumingService.setIsDefault方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testXSBooleanAttributes
import org.opensaml.saml2.metadata.AttributeConsumingService; //导入方法依赖的package包/类
/**
* Test the proper behavior of the XSBooleanValue attributes.
*/
public void testXSBooleanAttributes() {
AttributeConsumingService acs =
(AttributeConsumingService) buildXMLObject(AttributeConsumingService.DEFAULT_ELEMENT_NAME);
// isDefault attribute
acs.setIsDefault(Boolean.TRUE);
assertEquals("Unexpected value for boolean attribute found", Boolean.TRUE, acs.isDefault());
assertNotNull("XSBooleanValue was null", acs.isDefaultXSBoolean());
assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.TRUE, false),
acs.isDefaultXSBoolean());
assertEquals("XSBooleanValue string was unexpected value", "true", acs.isDefaultXSBoolean().toString());
acs.setIsDefault(Boolean.FALSE);
assertEquals("Unexpected value for boolean attribute found", Boolean.FALSE, acs.isDefault());
assertNotNull("XSBooleanValue was null", acs.isDefaultXSBoolean());
assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.FALSE, false),
acs.isDefaultXSBoolean());
assertEquals("XSBooleanValue string was unexpected value", "false", acs.isDefaultXSBoolean().toString());
acs.setIsDefault((Boolean) null);
assertEquals("Unexpected default value for boolean attribute found", Boolean.FALSE, acs.isDefault());
assertNull("XSBooleanValue was not null", acs.isDefaultXSBoolean());
}
示例2: processAttribute
import org.opensaml.saml2.metadata.AttributeConsumingService; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
AttributeConsumingService service = (AttributeConsumingService) samlObject;
if (attribute.getLocalName().equals(AttributeConsumingService.INDEX_ATTRIB_NAME)) {
service.setIndex(Integer.valueOf(attribute.getValue()));
} else if (attribute.getLocalName().equals(AttributeConsumingService.IS_DEFAULT_ATTRIB_NAME)) {
service.setIsDefault(XSBooleanValue.valueOf(attribute.getValue()));
} else {
super.processAttribute(samlObject, attribute);
}
}
示例3: createAttributeConsumingService
import org.opensaml.saml2.metadata.AttributeConsumingService; //导入方法依赖的package包/类
public static AttributeConsumingService createAttributeConsumingService(String serviceName) {
AttributeConsumingService service = SAMLUtil.buildXMLObject(AttributeConsumingService.class);
ServiceName name = SAMLUtil.buildXMLObject(ServiceName.class);
name.setName(new LocalizedString(serviceName, "en"));
service.getNames().add(name);
service.setIndex(0);
service.setIsDefault(true);
return service;
}
示例4: testSingleElementOptionalAttributesMarshall
import org.opensaml.saml2.metadata.AttributeConsumingService; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
QName qname = new QName(SAMLConstants.SAML20MD_NS, AttributeConsumingService.DEFAULT_ELEMENT_LOCAL_NAME);
AttributeConsumingService service = (AttributeConsumingService) buildXMLObject(qname);
service.setIndex(expectedIndex);
service.setIsDefault(expectedIsDefault);
assertEquals(expectedOptionalAttributesDOM, service);
}