My cycles are still not detected

2 views
Skip to first unread message

Axel Böttcher

unread,
Jan 8, 2008, 8:29:12 AM1/8/08
to architecture...@googlegroups.com
I played a bit around with cycle detection but I could not find a single
example with a cycle, where the cycle is also detected by a test. Has
anyone of you got some (minimum) example which could help me detect my
problems?
Thanks
Axel

Xris

unread,
Jan 8, 2008, 10:25:29 AM1/8/08
to architecture-rules-users
Two classes in two different packages with a cycle between them:

=====

package com.bogus.example;

import com.bogus.example2.*;

public class DummyA {

DummyB dummy = null;

public DummyA() {
super();
}

}

=====

package com.bogus.example2;

import com.bogus.example.*;

public class DummyB {

DummyA dummy = null;

public DummyB() {
super();
}

}

=====

On Jan 8, 8:29 am, Axel Böttcher <axel.boettc...@lrz.fh-muenchen.de>
wrote:

axel

unread,
Jan 8, 2008, 11:45:19 AM1/8/08
to architecture-rules-users
Thanks for your reply.
But sorry I intended to send my message as a reply in a different
discussion, where I already posted my prob that cycles are not
detected. What a cycle looks like is pretty clear.
But your post inspired me to think through it again.
So what I found is: cycles are not detected when an xml-configuration-
file is used. By programmatic config they are detected. So this might
be a bug.
> > Thanks fAxel

Mike Nereson

unread,
Jan 8, 2008, 11:54:27 AM1/8/08
to architecture...@googlegroups.com
Yep. Sounds like a bug. Thanks for tracking that down.

Want to look into it?

~ Mike

--
~ Mike Nereson

Axel Böttcher

unread,
Jan 8, 2008, 12:00:30 PM1/8/08
to architecture...@googlegroups.com
I was already thinking I'm crazy

Mike Nereson schrieb:


> Yep. Sounds like a bug. Thanks for tracking that down.
>
> Want to look into it?
>

yeah I'm just trying to checkout the source code

--
Prof. Dr. Axel Böttcher
Fakultät für Informatik und Mathematik
Hochschule für Angewandte Wissenschaften - FH MünchenLothstr. 34, 80335 München
Tel. +49(0)89 1265-3725 Fax: +49(0)89 1265-3780
URL: http://www.cs.fhm.edu/~boettcha/
------------------------------------------------------------------------------

Mike Nereson

unread,
Jan 8, 2008, 12:19:58 PM1/8/08
to architecture...@googlegroups.com
Axel, I am the only developer on the project. If you find the bug and
want to contribute back to the source, let me know and I can add you
as a developer too.

Thanks for your efforts.

~ Mike

--
~ Mike Nereson

Axel Böttcher

unread,
Jan 9, 2008, 2:23:44 PM1/9/08
to architecture...@googlegroups.com
Hi Mike,
think I found the bug together with some minor flaws. I could check them
in if you add me as a developer to the project. But I don't know how
long I would need to get around running the build and deploy process
correctly.
Axel

Well here is what I changed:
in the Ctor of AbstractArchitectureRulesConfigurationTest one transfer
is missing:
if (configurationFileName != null &&
configurationFileName.length() > 0) {
configurationFactory = new
DigesterConfigurationFactory(configurationFileName);


configuration.getRules().addAll(configurationFactory.getRules());

configuration.getSources().addAll(configurationFactory.getSources());

configuration.setDoCyclicDependencyTest(configurationFactory.doCyclicDependencyTest());//NEW
LINE
}

THATS JUST to have a good test for what is going on here:
In class ArchitectureTest there is a method named as a Ctor. Should be a
Ctor.
DELETE configuration.setDoCyclicDependencyTest(false); in that Ctor and
modify:
public void testArchitecture() {
/**
* Finally, 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.
*/
try {
assertTrue(doTests());
fail("Cycles have not been detected");
} catch (final CyclicRedundancyException e) {
e.printStackTrace();

final String message = e.getMessage();


assertTrue(message.indexOf("test.com.seventytwomiles.services") > -1);
assertTrue(message.indexOf("test.com.seventytwomiles.model")
> -1);

assertTrue(message.indexOf("test.com.seventytwomiles.dao.hibernate") > -1);
}


final Configuration configuration = getConfiguration();
configuration.setDoCyclicDependencyTest(false);
assertTrue(doTests());

configuration.getSources().clear();
configuration.getSources().add(new
SourceDirectory("target\\classes", true));

assertTrue(doTests());

configuration.getSources().clear();
configuration.getSources().add(new
SourceDirectory("target\\test-classes", true));

try {
assertTrue(doTests());
} catch (final CyclicRedundancyException e) {
e.printStackTrace();

final String message = e.getMessage();


assertTrue(message.indexOf("test.com.seventytwomiles.services") > -1);
assertTrue(message.indexOf("test.com.seventytwomiles.model")
> -1);

assertTrue(message.indexOf("test.com.seventytwomiles.dao.hibernate") > -1);
}
}

Mike Nereson schrieb:

Mike Nereson

unread,
Jan 9, 2008, 2:35:46 PM1/9/08
to architecture...@googlegroups.com
Axel, I'd really like to have you a project member. I tried to add you
to the project with 'a...@cs.hm.edu' but Google complains that I must
use an address associated with a Google account. Do you have a Google
account?

Thanks for writing the tests too.

I can make the release. I have written up this txt file on how to make
a release. Its not perfect and I find a missing step every time I use
it, but it helps me not forget things.
<http://architecturerules.googlecode.com/svn/trunk/src/main/docs/index.txt>

I need to make the release soon. I fixed this rather important issue a
week or two ago
<http://code.google.com/p/architecturerules/issues/detail?id=24> This
issue prevented the app from working on any hardware that is not a
windows box.

Thanks again. Let me know what address to use.

--
~ Mike Nereson

Mike Nereson

unread,
Jan 9, 2008, 2:45:04 PM1/9/08
to architecture...@googlegroups.com
I found your address. You should have received an email indicating you
were added to the project.

--
~ Mike Nereson

Axel Böttcher

unread,
Jan 10, 2008, 12:34:13 PM1/10/08
to architecture...@googlegroups.com
Hi Mike,
I checked the sources in, but I would prefer you preparing the release.
Would take me too long time to get that done E.g. I use svn via eclipse,
so maiven complaints about no command line version being installed (and
don't know what else follows up).
Axel

Mike Nereson

unread,
Jan 10, 2008, 1:07:50 PM1/10/08
to architecture...@googlegroups.com
Not a problem. I am happy to do it. I am more happy to have someone
contributing ( :
I will make the release this weekend.

Thanks Axel. Did you ever end talking about this in your architecture lecture?

~ Mike


--
~ Mike Nereson

Reply all
Reply to author
Forward
0 new messages