<commit_before>/* 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.activiti.standalone.validation;

import org.activiti.bpmn.exceptions.XMLException;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
import org.activiti.engine.repository.Deployment;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * @author <NAME>
 */
public class DisabledSchemaValidationTest {
	
	protected ProcessEngine processEngine;
	
	protected RepositoryService repositoryService;
	
	@Before
	public void setup() {
		this.processEngine = new StandaloneInMemProcessEngineConfiguration()
			.setJdbcUrl("jdbc:h2:mem:activiti-process-validation;DB_CLOSE_DELAY=1000")
			.buildProcessEngine();
		this.repositoryService = processEngine.getRepositoryService();
	}
	
	@After
	public void tearDown() {
		for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
			repositoryService.deleteDeployment(deployment.getId());
		}
		
		ProcessEngines.unregister(processEngine);
		processEngine = null;
		repositoryService = null;
	}
	
	@Test
	public void testDisableValidation() {
		
		// Should fail
		try {
			repositoryService.createDeployment()
				.addClasspathResource("org/activiti/standalone/validation/invalid_process_xsd_error.bpmn20.xml")
				.deploy();
			Assert.fail();
		} catch (XMLException e) {
			// expected exception
		}
		
		// Should fail with validation errors
		try {
			repositoryService.createDeployment()
				.addClasspathResource("org/activiti/standalone/validation/invalid_process_xsd_error.bpmn20.xml")
				.disableSchemaValidation()
				.deploy();
			Assert.fail();
		} catch (XMLException e) {
		  // expected exception
		}
		
	}

}
<commit_msg>Catch ActivitiException instead of XMLException<commit_after>/* 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.activiti.standalone.validation;

import org.activiti.bpmn.exceptions.XMLException;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration;
import org.activiti.engine.repository.Deployment;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * @author <NAME>
 */
public class DisabledSchemaValidationTest {
	
	protected ProcessEngine processEngine;
	
	protected RepositoryService repositoryService;
	
	@Before
	public void setup() {
		this.processEngine = new StandaloneInMemProcessEngineConfiguration()
			.setJdbcUrl("jdbc:h2:mem:activiti-process-validation;DB_CLOSE_DELAY=1000")
			.buildProcessEngine();
		this.repositoryService = processEngine.getRepositoryService();
	}
	
	@After
	public void tearDown() {
		for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
			repositoryService.deleteDeployment(deployment.getId());
		}
		
		ProcessEngines.unregister(processEngine);
		processEngine = null;
		repositoryService = null;
	}
	
	@Test
	public void testDisableValidation() {
		
		// Should fail
		try {
			repositoryService.createDeployment()
				.addClasspathResource("org/activiti/standalone/validation/invalid_process_xsd_error.bpmn20.xml")
				.deploy();
			Assert.fail();
		} catch (XMLException e) {
			// expected exception
		}
		
		// Should fail with validation errors
		try {
			repositoryService.createDeployment()
				.addClasspathResource("org/activiti/standalone/validation/invalid_process_xsd_error.bpmn20.xml")
				.disableSchemaValidation()
				.deploy();
			Assert.fail();
		} catch (ActivitiException e) {
		  // expected exception
		}
		
	}

}

{'fraction_non_alphanumeric': 0.09592129534740726, 'fraction_numerical': 0.005328960852633737, 'mean_word_length': 4.5580865603644645, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2149976', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1344, 'n_words': 344}