Sample Test - XML Configuration
Back to Code By Example
Description
This is how most developers are likely to use Architecture Rules. In this example, all of the Rules and Source Directories are described in XML in architecture-rules.xml. The test is run, and Architecture Rules loads the entire configuration from the XML file. No programmatic configuration is provided. However, if you needed to add programmatic configuration, you can call getConfiguration() and add, remove, and modify Rules or SourceDirectories.
Code
/**
* Copyright 2007 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
*
* For more information visit
* http://72miles.com and
* http://architecturerules.googlecode.com/svn/docs/index.html
*/
package com.seventytwomiles.architecturerules;
/**
* <p>Architecture test example.</p>
*
* @author mikenereson
* @see AbstractArchitectureRulesConfigurationTest
*/
public class SimpleArchitectureTest
extends AbstractArchitectureRulesConfigurationTest {
/**
* @see AbstractArchitectureRulesConfigurationTest
*/
public String getConfigurationFileName() {
/**
* Provide the name of the rules configuration file. File file is
* loaded from the classpath.
*/
return "architecture-rules.xml";
}
/**
* @see AbstractArchitectureRulesConfigurationTest#testArchitecture()
*/
public void testArchitecture() {
/**
* Run the test via doTest(). If any rules are broken, or if
* the configuration can not be loaded properly, then the appropriate
* Exception will be thrown.
*/
assertTrue(doTests());
}
}
Posted by Greatest Barriers to Open-Source Adoption | 72 Miles
June 15, 2008 @ 12:18 pm
[...] have landed us dozens of new users. We also use a blog platform to document our project and provide code examples. These are simple things that we have done to promote our project and to increase [...]