QueueUtils { public static String getTaskType(String queue) { if(StringUtils.isBlank(queue)) { return StringUtils.EMPTY; } int domainSeperatorIndex = StringUtils.indexOf(queue, DOMAIN_SEPARATOR); int startIndex = 0; if (domainSeperatorIndex == -1) { startIndex = 0; } else { startIndex = domainSeperatorIndex +1 ; } int endIndex = StringUtils.indexOf(queue, EXECUTION_NAME_SPACE_SEPRATOR); if (endIndex == -1) { endIndex = StringUtils.lastIndexOf(queue, ISOLATION_SEPARATOR); } if (endIndex == -1) { endIndex = queue.length(); } return StringUtils.substring(queue, startIndex, endIndex); }  static String getQueueName(Task task); static String getQueueName(String taskType, String domain, String isolationGroup, String executionNameSpace); static String getQueueNameWithoutDomain(String queueName); static String getExecutionNameSpace(String queueName); static boolean isIsolatedQueue(String queue); static String getTaskType(String queue); static final String DOMAIN_SEPARATOR; static final String ISOLATION_SEPARATOR; static final String EXECUTION_NAME_SPACE_SEPRATOR; }
@Test public void testGetTaskType() { Assert.assertEquals("taskType", QueueUtils.getTaskType("domain:taskType-isolated")); }
@Test public void testGetTaskTypeWithoutDomain() { Assert.assertEquals("taskType", QueueUtils.getTaskType("taskType-isolated")); }
@Test public void testGetTaskTypeWithoutDomainAndWithoutIsolationGroup() { Assert.assertEquals("taskType",QueueUtils.getTaskType("taskType")); }
@Test public void testGetTaskTypeWithoutDomainAndWithExecutionNameSpace() { Assert.assertEquals("taskType",QueueUtils.getTaskType("taskType@eN")); }