diff --git a/CHANGELOG.md b/CHANGELOG.md index 03c18f46f..6894b266a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to AET will be documented in this file. **List of changes that are finished but not yet released in any final version.** +- [PR-451](https://github.com/Cognifide/aet/pull/451) Collectors and comparators configured by single config number - [PR-449](https://github.com/Cognifide/aet/pull/449) Improvements to the Winter Edition Theme - [PR-354](https://github.com/Cognifide/aet/pull/354) Remove jmsEndpointConfig information from communication settings endpoint ([#352](https://github.com/Cognifide/aet/issues/352)) - [PR-412](https://github.com/Cognifide/aet/pull/412) ([PR-336](https://github.com/Cognifide/aet/pull/336), [PR-337](https://github.com/Cognifide/aet/pull/337), [PR-395](https://github.com/Cognifide/aet/pull/395)) - Added rerun functionality for suite, test and url diff --git a/api/communication-api/src/main/java/com/cognifide/aet/communication/api/queues/QueuesConstant.java b/api/communication-api/src/main/java/com/cognifide/aet/communication/api/queues/QueuesConstant.java new file mode 100644 index 000000000..36de1d741 --- /dev/null +++ b/api/communication-api/src/main/java/com/cognifide/aet/communication/api/queues/QueuesConstant.java @@ -0,0 +1,41 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.communication.api.queues; + +public enum QueuesConstant implements WorkerConfig { + COLLECTOR("collectorJobs", "collectorResults"), + COMPARATOR("comparatorJobs", "comparatorResults"); + + public static final String NAMESPACE = "AET."; + + final String jobsQueueName; + final String resultsQueueName; + + QueuesConstant(String jobsQueueName, String resultsQueueName) { + this.jobsQueueName = jobsQueueName; + this.resultsQueueName = resultsQueueName; + } + + @Override + public String getJobsQueueName() { + return NAMESPACE + jobsQueueName; + } + + @Override + public String getResultsQueueName() { + return NAMESPACE + resultsQueueName; + } +} diff --git a/api/communication-api/src/main/java/com/cognifide/aet/communication/api/queues/WorkerConfig.java b/api/communication-api/src/main/java/com/cognifide/aet/communication/api/queues/WorkerConfig.java new file mode 100644 index 000000000..43329dd70 --- /dev/null +++ b/api/communication-api/src/main/java/com/cognifide/aet/communication/api/queues/WorkerConfig.java @@ -0,0 +1,30 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.communication.api.queues; + +public interface WorkerConfig { + + /** + * @return name of the jobs queue + */ + String getJobsQueueName(); + + /** + * @return name of the results queue name + */ + String getResultsQueueName(); + +} diff --git a/core/runner/src/main/java/com/cognifide/aet/runner/MessagesManager.java b/core/runner/src/main/java/com/cognifide/aet/runner/MessagesManager.java index 1fd752e43..03f48cbf5 100644 --- a/core/runner/src/main/java/com/cognifide/aet/runner/MessagesManager.java +++ b/core/runner/src/main/java/com/cognifide/aet/runner/MessagesManager.java @@ -16,6 +16,7 @@ package com.cognifide.aet.runner; import com.cognifide.aet.communication.api.exceptions.AETException; +import com.cognifide.aet.communication.api.queues.QueuesConstant; import com.cognifide.aet.runner.configuration.MessagesManagerConf; import java.io.IOException; import java.util.HashSet; @@ -25,7 +26,6 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; -import org.apache.commons.lang3.StringUtils; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.metatype.annotations.Designate; @@ -48,8 +48,6 @@ public class MessagesManager { private static final String QUEUES_ATTRIBUTE = "Queues"; - private static final String AET_QUEUE_DOMAIN = "AET."; - static final String DESTINATION_NAME_PROPERTY = "destinationName"; private MessagesManagerConf config; @@ -83,13 +81,6 @@ public void remove(String correlationID) throws AETException { } } - public static String createFullQueueName(String name) { - if (StringUtils.isBlank(name)) { - throw new IllegalArgumentException("Queue name can't be null or empty string!"); - } - return AET_QUEUE_DOMAIN + name; - } - protected Set getAetQueuesObjects(MBeanServerConnection connection) throws AETException { ObjectName[] queues; @@ -106,7 +97,8 @@ protected Set getAetQueuesObjects(MBeanServerConnection connection) private Set filter(ObjectName[] queuesObjects) { Set queues = new HashSet<>(); for (ObjectName queueObject : queuesObjects) { - if (queueObject.getKeyProperty(DESTINATION_NAME_PROPERTY).startsWith(AET_QUEUE_DOMAIN)) { + // filters all with the AET queue namespace + if (queueObject.getKeyProperty(DESTINATION_NAME_PROPERTY).startsWith(QueuesConstant.NAMESPACE)) { queues.add(queueObject); } } diff --git a/core/runner/src/main/java/com/cognifide/aet/runner/RunnerMessageListener.java b/core/runner/src/main/java/com/cognifide/aet/runner/RunnerMessageListener.java index 1e3a06de5..9f3dd840c 100644 --- a/core/runner/src/main/java/com/cognifide/aet/runner/RunnerMessageListener.java +++ b/core/runner/src/main/java/com/cognifide/aet/runner/RunnerMessageListener.java @@ -22,6 +22,7 @@ import com.cognifide.aet.communication.api.queues.JmsConnection; import com.cognifide.aet.communication.api.wrappers.Run; import com.cognifide.aet.queues.JmsUtils; +import com.cognifide.aet.communication.api.queues.QueuesConstant; import com.cognifide.aet.runner.scheduler.CollectorJobSchedulerService; import javax.jms.Destination; import javax.jms.JMSException; @@ -45,11 +46,9 @@ public class RunnerMessageListener implements MessageListener { private static final Logger LOGGER = LoggerFactory.getLogger(RunnerMessageListener.class); - private static final String API_QUEUE_IN = MessagesManager - .createFullQueueName("runner-in"); + private static final String API_QUEUE_IN = QueuesConstant.NAMESPACE + "runner-in"; - private static final String MAINTENANCE_QUEUE_IN = MessagesManager - .createFullQueueName("maintenance-in"); + private static final String MAINTENANCE_QUEUE_IN = QueuesConstant.NAMESPACE + "maintenance-in"; private MessageConsumer inConsumer; diff --git a/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectDispatcher.java b/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectDispatcher.java index 68fb1b214..51db09021 100644 --- a/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectDispatcher.java +++ b/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectDispatcher.java @@ -21,11 +21,12 @@ import com.cognifide.aet.communication.api.queues.JmsConnection; import com.cognifide.aet.communication.api.wrappers.MetadataRunDecorator; import com.cognifide.aet.communication.api.wrappers.UrlRunWrapper; +import com.cognifide.aet.communication.api.queues.QueuesConstant; import com.cognifide.aet.runner.RunnerConfiguration; +import com.cognifide.aet.runner.processing.TimeoutWatch; import com.cognifide.aet.runner.processing.data.wrappers.RunIndexWrapper; import com.cognifide.aet.runner.scheduler.CollectorJobSchedulerService; import com.cognifide.aet.runner.scheduler.MessageWithDestination; -import com.cognifide.aet.runner.processing.TimeoutWatch; import com.google.common.collect.Queues; import java.util.ArrayList; import java.util.Collections; @@ -105,7 +106,7 @@ protected String getQueueInName() { @Override protected String getQueueOutName() { - return "AET.collectorJobs"; + return QueuesConstant.COLLECTOR.getJobsQueueName(); } @Override diff --git a/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectionResultsRouter.java b/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectionResultsRouter.java index 7dd844d21..fd16cfd6c 100644 --- a/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectionResultsRouter.java +++ b/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/CollectionResultsRouter.java @@ -25,7 +25,7 @@ import com.cognifide.aet.communication.api.metadata.Url; import com.cognifide.aet.communication.api.queues.JmsConnection; import com.cognifide.aet.communication.api.util.ExecutionTimer; -import com.cognifide.aet.runner.MessagesManager; +import com.cognifide.aet.communication.api.queues.QueuesConstant; import com.cognifide.aet.runner.RunnerConfiguration; import com.cognifide.aet.runner.processing.TimeoutWatch; import com.cognifide.aet.runner.processing.data.wrappers.RunIndexWrapper; @@ -184,12 +184,12 @@ public boolean isFinished() { @Override protected String getQueueInName() { - return MessagesManager.createFullQueueName("collectorResults"); + return QueuesConstant.COLLECTOR.getResultsQueueName(); } @Override protected String getQueueOutName() { - return MessagesManager.createFullQueueName("comparatorJobs"); + return QueuesConstant.COMPARATOR.getJobsQueueName(); } @Override diff --git a/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/ComparisonResultsRouter.java b/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/ComparisonResultsRouter.java index c2349a1b1..cf3d19892 100644 --- a/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/ComparisonResultsRouter.java +++ b/core/runner/src/main/java/com/cognifide/aet/runner/processing/steps/ComparisonResultsRouter.java @@ -25,7 +25,7 @@ import com.cognifide.aet.communication.api.metadata.Url; import com.cognifide.aet.communication.api.queues.JmsConnection; import com.cognifide.aet.communication.api.util.ExecutionTimer; -import com.cognifide.aet.runner.MessagesManager; +import com.cognifide.aet.communication.api.queues.QueuesConstant; import com.cognifide.aet.runner.RunnerConfiguration; import com.cognifide.aet.runner.processing.TimeoutWatch; import com.cognifide.aet.runner.processing.data.wrappers.RunIndexWrapper; @@ -150,7 +150,7 @@ public void abort() { @Override protected String getQueueInName() { - return MessagesManager.createFullQueueName("comparatorResults"); + return QueuesConstant.COMPARATOR.getResultsQueueName(); } @Override diff --git a/core/runner/src/test/java/com/cognifide/aet/runner/MessagesManagerTest.java b/core/runner/src/test/java/com/cognifide/aet/runner/MessagesManagerTest.java index 43efece64..df0a19a22 100644 --- a/core/runner/src/test/java/com/cognifide/aet/runner/MessagesManagerTest.java +++ b/core/runner/src/test/java/com/cognifide/aet/runner/MessagesManagerTest.java @@ -15,8 +15,6 @@ */ package com.cognifide.aet.runner; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; @@ -41,22 +39,6 @@ public class MessagesManagerTest { @Mock private MessagesManagerConf config; - @Test(expected = IllegalArgumentException.class) - public void createFullQueueName_whenNameIsNull_expectException() throws Exception { - MessagesManager.createFullQueueName(null); - } - - @Test(expected = IllegalArgumentException.class) - public void createFullQueueName_whenNameIsEmpty_expectException() throws Exception { - MessagesManager.createFullQueueName(""); - } - - @Test - public void createFullQueueName_expectFullName() throws Exception { - String fullQueueName = MessagesManager.createFullQueueName("test"); - assertThat(fullQueueName, is("AET.test")); - } - @Test public void remove_ExpectRemovingInvoked() throws Exception { MessagesManager messagesManager = new MessagesManager(); diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/exceptions/ConsumerInitException.java b/core/worker/src/main/java/com/cognifide/aet/worker/exceptions/ConsumerInitException.java new file mode 100644 index 000000000..127660b4a --- /dev/null +++ b/core/worker/src/main/java/com/cognifide/aet/worker/exceptions/ConsumerInitException.java @@ -0,0 +1,26 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.worker.exceptions; + +/** + * Thrown when failed to create consumer. + */ +public class ConsumerInitException extends RuntimeException { + + public ConsumerInitException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListenerImpl.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListener.java similarity index 79% rename from core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListenerImpl.java rename to core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListener.java index a9c04e5fb..03c6bab0b 100644 --- a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListenerImpl.java +++ b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListener.java @@ -31,42 +31,22 @@ import javax.jms.JMSException; import javax.jms.Message; import org.apache.commons.lang3.StringUtils; -import org.osgi.service.component.annotations.Activate; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Deactivate; -import org.osgi.service.component.annotations.Reference; -import org.osgi.service.metatype.annotations.Designate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Component( - service = CollectorMessageListenerImpl.class, - immediate = true) -@Designate(ocd = CollectorMessageListenerImplConfig.class, factory = true) -public class CollectorMessageListenerImpl extends AbstractTaskMessageListener { +class CollectorMessageListener extends WorkerMessageListener { - private static final Logger LOGGER = LoggerFactory.getLogger(CollectorMessageListenerImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(CollectorMessageListener.class); - @Reference - private JmsConnection jmsConnection; + private final CollectorDispatcher dispatcher; + private final WebDriverProvider webDriverProvider; - @Reference - private CollectorDispatcher dispatcher; - - @Reference - private WebDriverProvider webDriverProvider; - - private CollectorMessageListenerImplConfig config; - - @Activate - void activate(CollectorMessageListenerImplConfig config) { - this.config = config; - super.doActivate(config.consumerQueueName(), config.producerQueueName(), config.pf()); - } - - @Deactivate - void deactivate() { - super.doDeactivate(); + CollectorMessageListener(String name, CollectorDispatcher dispatcher, + WebDriverProvider webDriverProvider, JmsConnection jmsConnection, String consumerQueueName, + String producerQueueName) { + super(name, jmsConnection, consumerQueueName, producerQueueName); + this.dispatcher = dispatcher; + this.webDriverProvider = webDriverProvider; } @Override @@ -75,15 +55,15 @@ public void onMessage(final Message message) { try { collectorJobData = JmsUtils.getFromMessage(message, CollectorJobData.class); } catch (JMSException e) { - LOGGER.error("Invalid message obtained!", e); + LOGGER.error("[{}] Invalid message obtained!", name, e); } String correlationId = JmsUtils.getJMSCorrelationID(message); String requestMessageId = JmsUtils.getJMSMessageID(message); if (collectorJobData != null && StringUtils.isNotBlank(correlationId) && requestMessageId != null) { LOGGER.info( - "CollectorJobData [{}] message arrived with {} urls. CorrelationId: {} RequestMessageId: {}", - config.name(), collectorJobData.getUrls().size(), correlationId, + "[{}] CollectorJobData message arrived with {} urls. CorrelationId: {} RequestMessageId: {}", + name, collectorJobData.getUrls().size(), correlationId, requestMessageId); WebCommunicationWrapper webCommunicationWrapper = null; int collected = 0; @@ -101,7 +81,7 @@ public void onMessage(final Message message) { } catch (WorkerException e) { for (Url url : collectorJobData.getUrls()) { String errorMessage = String.format( - "Couldn't process following url `%s` because of error: %s", url.getUrl(), + "[%s] Couldn't process following url `%s` because of error: %s", name, url.getUrl(), e.getMessage()); LOGGER.error(errorMessage, e); // updates all steps with worker exception @@ -118,7 +98,7 @@ public void onMessage(final Message message) { } finally { quitWebDriver(webCommunicationWrapper); } - LOGGER.info("Successfully collected from {}/{} urls.", collected, + LOGGER.info("[{}] Successfully collected from {}/{} urls.", name, collected, collectorJobData.getUrls().size()); } @@ -140,9 +120,8 @@ private int runUrls(CollectorJobData collectorJobData, String requestMessageId, processedUrl.setCollectionStats(timer.toStatistics()); feedbackQueue.sendObjectMessageWithCorrelationID(collectorResultData, correlationId); } catch (Exception e) { - LOGGER.error("Unrecognized collector error", e); + LOGGER.error("[{}] Unrecognized collector error", name, e); final String message = "Unrecognized collector error: " + e.getMessage(); - CollectorStepResult collectorStepProcessingError = CollectorStepResult.newProcessingErrorResult(message); for (Step step : url.getSteps()) { @@ -175,9 +154,4 @@ private void quitWebDriver(WebCommunicationWrapper webCommunicationWrapper) { } } - @Override - protected JmsConnection getJmsConnection() { - return jmsConnection; - } - } diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListenerImplConfig.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListenerImplConfig.java deleted file mode 100644 index d6f993384..000000000 --- a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/CollectorMessageListenerImplConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * AET - * - * Copyright (C) 2013 Cognifide Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.cognifide.aet.worker.listeners; - -import org.osgi.service.metatype.annotations.AttributeDefinition; -import org.osgi.service.metatype.annotations.ObjectClassDefinition; - -@ObjectClassDefinition(name = "AET Collector Message Listener") -public @interface CollectorMessageListenerImplConfig { - - String LISTENER_NAME_LABEL = "Collector name"; - String LISTENER_NAME_DESC = "Name of collector. Used in logs only"; - String LISTENER_NAME_DEFAULT_VALUE = "Collector"; - - String CONSUMER_QUEUE_NAME_LABEL = "Consumer queue name"; - String CONSUMER_QUEUE_NAME_DEFAULT_VALUE = "AET.collectorJobs"; - - String PRODUCER_QUEUE_NAME_LABEL = "Producer queue name"; - String PRODUCER_QUEUE_NAME_DEFAULT_VALUE = "AET.collectorResults"; - - String PREFETCH_SIZE_LABEL = "Prefetch size"; - String PREFETCH_SIZE_DESC = "http://activemq.apache.org/what-is-the-prefetch-limit-for.html"; - String PREFETCH_SIZE_DEFAULT_VALUE = "1"; - - @AttributeDefinition( - name = LISTENER_NAME_LABEL, - description = LISTENER_NAME_DESC) - String name() default LISTENER_NAME_DEFAULT_VALUE; - - @AttributeDefinition( - name = CONSUMER_QUEUE_NAME_LABEL) - String consumerQueueName() default CONSUMER_QUEUE_NAME_DEFAULT_VALUE; - - @AttributeDefinition( - name = PRODUCER_QUEUE_NAME_LABEL) - String producerQueueName() default PRODUCER_QUEUE_NAME_DEFAULT_VALUE; - - @AttributeDefinition( - name = PREFETCH_SIZE_LABEL, - description = PREFETCH_SIZE_DESC) - String pf() default PREFETCH_SIZE_DEFAULT_VALUE; -} diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListenerImpl.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListener.java similarity index 70% rename from core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListenerImpl.java rename to core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListener.java index f43b5db79..c68de78e2 100644 --- a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListenerImpl.java +++ b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListener.java @@ -29,39 +29,19 @@ import javax.jms.JMSException; import javax.jms.Message; import org.apache.commons.lang3.StringUtils; -import org.osgi.service.component.annotations.Activate; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Deactivate; -import org.osgi.service.component.annotations.Reference; -import org.osgi.service.metatype.annotations.Designate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Component( - service = ComparatorMessageListenerImpl.class, - immediate = true) -@Designate(ocd = ComparatorMessageListenerImplConfig.class, factory = true) -public class ComparatorMessageListenerImpl extends AbstractTaskMessageListener { +class ComparatorMessageListener extends WorkerMessageListener { - private static final Logger LOGGER = LoggerFactory.getLogger(ComparatorMessageListenerImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ComparatorMessageListener.class); - @Reference - private JmsConnection jmsConnection; + private final ComparatorDispatcher dispatcher; - @Reference - private ComparatorDispatcher dispatcher; - - private ComparatorMessageListenerImplConfig config; - - @Activate - void activate(ComparatorMessageListenerImplConfig config) { - this.config = config; - super.doActivate(config.consumerQueueName(), config.producerQueueName(), config.pf()); - } - - @Deactivate - void deactivate() { - super.doDeactivate(); + ComparatorMessageListener(String name, ComparatorDispatcher dispatcher, + JmsConnection jmsConnection, String consumerQueueName, String producerQueueName) { + super(name, jmsConnection, consumerQueueName, producerQueueName); + this.dispatcher = dispatcher; } @Override @@ -76,7 +56,8 @@ public void onMessage(final Message message) { if (comparatorJobData != null && StringUtils.isNotBlank(jmsCorrelationId)) { LOGGER.info( - "ComparatorJobData [{}] message arrived. CorrelationId: {} TestName: {} UrlName: {}", + "[{}] ComparatorJobData [{}] message arrived. CorrelationId: {} TestName: {} UrlName: {}", + name, comparatorJobData, jmsCorrelationId, comparatorJobData.getTestName(), @@ -84,17 +65,19 @@ public void onMessage(final Message message) { final Step step = comparatorJobData.getStep(); final ComparatorProperties properties = new ComparatorProperties( comparatorJobData.getCompany(), - comparatorJobData.getProject(), step.getPattern(), step.getStepResult().getArtifactId(), step.getStepResult().getPayload()); + comparatorJobData.getProject(), step.getPattern(), step.getStepResult().getArtifactId(), + step.getStepResult().getPayload()); for (Comparator comparator : step.getComparators()) { - LOGGER.info("Start comparison for comparator {} in step {}", comparator, step); + LOGGER.info("[{}] Start comparison for comparator {} in step {}", name, comparator, step); ComparatorResultData.Builder resultBuilder = ComparatorResultData .newBuilder(comparatorJobData.getTestName(), comparatorJobData.getUrlName(), step.getIndex()); try { Comparator processedComparator = dispatcher.run(comparator, properties); LOGGER.info( - "Comparison successfully ended. CorrelationId: {} TestName: {} Url: {} Comparator: {}", + "[{}] Comparison successfully ended. CorrelationId: {} TestName: {} Url: {} Comparator: {}", + name, jmsCorrelationId, comparatorJobData.getTestName(), comparatorJobData.getUrlName(), @@ -102,7 +85,8 @@ public void onMessage(final Message message) { resultBuilder.withComparisonResult(processedComparator) .withStatus(JobStatus.SUCCESS); } catch (Exception e) { - LOGGER.error("Exception during compare. CorrelationId: {}", jmsCorrelationId, e); + LOGGER + .error("[{}] Exception during compare. CorrelationId: {}", name, jmsCorrelationId, e); final ComparatorStepResult errorResult = new ComparatorStepResult(null, ComparatorStepResult.Status.PROCESSING_ERROR); errorResult.addError(e.getMessage()); @@ -117,9 +101,4 @@ public void onMessage(final Message message) { } } - @Override - protected JmsConnection getJmsConnection() { - return jmsConnection; - } - } diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListenerImplConfig.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListenerImplConfig.java deleted file mode 100644 index 8b3f8089d..000000000 --- a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/ComparatorMessageListenerImplConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * AET - * - * Copyright (C) 2013 Cognifide Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package com.cognifide.aet.worker.listeners; - -import org.osgi.service.metatype.annotations.AttributeDefinition; -import org.osgi.service.metatype.annotations.ObjectClassDefinition; - -@ObjectClassDefinition(name = "AET Comparator Message Listener") -public @interface ComparatorMessageListenerImplConfig { - - String LISTENER_NAME_LABEL = "Comparator name"; - String LISTENER_NAME_DESC = "Name of comparator. Used in logs only"; - String LISTENER_NAME_DEFAULT_VALUE = "Comparator"; - - String CONSUMER_QUEUE_NAME_LABEL = "Consumer queue name"; - String CONSUMER_QUEUE_NAME_DEFAULT_VALUE = "AET.comparatorJobs"; - - String PRODUCER_QUEUE_NAME_LABEL = "Producer queue name"; - String PRODUCER_QUEUE_NAME_DEFAULT_VALUE = "AET.comparatorResults"; - - String PREFETCH_SIZE_LABEL = "Prefetch size"; - String PREFETCH_SIZE_DESC = "http://activemq.apache.org/what-is-the-prefetch-limit-for.html"; - String PREFETCH_SIZE_DEFAULT_VALUE = "1"; - - @AttributeDefinition( - name = LISTENER_NAME_LABEL, - description = LISTENER_NAME_DESC) - String name() default LISTENER_NAME_DEFAULT_VALUE; - - @AttributeDefinition( - name = CONSUMER_QUEUE_NAME_LABEL) - String consumerQueueName() default CONSUMER_QUEUE_NAME_DEFAULT_VALUE; - - @AttributeDefinition( - name = PRODUCER_QUEUE_NAME_LABEL) - String producerQueueName() default PRODUCER_QUEUE_NAME_DEFAULT_VALUE; - - @AttributeDefinition( - name = PREFETCH_SIZE_LABEL, - description = PREFETCH_SIZE_DESC) - String pf() default PREFETCH_SIZE_DEFAULT_VALUE; -} diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/AbstractTaskMessageListener.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkerMessageListener.java similarity index 54% rename from core/worker/src/main/java/com/cognifide/aet/worker/listeners/AbstractTaskMessageListener.java rename to core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkerMessageListener.java index 5b3892a68..7fa994287 100644 --- a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/AbstractTaskMessageListener.java +++ b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkerMessageListener.java @@ -18,33 +18,40 @@ import com.cognifide.aet.communication.api.queues.JmsConnection; import com.cognifide.aet.queues.JmsUtils; import com.cognifide.aet.worker.results.FeedbackQueue; +import java.util.Objects; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -public abstract class AbstractTaskMessageListener implements MessageListener { +abstract class WorkerMessageListener implements MessageListener { - private Session jmsSession; + private static final Logger LOGGER = LoggerFactory.getLogger(WorkerMessageListener.class); - private MessageConsumer consumer; + private final Session jmsSession; + private final MessageConsumer consumer; - FeedbackQueue feedbackQueue; + final String name; + final FeedbackQueue feedbackQueue; - void doActivate(String consumerQueueName, String producerQueueName, String prefetchSize) { - - String queueName = consumerQueueName + "?consumer.prefetchSize=" + prefetchSize; + WorkerMessageListener(String name, JmsConnection jmsConnection, + String consumerQueueName, + String producerQueueName) { + LOGGER.info("Starting {}", name); + this.name = name; try { - jmsSession = getJmsConnection().getJmsSession(); - consumer = jmsSession.createConsumer(jmsSession.createQueue(queueName)); - consumer.setMessageListener(this); + jmsSession = jmsConnection.getJmsSession(); feedbackQueue = new FeedbackQueue(jmsSession, producerQueueName); + consumer = jmsSession.createConsumer(jmsSession.createQueue(consumerQueueName)); + consumer.setMessageListener(this); } catch (JMSException e) { throw new IllegalStateException(e.getMessage(), e); } } - void doDeactivate() { + void close() { if (feedbackQueue != null) { feedbackQueue.close(); } @@ -52,6 +59,27 @@ void doDeactivate() { JmsUtils.closeQuietly(jmsSession); } - protected abstract JmsConnection getJmsConnection(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WorkerMessageListener that = (WorkerMessageListener) o; + return Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + @Override + public String toString() { + return this.getClass().getSimpleName() + "{" + + "name='" + name + '\'' + + '}'; + } } diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkersListenersService.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkersListenersService.java new file mode 100644 index 000000000..735dc0ae2 --- /dev/null +++ b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkersListenersService.java @@ -0,0 +1,112 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.worker.listeners; + +import com.cognifide.aet.communication.api.queues.JmsConnection; +import com.cognifide.aet.communication.api.queues.QueuesConstant; +import com.cognifide.aet.worker.api.CollectorDispatcher; +import com.cognifide.aet.worker.api.ComparatorDispatcher; +import com.cognifide.aet.worker.drivers.WebDriverProvider; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.IntStream; +import org.apache.commons.lang3.StringUtils; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Reference; +import org.osgi.service.metatype.annotations.Designate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Component( + service = WorkersListenersService.class, + immediate = true) +@Designate(ocd = WorkersListenersServiceConfig.class) +public class WorkersListenersService { + + private static final Logger LOGGER = LoggerFactory.getLogger(WorkersListenersService.class); + + @Reference + private JmsConnection jmsConnection; + + @Reference + private WebDriverProvider webDriverProvider; + + @Reference + private CollectorDispatcher collectorDispatcher; + + @Reference + private ComparatorDispatcher comparatorDispatcher; + + private Set consumers; + + @Activate + void activate(WorkersListenersServiceConfig config) { + LOGGER.info("Starting Workers Listeners Service with {}", config); + consumers = new HashSet<>(); + consumers.addAll(spawnCollectors(config)); + consumers.addAll(spawnComparators(config)); + } + + private Set spawnListeners(int noOfInstances, + Function getListenerInstance) { + final Set consumersSet = new HashSet<>(); + IntStream.rangeClosed(1, noOfInstances) + .forEach(no -> { + WorkerMessageListener listener = getListenerInstance.apply(no); + consumersSet.add(listener); + }); + return consumersSet; + } + + private Integer getenvOrDefault(String envVarName, int defaultValue) { + return Optional.ofNullable(System.getenv(envVarName)) + .filter(StringUtils::isNotBlank) + .map(Integer::parseInt) + .orElse(defaultValue); + } + + private Set spawnCollectors(WorkersListenersServiceConfig config) { + final String queueName = + QueuesConstant.COLLECTOR.getJobsQueueName() + "?consumer.prefetchSize=" + config + .collectorPrefetchSize(); + return spawnListeners(getenvOrDefault(WorkersListenersServiceConfig.COLLECTORS_NO_ENV, + config.collectorInstancesNo()), + no -> new CollectorMessageListener("Collector-" + no, collectorDispatcher, + webDriverProvider, jmsConnection, queueName, + QueuesConstant.COLLECTOR.getResultsQueueName())); + } + + private Set spawnComparators(WorkersListenersServiceConfig config) { + final String queueName = + QueuesConstant.COMPARATOR.getJobsQueueName() + "?consumer.prefetchSize=" + config + .comparatorPrefetchSize(); + return spawnListeners(getenvOrDefault(WorkersListenersServiceConfig.COMPARATORS_NO_ENV, + config.comparatorInstancesNo()), + no -> new ComparatorMessageListener("Comparator-" + no, comparatorDispatcher, + jmsConnection, queueName, QueuesConstant.COMPARATOR.getResultsQueueName())); + } + + @Deactivate + void deactivate() { + LOGGER.info("Closing Workers Listeners with: {}", consumers); + consumers.forEach(WorkerMessageListener::close); + } + +} diff --git a/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkersListenersServiceConfig.java b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkersListenersServiceConfig.java new file mode 100644 index 000000000..f2264340c --- /dev/null +++ b/core/worker/src/main/java/com/cognifide/aet/worker/listeners/WorkersListenersServiceConfig.java @@ -0,0 +1,64 @@ +/** + * AET + * + * Copyright (C) 2013 Cognifide Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package com.cognifide.aet.worker.listeners; + +import org.osgi.service.metatype.annotations.AttributeDefinition; +import org.osgi.service.metatype.annotations.AttributeType; +import org.osgi.service.metatype.annotations.ObjectClassDefinition; + +@ObjectClassDefinition(name = "AET Workers Listener Service") +public @interface WorkersListenersServiceConfig { + + String COLLECTORS_NO_ENV = "COLLECTORS_NO"; + String COMPARATORS_NO_ENV = "COMPARATORS_NO"; + + String COLLECTOR_PREFETCH_SIZE_LABEL = "Collectors prefetch size"; + String COLLECTOR_PREFETCH_SIZE_DESC = "http://activemq.apache.org/what-is-the-prefetch-limit-for.html"; + String COLLECTOR_PREFETCH_SIZE_DEFAULT_VALUE = "1"; + + String COLLECTOR_INSTANCES_NO_LABEL = "Number of collector instances"; + String COLLECTOR_INSTANCES_NO_DESC = "Might be overwritten by env variable" + COLLECTORS_NO_ENV; + int COLLECTOR_INSTANCES_NO_DEFAULT_VALUE = 5; + + String COMPARATOR_PREFETCH_SIZE_LABEL = "Comparators prefetch size"; + String COMPARATOR_PREFETCH_SIZE_DESC = "http://activemq.apache.org/what-is-the-prefetch-limit-for.html"; + String COMPARATOR_PREFETCH_SIZE_DEFAULT_VALUE = "1"; + + String COMPARATOR_INSTANCES_NO_LABEL = "Number of comparator instances"; + String COMPARATOR_INSTANCES_NO_DESC = "Might be overwritten by env variable" + COMPARATORS_NO_ENV; + int COMPARATOR_INSTANCES_NO_DEFAULT_VALUE = 5; + + @AttributeDefinition( + name = COLLECTOR_PREFETCH_SIZE_LABEL, + description = COLLECTOR_PREFETCH_SIZE_DESC) + String collectorPrefetchSize() default COLLECTOR_PREFETCH_SIZE_DEFAULT_VALUE; + + @AttributeDefinition(name = COLLECTOR_INSTANCES_NO_LABEL, + description = COLLECTOR_INSTANCES_NO_DESC, + type = AttributeType.INTEGER) + int collectorInstancesNo() default COLLECTOR_INSTANCES_NO_DEFAULT_VALUE; + + @AttributeDefinition( + name = COMPARATOR_PREFETCH_SIZE_LABEL, + description = COMPARATOR_PREFETCH_SIZE_DESC) + String comparatorPrefetchSize() default COMPARATOR_PREFETCH_SIZE_DEFAULT_VALUE; + + @AttributeDefinition(name = COMPARATOR_INSTANCES_NO_LABEL, + description = COMPARATOR_INSTANCES_NO_DESC, + type = AttributeType.INTEGER) + int comparatorInstancesNo() default COMPARATOR_INSTANCES_NO_DEFAULT_VALUE; + +} diff --git a/documentation/src/main/wiki/AdvancedSetup.md b/documentation/src/main/wiki/AdvancedSetup.md index 529c711db..e72f765c1 100644 --- a/documentation/src/main/wiki/AdvancedSetup.md +++ b/documentation/src/main/wiki/AdvancedSetup.md @@ -63,25 +63,20 @@ of Apache server which hosts the AET Report application - e.g. `http://aet-repor ##### Collectors and comparators configuration - The services are **AET Collector Message Listener** and **AET Comparator Message Listener**. There must be at least one of each of those services configured. Below there are listed the properties of each of above mentioned services with required values. +The service is **AET Workers Listeners Service**. +To enable proper working of AET instance, you should configure at least 1 collector and 1 comparator. -###### AET Collector Message Listener +| Property name | Default value | Comment | +| ------------- | ----- | ----- | +| Number of collector instances | `5` | Might be overwritten by env variable `COLLECTORS_NO` | +| Collectors prefetch size | `1` | Read more [here](http://activemq.apache.org/what-is-the-prefetch-limit-for.html) | +| Number of comparator instances | `5` | Might be overwritten by env variable `COMPARATORS_NO` | +| Comparators prefetch size | `1` | Read more [here](http://activemq.apache.org/what-is-the-prefetch-limit-for.html) | -| Property name | Value | -| ------------- | ----- | -| Collector name | Has to be unique within Collector Message Listeners. | -| Consumer queue name | Fixed value `AET.collectorJobs` | -| Producer queue name | Fixed value `AET.collectorResults` | -| Embedded Proxy Server Port | Has to be unique within Collector Message Listeners. | - -###### AET Comparator Message Listener -| Property name | Value | -| ------------- | ----- | -| Comparator name | Has to be unique within Comparator Message Listeners. | -| Consumer queue name | Fixed value `AET.comparatorJobs` | -| Producer queue name | Fixed value `AET.comparatorResults` | +> **Important note** +> Number of collector instances should be the number of browsers available through all Selenium Grid Nodes. ##### Chrome options configuration The `AET Chrome WebDriver Factory` component configuration (`chromeOptions` property) allows you to configure a list of options/arguments -which will be passed to the Chrome browser binary. The default list of Chrome options is: `--disable-plugins`, `--headless`, `--hide-scrollbars`, `--disable-gpu`. \ No newline at end of file +which will be passed to the Chrome browser binary. The default list of Chrome options is: `--disable-plugins`, `--headless`, `--hide-scrollbars`, `--disable-gpu`. diff --git a/documentation/src/main/wiki/UpgradeNotes.md b/documentation/src/main/wiki/UpgradeNotes.md index 1a9bed72e..e98483a22 100644 --- a/documentation/src/main/wiki/UpgradeNotes.md +++ b/documentation/src/main/wiki/UpgradeNotes.md @@ -7,6 +7,17 @@ You may see all changes in the [Changelog](https://github.com/Cognifide/aet/blob ## Unreleased +### Users + +### Admins + +#### [PR-451](https://github.com/Cognifide/aet/pull/451) Collectors and comparators configured by single config number + +Remove all `CollectorMessageListenerImpl` and `ComparatorMessageListenerImpl` config files. +Create `com.cognifide.aet.worker.listeners.WorkersListenersService.cfg` and configure proper +number of collectors and comparators there. +You can find example config file [here](https://github.com/Cognifide/aet/blob/master/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.WorkersListenersService.cfg). + ## Version 3.0.0 @@ -74,4 +85,4 @@ allowAutoCreate=true server=192.168.123.100 port=8080 ``` - \ No newline at end of file + diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-B.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-B.cfg deleted file mode 100644 index 502908159..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-B.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Collector2 -consumerQueueName=AET.collectorJobs -producerQueueName=AET.collectorResults -pf=1 diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-C.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-C.cfg deleted file mode 100644 index f61f21fec..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-C.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Collector3 -consumerQueueName=AET.collectorJobs -producerQueueName=AET.collectorResults -pf=1 diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-D.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-D.cfg deleted file mode 100644 index a470ac23e..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-D.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Collector4 -consumerQueueName=AET.collectorJobs -producerQueueName=AET.collectorResults -pf=1 diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-E.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-E.cfg deleted file mode 100644 index 365056125..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-E.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Collector5 -consumerQueueName=AET.collectorJobs -producerQueueName=AET.collectorResults -pf=1 diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-A.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-A.cfg deleted file mode 100644 index f0785d7f1..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-A.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Comparator1 -consumerQueueName=AET.comparatorJobs -producerQueueName=AET.comparatorResults -pf=1 \ No newline at end of file diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-B.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-B.cfg deleted file mode 100644 index f84693e0d..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-B.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Comparator2 -consumerQueueName=AET.comparatorJobs -producerQueueName=AET.comparatorResults -pf=1 \ No newline at end of file diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-C.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-C.cfg deleted file mode 100644 index 5882f53c0..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-C.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Comparator3 -consumerQueueName=AET.comparatorJobs -producerQueueName=AET.comparatorResults -pf=1 \ No newline at end of file diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-D.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-D.cfg deleted file mode 100644 index f35657964..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-D.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Comparator4 -consumerQueueName=AET.comparatorJobs -producerQueueName=AET.comparatorResults -pf=1 \ No newline at end of file diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-E.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-E.cfg deleted file mode 100644 index a7848c2ea..000000000 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl-E.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# AET -# -# Copyright (C) 2013 Cognifide Limited -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name=Comparator5 -consumerQueueName=AET.comparatorJobs -producerQueueName=AET.comparatorResults -pf=1 \ No newline at end of file diff --git a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-A.cfg b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.WorkersListenersService.cfg similarity index 86% rename from osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-A.cfg rename to osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.WorkersListenersService.cfg index 49ce73857..6ba804e2a 100644 --- a/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl-A.cfg +++ b/osgi-dependencies/configs/src/main/resources/com.cognifide.aet.worker.listeners.WorkersListenersService.cfg @@ -16,7 +16,7 @@ # limitations under the License. # -name=Collector1 -consumerQueueName=AET.collectorJobs -producerQueueName=AET.collectorResults -pf=1 +collectorPrefetchSize=1 +collectorInstancesNo=5 +comparatorPrefetchSize=1 +comparatorInstancesNo=5 diff --git a/test-executor/src/main/java/com/cognifide/aet/executor/SuiteExecutor.java b/test-executor/src/main/java/com/cognifide/aet/executor/SuiteExecutor.java index 79acb2597..a547613a6 100644 --- a/test-executor/src/main/java/com/cognifide/aet/executor/SuiteExecutor.java +++ b/test-executor/src/main/java/com/cognifide/aet/executor/SuiteExecutor.java @@ -21,6 +21,7 @@ import com.cognifide.aet.communication.api.metadata.Suite; import com.cognifide.aet.communication.api.metadata.ValidatorException; import com.cognifide.aet.communication.api.queues.JmsConnection; +import com.cognifide.aet.communication.api.queues.QueuesConstant; import com.cognifide.aet.executor.configuration.SuiteExecutorConf; import com.cognifide.aet.executor.http.HttpSuiteExecutionResultWrapper; import com.cognifide.aet.executor.model.TestRun; @@ -64,7 +65,7 @@ public class SuiteExecutor { private static final Logger LOGGER = LoggerFactory.getLogger(SuiteExecutor.class); - private static final String RUNNER_IN_QUEUE = "AET.runner-in"; + private static final String RUNNER_IN_QUEUE = QueuesConstant.NAMESPACE + "runner-in"; private static final String HTML_REPORT_URL_FORMAT = "%s/report.html?company=%s&project=%s&correlationId=%s";