test_class.declarator: log = LoggerFactory.getLogger(X509CertificateEvaluatorTest.class)
test_class.modifier: private final static
test_class.original_string: private final static Logger log = LoggerFactory.getLogger(X509CertificateEvaluatorTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.declarator: evaluator = null
test_class.original_string: X509CertificateEvaluator evaluator = null;
test_class.type: X509CertificateEvaluator
test_class.var_name: evaluator
test_class.file: commons/components/commons-mule/src/test/java/org/soitoolkit/commons/mule/cert/X509CertificateEvaluatorTest.java
test_class.identifier: X509CertificateEvaluatorTest
test_case.body: @Test
  	public void evaluate() {
  		
  		MuleMessage muleMessageMock = mock(MuleMessage.class);
  		X509Certificate certMock = mock(X509Certificate.class);
  		X500Principal principal = new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US");
  		
  		Certificate[] certificateChain = new Certificate[] {certMock};
  		when(muleMessageMock.getOutboundProperty("PEER_CERTIFICATES")).thenReturn(certificateChain);
  		when(certMock.getSubjectX500Principal()).thenReturn(principal);
  		
  		Object senderId = evaluator.evaluate(X509CertificateEvaluator.EXPR_SENDERID, muleMessageMock);
  		
  		assertNotNull(senderId);
  		assertEquals("Duke", senderId);
  	}
test_case.class_method_signature: X509CertificateEvaluatorTest.evaluate()
test_case.full_signature: @Test public void evaluate()
test_case.identifier: evaluate
test_case.invocations: mock mock thenReturn when getOutboundProperty thenReturn when getSubjectX500Principal evaluate assertNotNull assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void evaluate()
focal_class.declarator: log = LoggerFactory.getLogger(X509CertificateEvaluator.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(X509CertificateEvaluator.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: NAME = "x509cert"
focal_class.modifier: public static final
focal_class.original_string: public static final String NAME = "x509cert";
focal_class.type: String
focal_class.var_name: NAME
focal_class.declarator: EXPR_SENDERID = "sender-id"
focal_class.modifier: public static final
focal_class.original_string: public static final String EXPR_SENDERID = "sender-id";
focal_class.type: String
focal_class.var_name: EXPR_SENDERID
focal_class.declarator: propertyName
focal_class.modifier: private
focal_class.original_string: private String propertyName;
focal_class.type: String
focal_class.var_name: propertyName
focal_class.file: commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/cert/X509CertificateEvaluator.java
focal_class.identifier: X509CertificateEvaluator
focal_class.interfaces: implements ExpressionEvaluator
focal_class.class_method_signature: X509CertificateEvaluator.getName()
focal_class.full_signature: public String getName()
focal_class.identifier: getName
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: X509CertificateEvaluator.setPropertyName(String propertyName)
focal_class.full_signature: public void setPropertyName(String propertyName)
focal_class.identifier: setPropertyName
focal_class.modifiers: public
focal_class.parameters: (String propertyName)
focal_class.return: void
focal_class.signature: void setPropertyName(String propertyName)
focal_class.class_method_signature: X509CertificateEvaluator.setName(String name)
focal_class.full_signature: public void setName(String name)
focal_class.identifier: setName
focal_class.modifiers: public
focal_class.parameters: (String name)
focal_class.return: void
focal_class.signature: void setName(String name)
focal_class.class_method_signature: X509CertificateEvaluator.evaluate(String expression, MuleMessage message)
focal_class.full_signature: public Object evaluate(String expression, MuleMessage message)
focal_class.identifier: evaluate
focal_class.modifiers: public
focal_class.parameters: (String expression, MuleMessage message)
focal_class.return: Object
focal_class.signature: Object evaluate(String expression, MuleMessage message)
focal_class.class_method_signature: X509CertificateEvaluator.getSenderIdFromCertificate(MuleMessage message, String certProperty)
focal_class.full_signature: private String getSenderIdFromCertificate(MuleMessage message, String certProperty)
focal_class.identifier: getSenderIdFromCertificate
focal_class.modifiers: private
focal_class.parameters: (MuleMessage message, String certProperty)
focal_class.return: String
focal_class.signature: String getSenderIdFromCertificate(MuleMessage message, String certProperty)
focal_class.class_method_signature: X509CertificateEvaluator.getX509Certificate(MuleMessage message, String certProperty)
focal_class.full_signature: private X509Certificate getX509Certificate(MuleMessage message, String certProperty)
focal_class.identifier: getX509Certificate
focal_class.modifiers: private
focal_class.parameters: (MuleMessage message, String certProperty)
focal_class.return: X509Certificate
focal_class.signature: X509Certificate getX509Certificate(MuleMessage message, String certProperty)
focal_class.class_method_signature: X509CertificateEvaluator.logAndThrowError(String errorMessage)
focal_class.full_signature: private void logAndThrowError(String errorMessage)
focal_class.identifier: logAndThrowError
focal_class.modifiers: private
focal_class.parameters: (String errorMessage)
focal_class.return: void
focal_class.signature: void logAndThrowError(String errorMessage)
focal_class.class_method_signature: X509CertificateEvaluator.convertFromHexToString(String hexString)
focal_class.full_signature: private String convertFromHexToString(String hexString)
focal_class.identifier: convertFromHexToString
focal_class.modifiers: private
focal_class.parameters: (String hexString)
focal_class.return: String
focal_class.signature: String convertFromHexToString(String hexString)
focal_method.body: public Object evaluate(String expression, MuleMessage message) {
  		try {
  			String value = null;
  			
  	        //Is the header optional? the '*' denotes optional
  		    if (EXPR_SENDERID.equals(expression)) {
  				value = getSenderIdFromCertificate(message, "PEER_CERTIFICATES");
  				if (log.isDebugEnabled()) {
  					String me = getSenderIdFromCertificate(message, "LOCAL_CERTIFICATES");
  					log.debug("{} validates sender id: {}", me, value);
  				}
  		    }
  		    
  		    return value;
  		    
  		} catch (Exception e) {
  			log.error(e.getMessage());
  			throw new RuntimeException(e);
  		}
  	}
focal_method.class_method_signature: X509CertificateEvaluator.evaluate(String expression, MuleMessage message)
focal_method.full_signature: public Object evaluate(String expression, MuleMessage message)
focal_method.identifier: evaluate
focal_method.invocations: equals getSenderIdFromCertificate isDebugEnabled getSenderIdFromCertificate debug error getMessage
focal_method.modifiers: public
focal_method.parameters: (String expression, MuleMessage message)
focal_method.return: Object
focal_method.signature: Object evaluate(String expression, MuleMessage message)