Commit 4e7229d0 authored by Ricco Førgaard's avatar Ricco Førgaard

Added more descriptions to the tests.

parent e8e0b690
......@@ -27,19 +27,30 @@ import com.nesstar.api.cube.Cube;
* ============================
*
* When you already know what to get you go to the Bank.
*
* In the Nesstar API, Banks are objects that you can use to get
* objects (studies, variables, cubes etc) you already know the ID
* of.
*
* Banks are retrieved from the server object. When fetching a Bank
* object you also state what type of objects you want the Bank to
* offer.
*
*/
public class Level03 {
private Server server;
/**
* Connect to the server once and for all. Remember the language.
*/
@Before
public void connectToServer() {
server = null;
}
/**
* Take a Bank object that knows about studies and ask
* it to get the study with the ID "NSD1907".
* Take a Bank object that knows about studies and get the study
* with the ID "NSD1907".
*
* Note the exceptions thrown!
*/
......@@ -51,7 +62,7 @@ public class Level03 {
}
/**
* Now, get the cube with the ID "nedpa2012_C1".
* Now do as above and get the cube with the ID "nedpa2012_C1".
*/
@Test
public void getACube() throws NotAuthorizedException, IOException {
......@@ -61,8 +72,7 @@ public class Level03 {
}
/**
* You can also get users from the bank. Get a list of all users
* on the server.
* You can also get users from the bank. Get a list of all users on the server.
*/
@Test
public void getUser() throws NotAuthorizedException, IOException {
......@@ -72,8 +82,8 @@ public class Level03 {
}
/**
* Make a list of all variables on the server and print
* it to the console (one variable per line).
* Make a list of all variables on the server and print it to the console
* (one variable per line).
*/
@Test
public void printAllVariables() {
......
......@@ -27,16 +27,18 @@ import com.nesstar.api.Study;
* Nesstar API Tutorial Level 4
* ============================
*
* In this tutorial you will lean about retrieving
* DDI metadata from a Study.
* In this tutorial you will lean about retrieving DDI metadata
* from a Study.
*
* Working with metadata in the Nesstar API is mostly
* like working with XML and XPath. All references to
* DDI fields in this tutorial can be related to the
* XML document and thus translated into XPath.
* Working with metadata in the Nesstar API is mostly like working
* with XML and XPath. All references to DDI fields in this tutorial
* can be related to the XML document and thus translated into XPath.
*
* All references to DDI elements are also denoted by
* their index value (e.g. 4.0 for dataDscr).
* All references to DDI elements are also denoted by their index
* value (e.g. 4.0 for dataDscr).
*
* The method getElement takes an XPath expression (a String) as input
* and returns the element(s) that match it.
*
* Remember that Nesstar currently uses DDI version 1.2.2.
*
......@@ -55,7 +57,7 @@ public class Level04 {
}
/**
* Get the title (2.1.1.1)
* Get the title element (2.1.1.1) and get the string value.
*/
@Test
public void findTitle() {
......@@ -65,7 +67,7 @@ public class Level04 {
}
/**
* Get the ID of the data file (3.0)
* Get the ID of the data file (3.0).
*/
@Test
public void getTheFileID() {
......@@ -76,7 +78,8 @@ public class Level04 {
/**
* Find the keywords (2.2.1.1) and make a list of them.
* Make sure to maintain the order.
*
* Make sure to keep them in order.
*/
@Test
public void getKeywords() {
......
......@@ -31,9 +31,17 @@ import com.nesstar.api.analysis.TabulationBuilder;
* Nesstar API Tutorial Level 5
* ============================
*
* This tutorial is about analysis. You will learn about
* how to do tabulations, regression, and correlation in
* the API.
* This tutorial is about analysis. You will learn about how to
* do tabulations, regression, and correlation using the API.
*
* Analysis uses a builder to collect the input. Tabulation uses
* TabulationBuilder to which you can add break variables, measure
* subset, weights etc. Regression and correlation use
* LinearRegressionBuilder and CorrelationBuilder.
*
* The result of a tabulation is returned as a Table. To get the
* values from it you create a TableCoordinate where you add the
* variables and categories you wish to get the value for.
*
*/
public class Level05 {
......@@ -49,8 +57,8 @@ public class Level05 {
}
/**
* Do a tabulation with one break variable and one
* measure just to get the feel of it.
* Do a tabulation with one break variable and one measure just
* to get the feel of it.
*/
@Test
public void runSimpleTabulation() {
......@@ -60,11 +68,10 @@ public class Level05 {
}
/**
* Tabulate the variables gender (id NSD1907_V65) and
* Confidence in the health care system in Norway
* (id NSD1907_V3).
* Then get the number of cases for 'females' with 'no
* confidence at all.'
* Tabulate the variables gender (id NSD1907_V65) and Confidence
* in the health care system in Norway (id NSD1907_V3).
* Then get the number of cases for 'females' with 'no confidence
* at all.'
*/
@Test
public void tabulateTwoVariables() {
......@@ -75,8 +82,9 @@ public class Level05 {
/**
* Do a tabulation using the variable 'Last 12 months: visited or been
* visited by a doctor' (NSD1907_V38) as a break variable and
* 'Age groups' (NSD1907_V68) as the measure.
* visited by a doctor' (NSD1907_V38) as a break variable and 'Age groups'
* (NSD1907_V68) as the measure.
*
* Get the sum for people who have visited a doctor very often.
*/
@Test
......@@ -123,4 +131,6 @@ public class Level05 {
assertEquals(0.0d, significance, 0.0000001d);
}
// Bonus assignment: Do a tabulation (either one of the above or make one yourself)
// and get all cell values from it. Can you also print it as a table?
}
......@@ -30,6 +30,13 @@ import com.nesstar.api.cube.SliceCoordinates;
* ============================
*
* This tutorial is about retrieving data from Cubes.
*
* Cubes are a little like tabulations but not compatible, though.
*
* They have dimensions and measures. To tabulate a cube you create
* a 'slice' using the SliceBuilder to which you add the dimensions
* and measures you need. The resulting slice object uses SliceCoordinates
* to retrieve cells.
*
*/
public class Level06 {
......@@ -45,8 +52,8 @@ public class Level06 {
}
/**
* Create a slice using the Dimension Foo and the
* Measure bar.
* Create a slice using the dimensions Year and Region
* and the measure Votes %.
*/
@Test
public void createSimpleSlice() {
......
......@@ -16,8 +16,14 @@ import com.nesstar.api.Study;
* Nesstar API Tutorial Level 7
* ============================
*
* In this tutorial you will learn about publishing
* data and metadata to a Nesstar server.
* In this tutorial you will learn about publishing data and
* metadata to a Nesstar server.
*
* Publishing is really simple. You can publish DDI XML and CSV
* data files and you get the newly published study in return.
*
* You bundle your data files (InputStreams) in something called
* a StudyPublishingBuilder which in turn is sent to the server.
*
*/
public class Level07 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment