Architecture Rules

Download 2.1.1

About

Assert Your Architecture! with this open source java library. Architecture Rules leverages an xml configuration file and optional programmatic configuration to assert your code's architecture via unit tests or ant tasks. This test is able to assert that specific packages do not depend on others and is able to check for and report on cyclic dependencies among your project's packages and classes. This project wraps a industry accepted JDepend to simplify the process of maintaining a solid software architecture.

License

Licensed under Apache License 2.0 - allows use of the source code for the development of free and open source software as well as proprietary and closed source software.

Do you Assert your Architecture? Please help out with our fund raising.
Checkout what we are raising funds for. Be sure to report issues.

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());
    }
}

1 Comment »

  1. 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 [...]

RSS feed for comments on this post · TrackBack URI

Leave a Comment

Back to Code By Example

Start Here

Get Help

More Information

Architecture Propaganda

Schwag

If you assert your architecture, then let everyone know with this branded gear. architecture rules mug