/** * Gets a job definition key using namespace and name of the the job definition extracted from the specified process definition key using the Regex * pattern. * * @param processDefinitionKey the process definition key * * @return the job definition key */ public JobDefinitionAlternateKeyDto getJobDefinitionKey(String processDefinitionKey) { return getJobDefinitionKey(processDefinitionKey, getNamespaceAndJobNameRegexPattern()); }
/** * Gets a job definition key using namespace and name of the the job definition extracted from the specified process definition key using the Regex * pattern. * * @param processDefinitionKey the process definition key * * @return the job definition key */ public JobDefinitionAlternateKeyDto getJobDefinitionKey(String processDefinitionKey) { return getJobDefinitionKey(processDefinitionKey, getNamespaceAndJobNameRegexPattern()); }
@Test public void testGetJobDefinitionKeyInvalidProcessDefinitionKey() { // Set up test values. String testProcessDefinitionKey = "INVALID_PROCESS_DEFINITION_KEY"; // Get the regex pattern. Pattern pattern = jobDefinitionHelper.getNamespaceAndJobNameRegexPattern(); // Try to get the job definition key when process definition key not match the expected pattern. try { jobDefinitionHelper.getJobDefinitionKey(testProcessDefinitionKey, pattern); fail(); } catch (IllegalArgumentException e) { assertEquals( String.format("Process definition key \"%s\" does not match the expected pattern \"%s\".", testProcessDefinitionKey, pattern.toString()), e.getMessage()); } }
Pattern pattern = jobDefinitionHelper.getNamespaceAndJobNameRegexPattern();
Pattern pattern = jobDefinitionHelper.getNamespaceAndJobNameRegexPattern();