sonatype/nexus — pull request #718 by cstamas (2013-01-15 09:40:26+00:00)
Title: Request flags

ResourceStoreRequest flags extended with new "asExpired" (see below) and covered with tests. They were used in some tests spread across multiple UTs but I did not found any UT specially concentrating on them (and covering many cases).

Introduced "asExpired" flag. This new flag aligns with existing "asLocal", "asRemote" flags. In contrary to "asRemote" flag, this one makes Nexus process the request as the item in question was expired (even if it is fresh actually), doing the HEAD then GET (if remote is newer). This is different than "remoteOnly" as in this case unconditional GET is _always_ done, content is always fetched, even if it is _same as the local cached one_. This new logic will be used by whitelist implementation to keep WL prefix file "in sync" with remote in much simpler way than expire+refetch (as expire is actually "walker" + retrieve when another retrieve is about to happen).

While experimenting with these, some interesting cases were discovered: in some cases Nexus does not behave as "accumulating proxy" but rather removes local cache content when remote is removed (asRemote case, see UT). Added UT that covers asLocal, asRemote and the newly added asExpired cases for now, to have their functionality covered.

The new UT covers following:

* localOnly flag
* remoteOnly flag
* asExpired flag
* both localOnly and remoteOnly flags combined

Note: SystemPropertiesHelper.java changes went in by mistake (also used by WL). Is unrelated to these changes but will be also used in WL.