Skip to content

Commit

Permalink
feat: finishing touch on rest api and ui
Browse files Browse the repository at this point in the history
* implement scenario REST API
* add scenario control to frontend
* enhance navigation, buttons and icons
* improve tests for scenario execution
  • Loading branch information
bbortt committed Nov 3, 2023
1 parent c99161d commit efac87c
Show file tree
Hide file tree
Showing 113 changed files with 3,133 additions and 466 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
@Test
@ContextConfiguration(classes = SimulatorJmsFaxIT.EndpointConfig.class)
public class SimulatorJmsFaxIT extends TestNGCitrusSpringSupport {

private final PayloadHelper payloadHelper = new PayloadHelper();

@Autowired
Expand Down Expand Up @@ -227,7 +228,7 @@ public void testUpdateFaxStatusStarter() {
$(http()
.client(restEndpoint)
.send()
.post("/api/scenario/launch/UpdateFaxStatus")
.post("/api/scenarios/UpdateFaxStatus/launch")
.message()
.contentType(MediaType.APPLICATION_JSON_VALUE)
.body(asJson(referenceId.asScenarioParameter(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void testHelloRequest() {
$(http()
.client(restEndpoint)
.send()
.post("/api/scenario/launch/HelloStarter")
.post("/api/scenarios/HelloStarter/launch")
.message()
.contentType(MediaType.APPLICATION_JSON_VALUE)
.body(asJson(name.asScenarioParameter())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
*/
@Configuration
@ComponentScan(basePackages = {
// TODO: Remove when scenario controller has been migrated
"org.citrusframework.simulator.controller",
"org.citrusframework.simulator.web.rest",
"org.citrusframework.simulator.listener",
"org.citrusframework.simulator.service",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.citrusframework.simulator.events;

import java.util.Set;
import org.citrusframework.simulator.service.ScenarioLookupService;
import org.springframework.context.ApplicationEvent;

public final class ScenariosReloadedEvent extends ApplicationEvent {

private final Set<String> scenarioNames;
private final Set<String> scenarioStarterNames;

public ScenariosReloadedEvent(ScenarioLookupService source) {
super(source);

this.scenarioNames = source.getScenarioNames();
this.scenarioStarterNames = source.getStarterNames();
}

public Set<String> getScenarioNames() {
return scenarioNames;
}

public Set<String> getScenarioStarterNames() {
return scenarioStarterNames;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2017 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,6 @@
import org.citrusframework.simulator.model.Message;
import org.citrusframework.simulator.model.ScenarioAction;
import org.citrusframework.simulator.model.ScenarioExecution;
import org.citrusframework.simulator.model.ScenarioParameter;
import org.citrusframework.simulator.repository.ScenarioExecutionRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -58,29 +57,6 @@ public ActivityService(ScenarioExecutionRepository scenarioExecutionRepository,
this.messageService = messageService;
}

/**
* Creates a new {@link ScenarioExecution}, persisting it within the database.
*
* @param scenarioName the name of the scenario
* @param scenarioParameters the scenario's start parameters
* @return the new {@link ScenarioExecution}
*/
public ScenarioExecution createExecutionScenario(String scenarioName, Collection<ScenarioParameter> scenarioParameters) {
ScenarioExecution scenarioExecution = new ScenarioExecution();
scenarioExecution.setScenarioName(scenarioName);
scenarioExecution.setStartDate(timeProvider.getTimeNow());
scenarioExecution.setStatus(ScenarioExecution.Status.RUNNING);

if (scenarioParameters != null) {
for (ScenarioParameter tp : scenarioParameters) {
scenarioExecution.addScenarioParameter(tp);
}
}

scenarioExecution = scenarioExecutionRepository.save(scenarioExecution);
return scenarioExecution;
}

public void completeScenarioExecutionSuccess(TestCase testCase) {
completeScenarioExecution(ScenarioExecution.Status.SUCCESS, testCase, null);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import jakarta.persistence.criteria.JoinType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import org.citrusframework.simulator.model.Message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import jakarta.persistence.criteria.JoinType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import org.citrusframework.simulator.model.Message;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import jakarta.persistence.criteria.CriteriaBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import jakarta.persistence.criteria.JoinType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import org.citrusframework.simulator.model.ScenarioAction;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 the original author or authors.
*
* 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 org.citrusframework.simulator.service;

import jakarta.persistence.criteria.JoinType;
Expand Down
Loading

0 comments on commit efac87c

Please sign in to comment.