Recent Notes
Displaying keyword search results 1 - 10
Created by Fang on January 04, 2013 14:35:14
Last update: January 04, 2013 14:35:41
You can use the runOrder parameter to control the test execution order for Maven surefire tests:
<build>
<plugins>
<plugin>
...
Other options are:
Option Meaning
alphabetical Alphabetical
reversealphabetical Reverse Alphabetical
random Randomized
hourly alphabetical on even hours, reverse alphabetical on odd hours
failedfirst Failed first will run tests that failed on previous run first, as well as new tests for this run.
balanced Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests to make all tests complete at the same time, reducing the overall execution time.
filesystem This is the default. I guess this is the order returned by the file system: uncontrolled but deterministic.
Created by voodoo on September 25, 2012 19:10:19
Last update: September 25, 2012 19:10:19
Here is a list of the most useful targets that the GNU Coding Standards specify (from automake manual ). make all Build programs, libraries, documentation, etc. (same as make). make install Install what needs to be installed, copying the files from the package's tree to system-wide directories. make install-strip Same as make install, then strip debugging symbols. Some users like to trade space for useful bug reports... make uninstall The opposite of make install: erase the installed files. (This needs to be run from the same build tree that was installed.) make clean Erase from the build tree the files built by make all. make distclean Additionally erase anything ./configure created. make check Run the test suite, if any. make installcheck Check the installed programs...
Created by Fang on March 05, 2012 20:32:37
Last update: March 05, 2012 20:32:37
In this simple example, I create a simple validating bean and create a JUnit test to test the validation.
The bean ( src/main/java/com/example/Person.java ):
package com.example;
import javax.validatio...
The test ( src/test/java/com/example/TestPerson.java ):
package com.example;
import java.util.Set;
...
Run the test:
mvn clean test
You'll notice that one test passed and the other failed.
The tests require that a person must have a name and the name cannot be empty, so @NotNull is not the right rule to use here. To make sure that the name is not empty, we need to use @Pattern . But since a null String matches any pattern, @NotNull is also needed:
package com.example;
import javax.validatio...
Created by James on January 10, 2011 15:20:10
Last update: February 03, 2012 10:10:14
Dojo ShrinkSafe: http://shrinksafe.dojotoolkit.org/ : command line utility written in Java, based on Rhino - JavaScript engine written in Java.
Douglas Crockford's JSMIN: http://crockford.com/javascript/jsmin : command line utility written in C, can download MS-DOS exe.
Dean Edwards' Packer: http://dean.edwards.name/packer/ : online tool, or .NET, Perl, PHP application.
YUI Compressor: http://developer.yahoo.com/yui/compressor/ : command line utility written in Java.
Google Closure Compiler : command line Java application, web application, or RESTful API.
One problem is, the compressor utility may not be 100% reliable. So make sure to test the compressed script.
Created by Fang on November 21, 2011 15:57:49
Last update: November 22, 2011 09:51:26
The improved custom taglib works with existing facelet ui taglibs. For example:
<ui:param name="theName" value="John"/> <my:hel... produces the expected output. However, a problem exists with the ui:repeat tag: <h3>With ui:repeat</h3> <ui:repeat var="theName... When tested with a URL like: http://localhost:8080/facelet-demo/?name=Zack&name... the raw EL prints out the correct names, but my custom tag substitutes empty string for theName2 ! In theory, the response is rendered in the Render Response phase, way after the Apply Request Values phase, actual values should be available to EL. The answer to this anomaly turned out to be very deep ! Yes, right there in the code! I would consider this a bug in facelets implementation, but the JSF spec did not tell what the expected behavior should be. In my custom...
Created by Fang on November 21, 2011 13:49:11
Last update: November 21, 2011 13:49:11
In the test for the simple taglib example , I used a literal string for the name attribute:
<my:hello name="Jack"/> What happens if the name attribute contains EL expresson? For example: <my:hello name="#{param['name']}"/> If EL works, the tag should take the value of the " name " request parameter and print it out. But the tag as implemented in the simple taglib example prints the literal string: Hello #{param['name']}! I am FaceletTag. In order to make a tag to recognize EL, we have to use TagAttribute.getValue(FaceletContext ctx) instead of TagAttribute.getValue() . The latter returns the literal value of the attribute. The HelloTagHandler should be changed to: package com.example; import java.io.IOExcep... Rebuild the taglib and test with a URL like this: http://localhost:8080/facelet-test/?name=Jack The tag will print:...
Created by freyo on September 09, 2011 11:43:36
Last update: September 09, 2011 11:45:45
When you run automated Android tests with Eclipse or from the command line, you get text output, which isn't good for reporting purposes. If you run a large set of test cases with automated build, the text report isn't very helpful. Fortunately, Android CTS generates test reports in XML with accompanying XSL to make it look nice in a browser. To run your own tests with Android CTS: Download Android CTS Make a new directory MyRepository under android-cts , alongside the existing repository directory. Copy host_config.xml from repository to MyRepository Create directory plans under MyRepository , add a test plan ( MyTests.xml ):
<?xml version="1.0" encoding="UTF-8"?> <TestPla... Create directory testcases under MyRepository . Copy TestDeviceSetup.apk from repository/testcases to MyRepository/testcases Under MyRepository/testcases , create a test...
Created by freyo on August 25, 2011 09:07:40
Last update: August 25, 2011 20:45:43
This is a list of built-in Android permission values: Permission Description Since API Level android.permission.ACCESS_CHECKIN_PROPERTIES Allows read/write access to the "properties" table in the checkin database, to change values that get uploaded. 1 android.permission.ACCESS_COARSE_LOCATION Allows an application to access coarse (e.g., Cell-ID, WiFi) location 1 android.permission.ACCESS_FINE_LOCATION Allows an application to access fine (e.g., GPS) location 1 android.permission.ACCESS_LOCATION_EXTRA_COMMANDS Allows an application to access extra location provider commands 1 android.permission.ACCESS_MOCK_LOCATION Allows an application to create mock location providers for testing 1 android.permission.ACCESS_NETWORK_STATE Allows applications to access information about networks 1 android.permission.ACCESS_SURFACE_FLINGER Allows an application to use SurfaceFlinger's low level features 1 android.permission.ACCESS_WIFI_STATE Allows applications to access information about Wi-Fi networks 1 android.permission.ACCOUNT_MANAGER Allows applications to call into AccountAuthenticators. Only the system can get this permission. 5 android.permission.AUTHENTICATE_ACCOUNTS...
Created by freyo on June 08, 2011 09:06:49
Last update: June 08, 2011 09:07:49
The built-in Calculator application has a jar file dependency ( Android.mk ):
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VA...
So we can just copy that and:
Change libarity to libmydependency
Change arity-2.1.2.jar to mydependency-10.3.4.jar
Add libmydependency to build/core/user_tags.mk , next to libarity
Created by freyo on May 09, 2011 14:15:01
Last update: May 09, 2011 14:17:22
In short, use the PackageManager class to get the PackageInfo :
PackageInfo pkgInfo = getPackageManager().getP...
To build an APK, make these changes to the greetings app :
Change the layout to ( res/layout/main.xml ):
<?xml version="1.0" encoding="utf-8"?>
<LinearL...
Change the string values ( res/values/strings.xml ):
<?xml version="1.0" encoding="utf-8"?>
<resourc...
Update AndroidManifest.xml :
<?xml version="1.0" encoding="utf-8"?>
<manifes...
Create a new Java class src/com/android/appinfo/GetAppVersion.java :
package com.android.appinfo;
import android...
Edit build.xml , change project name to "AppInfo":
<?xml version="1.0" encoding="UTF-8"?>
<project...
Install to emulator:
ant install
Screenshot: