Update your eclipse installation with the following tools:
Installation for Find Bugs, PMD, Emma, and Check Style:
See Integrating OSEE and Bugzilla.
Chapter 9.4 of the Java Language Specification states: It is permitted, but discouraged as a matter of style, to redundantly specify the public and/or abstract modifier for a method declared in an interface.
In order to optimize reuse of code, OSEE developers have adopted a set of standards.
Utility classes should:
The following needs to be done:
Most comments offer more clutter than information, especially non-Javadoc
comments which can be removed using the following regular expression \R[ \t]*/\*\s+[\* ]*
(non-Javadoc)[^/]+/
.
([^ ]+) != null && !(\1).equals
("") replace with Strings.isValid($1)
([^ ]+) == null \|\| (\1).equals
("") replace with !Strings.isValid($1)
Jersey and Javadoc supported tags in the code are processed during the maven compile phase to create an enhanced application.wadl file. The enhancements include extra documentation pulled from the source. The following set of tags should be used so a consistant set of documentation is available for all REST interfaces.
The Jersey wadl generator supports additional tags for documenting request and response information.
@Path("/TakeAREST") public class TakeAREST { /** * Find a great RESTing place for your resources * @param place The ideal spot to look for RESTing * @return The best RESTing spot available * @response.representation.200.doc found the spot for you * @response.representation.503.doc RESTing places are currently unavailable. Try again later. */ @GET @Produces({"application/xml", "application/json"}) public String getPlaceToREST(@QueryParam("place") String place) { return "RESTing Place"; } /** * Store a RESTing spot for others to find and use * @param spot Just a good spot for RESTing * @return Acknowledging the location of the RESTing spot * @response.representation.200.doc This is a good spot * @response.representation.404.doc Wasn't able to create the shared RESTing spot * @response.representation.404.mediaType plain/txt */ @PUT @Consumes("plain/txt") @Produces("application/xml") public RestReturn createRESTingSpot(@PathParam("spot") String spot) { RestReturn myRet = new RestReturn(); myRet.setName("A Great Name"); myRet.setUuid("UniqueID"); return myRet; }
OSEE uses JUnit 4 for its test suites. Some links to get started:
Requirements of the OSEE test suite:
The OSEE test suite uses the org.eclipse.osee.ats.config.demo
plugin to initialize a demo database, populate it with demo data and run the majority of the OSEE tests against this common data set.
These tests are contributed to the MasterTestSuite groups using Eclipse's extension point framework. Any Test Suite can implement IOseeTest and extend the OseeTest extension point to be contributed to the appropriate test suite(s).
The plugin org.eclipse.osee.support.test.util is in support of our testing framework. It has a number of common enums and a TestUtil class that should be used by any junit tests. The intent is to keep this plugin lightweight and without many dependencies cause all the testing fragments "should" include it. In addition, it should not be included by any production plugins, only test fragments.
All OSEE JUnit tests should live in a fragment of the plugin to be tested.
assertTrue("Should be run on production datbase.", TestUtil.isProductionDb()); assertTrue("Should be run on test datbase.", TestUtil.isTestDb()); assertTrue("Should be run on demo datbase.", TestUtil.isDemoDb());
assertTrue("Demo Application Server must be running.", ClientSessionManager.getAuthenticationProtocols().contains("demo")); assertTrue("Client must authenticate using demo protocol", ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo")); assertFalse("Application Server must be running.", ClientSessionManager.getAuthenticationProtocols().contains("demo")); assertFalse("Client can't authenticate using demo protocol", ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo")); }
The launch configuration does not have all plugins necessary to run.
This plugin is meant to be extremely light-weight and only provide simple statics and methods to all the test plugins. Because it has to be included in all test fragments from jdk.core all the way up to framework.ui (skynet.ui), it can not depend on any of the higher level plugins or cycles will occur. Remove these dependencies and cycles will be fixed.
Define a timeout period in miliseconds with “timeout” parameter. The test fails when the timeout period exceeds. view
@Test(timeout = 1000) public void infinity() { while (true); }
Exception Handling Use “expected” paramater with @Test annotation for test cases that expect exception. Write the class name of the exception that will be thrown. view plainprint?
@Test(expected = ArithmeticException.class) public void divisionWithException() { // divide by zero simpleMath.divide(1, 0); }
/* COMPANY DISTRIBUTION STATEMENT */ package com.company.component.testcase; import ... import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; /** * @link {link_to_class_under_test} * @author {you} */ public final class MySuperbTest { private static SevereLoggingMonitor monitorLog = null; private static Artifact myRootArtifact = null; @Test public void importSimpleArtifacts() throws Exception { Assert.assertTrue("Some message...", conditionToBeTrue); } @Before public void setUp() throws Exception { /* some pre init stuff before each case */ } @After public void tearDown() throws Exception { /* useful to destroy any artifacts after your test */ new PurgeArtifacts(myRootArtifact.getChildren()).execute(); /* example how you would wrap one element to pass in */ new PurgeArtifacts(Collections.singletonList(myRootArtifact)).execute(); } @BeforeClass public static void setUpOnce() throws Exception { monitorLog = TestUtil.severeLoggingStart(); } @AfterClass public static void tearDownOnce() throws Exception { TestUtil.severeLoggingEnd(monitorLog); /* any other final cleanup */ } }
Install Eclipse as your Development Environment
From the Creator of Java: Trails Covering the Basics
Excellent Sources
Two alternative learning sources:
find {filename} -type f -exec chown {new_owner} {} \; -exec chmod 664 {} \; du -hs * tail -f /var/tmp/my.log netstat -an vi find and replace: s/pattern1/pattern2/g find . -exec grep -l pattern {} \; finger -wpsf {user}
GRANT DELETE ON "OSEE"."{table_name}" TO "OSEE_CLIENT"; GRANT INSERT ON "OSEE"."{table_name}" TO "OSEE_CLIENT"; GRANT SELECT ON "OSEE"."{table_name}" TO "OSEE_CLIENT"; GRANT SELECT ON "OSEE"."{table_name}" TO PUBLIC; GRANT UPDATE ON "OSEE"."{table_name}" TO "OSEE_CLIENT"; create public synonym {synonym_name} for {table_name} ;
-- create a trigger that runs each time rows are deleted from osee_server_lookup create or replace trigger osee_server_lookup_brd before delete on osee_server_lookup for each row begin insert into find_user( user_name, chg_date) values (user, sysdate ); end; -- create a synonym in the osee_client scheme to the table osee_enum_type_def owned by scheme osee and then give osee_client privileges to actually use it CREATE OR REPLACE SYNONYM osee_client.osee_enum_type_def FOR osee.osee_enum_type_def; grant select, update, insert on osee_enum_type_def to osee_client; -- an update statement that involves another table UPDATE osee_attribute_type aty SET enum_type_id = (select et.enum_type_id from osee_enum_type et where aty.name = et.enum_type_name) where validity_xml is not null; -- retrieve duplicate HRIDS, its GUID and Artifact Type name: SELECT t1.guid, t1.human_readable_id, t3.name FROM osee_artifact t1, osee_artifact_type t3 WHERE t1.human_readable_id IN (SELECT t2.human_readable_id FROM osee_artifact t2 GROUP BY t2.human_readable_id HAVING COUNT(t2.human_readable_id) > 1) AND t3.art_type_id = t1.art_type_id ORDER BY t1.human_readable_id; -- retrieve the number of attributes with the specified value: -- (Note: COUNT function returns the number of rows in a query, COUNT(1) is for better performance; -- In the below example, the COUNT function does not need to retrieve all fields from the osee attribute table -- as it would if you used the COUNT(*) syntax. It will merely retrieve the numeric value of 1 for each record -- that meets your criteria) SELECT count(1) from osee_attribute where value like ?, where ? == '%{value}%' -- retrieve the number of commit comments with the specified value: SELECT count(1) from osee_tx_details where osee_comment like ?, where ? == '%value>%' -- retrieve the number of branch names with the specified value: SELECT count(1) from osee_branch where branch_name like ?, where ? == '%value>%' -- retrieve all data from the specified tables on a specific artifact SELECT * FROM osee_artifact_version arv, osee_txs txs, osee_tx_details txd WHERE art_id = {value} AND arv.gamma_id = txs.gamma_id AND txs.transaction_id = txd.transaction_id -- retrieve all data from the osee artifact table for the specified artifact SELECT * from osee_artifact where art_id={value} -- list execution plans select distinct 'explain plan set statement_id = ' || sql_id || ' for ' || sql_text || ';' as ex from v$sql where lower(sql_text) like 'select%osee_relation_link%' and sql_text not like '%DS_SVC%' and sql_text not like '%SYS.DUAL%' and parsing_schema_name = 'OSEE_CLIENT' order by ex; select * from plan_table;
:* on Hudson goto the following job
:** https://hudson.eclipse.org/osee/job/osee_nr/105/parameters/
:** Enable the job
:** Goto Configure and update the 'version' parameter (e.g. 0.25.1 or 0.26.0, etc)
:** Save the configuration change
:** Execute the job
:** Do the same for the posting job https://hudson.eclipse.org/osee/job/osee_promote_latest_to_download_site/
:* use the Git repository https://git.eclipse.org/r/www.eclipse.org/osee.git
:* update release version in sharedEnv.php
Note: Replace all references to /c/x/git/x with your git reop's parent folder
git pull --rebase git push origin head:master
To see the work layout before you using Git version 2.19.0 or newer - git range-diff origin/{previous_stable_version} origin/dev dev ensure any Eclipse workspace associated with the repository is closed cd /c/x/git/x/org.eclipse.osee; git fetch; git checkout dev git reset --hard origin/dev remove any untracked files git rebase -i --onto origin/master {one commit prior to first commit on dev} mark for edit the first commit "refactor: Update build numbers to 0.x.0
git reset --hard Edit update_versions.sh to update versions - vi /c/x/git/x/org.eclipse.osee/plugins/org.eclipse.osee.support.dev/update_versions.sh Run update_versions.sh from repository root - /c/x/git/x/org.eclipse.osee/plugins/org.eclipse.osee.support.dev/update_versions.sh
git rebase --edit-todo Select specific commits to edit (aligning with other repositories as needed) confirm no compile errors at each selected commit and every few commits run integration tests when a compile error or test failure is detected, determine root cause commit and create new FIXUP commit git status to check for uncommitted files (one possible cause is a deleted bundle) use Import Projects... from Git perspective in Eclipse to import newly added bundles
note current hash of head use git rebase -i for second pass of rebase move each FIXUP commit to just after the commit it corrects and combine with fixup command git diff {previously_noted_hash} head to ensure no unintentional changes
Launch OSEE dev_alpha install with workspace E:\\workspace_nr refresh, rebuild, restart
git push origin head:user/rebase -f build on topic branch <https://hudson.eclipse.org/osee/job/osee_topic_2> Wipe Out Workspace first to avoid odd issues building
:* check "Create a java project"
:* "an osgi Framework": Equinox
:* no activator
:* Bundle Id: {my.plugin}
:* Bundle-Version: 10.5.1.1_qualifier
:* Name: %bundleName
:* Provider: %bundleProvider
:* Bundle Id: {my.plugin}.source
:* Eclipse-SourceBundle: {my.plugin}
:* update bundleName
:* copy licensing text files here
:* select project in workspace -> context menu -> Refresh
:* check {my.plugin}/about.html under both your Binary Build and Source Build
:* check {my.plugin}/about_files under both your Binary Build and Source Build
:* check {my.plugin}/plugin.properties
:* check {my.plugin}/{class folder}
:* Source Tab -> remove all source folders
:* Libraries -> Add class Folder ... -> select root project
::* expand newly added class folder and select source attachment -> Edit... -> Workspace... -> /{my.plugin}/source-bundle
:* Order and Export -> ensure libraries and class folders are marked exported
:* add a space and then the 3 part version number to the project name
:* ensure exists: output.. = . and remove source.. = .
:* add line: Bundle-Localization: plugin
:* add to bin.includes the root directory of the source (i.e. org, com, etc.)
:* Note: the source bundle's build.properties entries must be relative to {my.plugin}/source-bundle/ (rather than just {my.plugin}/)
:* Use specified module name -> org.eclipse.orbit/{my.plugin}
:* uncheck Launch the Commit wizard
:* "v{version number}" where {version number} original libraries version with '.' s replaced with '_' . (i.e. version is 2.3 would go in the v2_3 branch)
:* check "Work with this branch"
:* add plugin
:* set download-size and install-size
:* plugin@org.apache.derby.net,10.5.1=CVS,tag=v200910011000,cvsRoot=:pserver:anonymous@dev.eclipse.org:/cvsroot/tools,path=org.eclipse.orbit/org.apache.derby.net
:* plugin@org.apache.derby.net.source,10.5.1=CVS,tag=v200910011000,cvsRoot=:pserver:anonymous@dev.eclipse.org:/cvsroot/tools,path=org.eclipse.orbit/org.apache.derby.net/source-bundle
:* if you edited /org.eclipse.orbit.build.feature.set1/feature.xml, then update the map file's tag also (so the updated version will be used)
Win + E > File > Change folder and search options > View > Advanced Settings: Show hidden files, folders, and drives !Hide extensions for known file types Win > Taskbar settings > Taskbar -> Use small taskbar buttons Win > Power & sleep settings > Sleep On battery power, PC goes to sleep after > 1 hour When plugged in, PC goes to sleep after > Never Win > Edit Power Plan > Change Advanced power settings > Sleep > Hibernate after > On battery > Never Control Panel View by: Small icons Power Options Choose what closing the lid does > When I close the lid: > Do Nothing Win > Control Panel > System and Security > System > Advanced system settings > Advanced -> Performance -> Settings -> Advanced -> Virtual Memory -> Change -> No Page File -> Set Win > Defragment and Optimize Drives > Optimize > Change settings > !Run on a schedule Win > Remote Desktop settings > Enable Remote Desktop