target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test public void getLayoutId() throws Exception { }
|
@Override protected int getLayoutId() { return R.layout.fragment_hot; }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected int getLayoutId() { return R.layout.fragment_hot; } }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected int getLayoutId() { return R.layout.fragment_hot; } }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected int getLayoutId() { return R.layout.fragment_hot; } static HotFragment getInstance(); @Override void onBindPage(); @OnClick({R.id.tv_city, R.id.dcl_search}) void onViewClicked(View view); @Override void onActivityResult(int requestCode, int resultCode, Intent data); }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected int getLayoutId() { return R.layout.fragment_hot; } static HotFragment getInstance(); @Override void onBindPage(); @OnClick({R.id.tv_city, R.id.dcl_search}) void onViewClicked(View view); @Override void onActivityResult(int requestCode, int resultCode, Intent data); static final String TAG; @BindView(R.id.ll_search)
public LinearLayout llSearch; @BindView(R.id.ll_search_main)
public LinearLayout llSearchMain; @BindView(R.id.fl_search)
public FrameLayout flSearch; @BindView(R.id.tv_city)
public TextView tvCity; }
|
@Test public void initView() throws Exception { }
|
@Override protected void initView() { mainActivity = (MainActivity) getActivity(); mPresent = new HotPresenterImp(this, getChildFragmentManager()); mHotTl.setTabMode(TabLayout.MODE_FIXED); mPresent.initPage(mHotVp); }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected void initView() { mainActivity = (MainActivity) getActivity(); mPresent = new HotPresenterImp(this, getChildFragmentManager()); mHotTl.setTabMode(TabLayout.MODE_FIXED); mPresent.initPage(mHotVp); } }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected void initView() { mainActivity = (MainActivity) getActivity(); mPresent = new HotPresenterImp(this, getChildFragmentManager()); mHotTl.setTabMode(TabLayout.MODE_FIXED); mPresent.initPage(mHotVp); } }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected void initView() { mainActivity = (MainActivity) getActivity(); mPresent = new HotPresenterImp(this, getChildFragmentManager()); mHotTl.setTabMode(TabLayout.MODE_FIXED); mPresent.initPage(mHotVp); } static HotFragment getInstance(); @Override void onBindPage(); @OnClick({R.id.tv_city, R.id.dcl_search}) void onViewClicked(View view); @Override void onActivityResult(int requestCode, int resultCode, Intent data); }
|
HotFragment extends BaseFragment<HotPresenterImp> implements HotView { @Override protected void initView() { mainActivity = (MainActivity) getActivity(); mPresent = new HotPresenterImp(this, getChildFragmentManager()); mHotTl.setTabMode(TabLayout.MODE_FIXED); mPresent.initPage(mHotVp); } static HotFragment getInstance(); @Override void onBindPage(); @OnClick({R.id.tv_city, R.id.dcl_search}) void onViewClicked(View view); @Override void onActivityResult(int requestCode, int resultCode, Intent data); static final String TAG; @BindView(R.id.ll_search)
public LinearLayout llSearch; @BindView(R.id.ll_search_main)
public LinearLayout llSearchMain; @BindView(R.id.fl_search)
public FrameLayout flSearch; @BindView(R.id.tv_city)
public TextView tvCity; }
|
@Test public void union() { StringBuilder result = SqlStringUtils.<String>union(list(), (x, b) -> b.append("hi " + x), true); assertThat(result.toString(), is("")); result = SqlStringUtils.union(list("a"), (x, b) -> b.append("hi " + x), true); assertThat(result.toString(), is("( hi a )")); result = SqlStringUtils.union(list("a", "b", "c"), (x, b) -> b.append("hi " + x), false); assertThat(result.toString(), is("( hi a ) UNION ( hi b ) UNION ( hi c )")); result = SqlStringUtils.union(list("x", "y"), (x, b) -> b.append("hi " + x), true); assertThat(result.toString(), is("( hi x ) UNION ALL ( hi y )")); }
|
public static <A> void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll) { String joinClause = unionAll ? " UNION ALL " : " UNION "; for (A x : xs) { b.append("( "); singleSql.f(x, b); b.append(" )"); b.append(joinClause); } int replaceIdx = b.length() - joinClause.length(); if (replaceIdx < 1) { return; } b.replace(replaceIdx, b.length(), ""); }
|
SqlStringUtils { public static <A> void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll) { String joinClause = unionAll ? " UNION ALL " : " UNION "; for (A x : xs) { b.append("( "); singleSql.f(x, b); b.append(" )"); b.append(joinClause); } int replaceIdx = b.length() - joinClause.length(); if (replaceIdx < 1) { return; } b.replace(replaceIdx, b.length(), ""); } }
|
SqlStringUtils { public static <A> void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll) { String joinClause = unionAll ? " UNION ALL " : " UNION "; for (A x : xs) { b.append("( "); singleSql.f(x, b); b.append(" )"); b.append(joinClause); } int replaceIdx = b.length() - joinClause.length(); if (replaceIdx < 1) { return; } b.replace(replaceIdx, b.length(), ""); } }
|
SqlStringUtils { public static <A> void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll) { String joinClause = unionAll ? " UNION ALL " : " UNION "; for (A x : xs) { b.append("( "); singleSql.f(x, b); b.append(" )"); b.append(joinClause); } int replaceIdx = b.length() - joinClause.length(); if (replaceIdx < 1) { return; } b.replace(replaceIdx, b.length(), ""); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static <A> void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll) { String joinClause = unionAll ? " UNION ALL " : " UNION "; for (A x : xs) { b.append("( "); singleSql.f(x, b); b.append(" )"); b.append(joinClause); } int replaceIdx = b.length() - joinClause.length(); if (replaceIdx < 1) { return; } b.replace(replaceIdx, b.length(), ""); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void placeholders() { assertThat(SqlStringUtils.placeholders(1), is("?")); assertThat(SqlStringUtils.placeholders(5).replaceAll(" ", ""), is("?,?,?,?,?")); }
|
public static String placeholders(int length) { return placeholdersBuilder(length, new StringBuilder()).toString(); }
|
SqlStringUtils { public static String placeholders(int length) { return placeholdersBuilder(length, new StringBuilder()).toString(); } }
|
SqlStringUtils { public static String placeholders(int length) { return placeholdersBuilder(length, new StringBuilder()).toString(); } }
|
SqlStringUtils { public static String placeholders(int length) { return placeholdersBuilder(length, new StringBuilder()).toString(); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static String placeholders(int length) { return placeholdersBuilder(length, new StringBuilder()).toString(); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void placeholderRows() { assertThat(SqlStringUtils.placeholderRows(3, 2).replaceAll(" ", ""), is("(?,?),(?,?),(?,?)")); }
|
public static String placeholderRows(int numRows, int numColumns) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numRows; i++) { sb.append("("); sb = placeholdersBuilder(numColumns, sb); sb.append("), "); } sb.delete(sb.length() - 2, sb.length()); return sb.toString(); }
|
SqlStringUtils { public static String placeholderRows(int numRows, int numColumns) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numRows; i++) { sb.append("("); sb = placeholdersBuilder(numColumns, sb); sb.append("), "); } sb.delete(sb.length() - 2, sb.length()); return sb.toString(); } }
|
SqlStringUtils { public static String placeholderRows(int numRows, int numColumns) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numRows; i++) { sb.append("("); sb = placeholdersBuilder(numColumns, sb); sb.append("), "); } sb.delete(sb.length() - 2, sb.length()); return sb.toString(); } }
|
SqlStringUtils { public static String placeholderRows(int numRows, int numColumns) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numRows; i++) { sb.append("("); sb = placeholdersBuilder(numColumns, sb); sb.append("), "); } sb.delete(sb.length() - 2, sb.length()); return sb.toString(); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static String placeholderRows(int numRows, int numColumns) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numRows; i++) { sb.append("("); sb = placeholdersBuilder(numColumns, sb); sb.append("), "); } sb.delete(sb.length() - 2, sb.length()); return sb.toString(); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void literal() { assertThat(SqlStringUtils.literal("foo"), is("'foo'")); }
|
public static String literal(String str) { return "'" + str + "'"; }
|
SqlStringUtils { public static String literal(String str) { return "'" + str + "'"; } }
|
SqlStringUtils { public static String literal(String str) { return "'" + str + "'"; } }
|
SqlStringUtils { public static String literal(String str) { return "'" + str + "'"; } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static String literal(String str) { return "'" + str + "'"; } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void setExpressionWithPlaceholders() { assertThat( SqlStringUtils.setExpressionWithPlaceholders(asList("CITY", "ADDRESS")).toString() .replaceAll(" ", ""), is("CITY=?,ADDRESS=?") ); }
|
public static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames) { return expressionWithPlaceholders(colNames, ", "); }
|
SqlStringUtils { public static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames) { return expressionWithPlaceholders(colNames, ", "); } }
|
SqlStringUtils { public static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames) { return expressionWithPlaceholders(colNames, ", "); } }
|
SqlStringUtils { public static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames) { return expressionWithPlaceholders(colNames, ", "); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames) { return expressionWithPlaceholders(colNames, ", "); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void whereExpressionWithPlaceholders() { assertThat( SqlStringUtils.whereExpressionWithPlaceholders(asList("CITY", "ADDRESS"), AND).toString(), is("CITY=? AND ADDRESS=?") ); assertThat( SqlStringUtils.whereExpressionWithPlaceholders(asList("X", "Y", "Z"), OR).toString(), is("X=? OR Y=? OR Z=?") ); }
|
public static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op) { return expressionWithPlaceholders(colNames, format(" {0} ", op.name()) ); }
|
SqlStringUtils { public static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op) { return expressionWithPlaceholders(colNames, format(" {0} ", op.name()) ); } }
|
SqlStringUtils { public static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op) { return expressionWithPlaceholders(colNames, format(" {0} ", op.name()) ); } }
|
SqlStringUtils { public static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op) { return expressionWithPlaceholders(colNames, format(" {0} ", op.name()) ); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op) { return expressionWithPlaceholders(colNames, format(" {0} ", op.name()) ); } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void statementKind() { assertThat( SqlStringUtils.getStatementKind(" SELECT * FROM FOO"), is(SELECT) ); assertThat( SqlStringUtils.getStatementKind("insert into alabalanicafoorbar values ()"), is(INSERT) ); assertThat(SqlStringUtils.getStatementKind("update x set y=? where z=?"), is(UPDATE) ); assertThat(SqlStringUtils.getStatementKind("DELETE from x"), is(DELETE) ); assertThat(SqlStringUtils.getStatementKind("DROP SCHEMA TAXES"), is(UNKNOWN) ); }
|
public static StatementKind getStatementKind(String sql) { String prefix = sql.trim(); prefix = prefix.length() < 10 ? prefix : prefix.substring(0, 10); prefix = prefix.toLowerCase(); if (prefix.startsWith("select")) { return SELECT; } else if (prefix.startsWith("insert")) { return INSERT; } else if (prefix.startsWith("update")) { return UPDATE; } else if (prefix.startsWith("delete")) { return DELETE; } else { return UNKNOWN; } }
|
SqlStringUtils { public static StatementKind getStatementKind(String sql) { String prefix = sql.trim(); prefix = prefix.length() < 10 ? prefix : prefix.substring(0, 10); prefix = prefix.toLowerCase(); if (prefix.startsWith("select")) { return SELECT; } else if (prefix.startsWith("insert")) { return INSERT; } else if (prefix.startsWith("update")) { return UPDATE; } else if (prefix.startsWith("delete")) { return DELETE; } else { return UNKNOWN; } } }
|
SqlStringUtils { public static StatementKind getStatementKind(String sql) { String prefix = sql.trim(); prefix = prefix.length() < 10 ? prefix : prefix.substring(0, 10); prefix = prefix.toLowerCase(); if (prefix.startsWith("select")) { return SELECT; } else if (prefix.startsWith("insert")) { return INSERT; } else if (prefix.startsWith("update")) { return UPDATE; } else if (prefix.startsWith("delete")) { return DELETE; } else { return UNKNOWN; } } }
|
SqlStringUtils { public static StatementKind getStatementKind(String sql) { String prefix = sql.trim(); prefix = prefix.length() < 10 ? prefix : prefix.substring(0, 10); prefix = prefix.toLowerCase(); if (prefix.startsWith("select")) { return SELECT; } else if (prefix.startsWith("insert")) { return INSERT; } else if (prefix.startsWith("update")) { return UPDATE; } else if (prefix.startsWith("delete")) { return DELETE; } else { return UNKNOWN; } } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
SqlStringUtils { public static StatementKind getStatementKind(String sql) { String prefix = sql.trim(); prefix = prefix.length() < 10 ? prefix : prefix.substring(0, 10); prefix = prefix.toLowerCase(); if (prefix.startsWith("select")) { return SELECT; } else if (prefix.startsWith("insert")) { return INSERT; } else if (prefix.startsWith("update")) { return UPDATE; } else if (prefix.startsWith("delete")) { return DELETE; } else { return UNKNOWN; } } static String placeholders(int length); static StringBuilder placeholdersBuilder(int length, StringBuilder sb); static String placeholderRows(int numRows, int numColumns); static String literal(String str); static StringBuilder setExpressionWithPlaceholders(Iterable<String> colNames); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames, LogicalOperator op); static StringBuilder whereExpressionWithPlaceholders(Iterable<String> colNames); static StatementKind getStatementKind(String sql); static void union(StringBuilder b, Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); static StringBuilder union(Iterable<A> xs, Effect2<A, StringBuilder> singleSql, boolean unionAll); }
|
@Test public void readLogFiles() { dispatcher.push(StaticDmrResponse.ok(logFileNodes("server.log", "server.log.2014.-08-01", "server.log.2014.-08-02"))); store.readLogFiles(NoopChannel.INSTANCE); assertNull(store.getActiveLogFile()); assertEquals(3, store.getLogFiles().size()); }
|
@Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void append() { AddressTemplate at = AddressTemplate.of("a=b"); at = at.append("c=d"); assertEquals("a=b/c=d", at.getTemplate()); at = AddressTemplate.of("a=b"); at = at.append("/c=d"); assertEquals("a=b/c=d", at.getTemplate()); }
|
public AddressTemplate append(String template) { String slashTemplate = template.startsWith("/") ? template : "/" + template; return AddressTemplate.of(this.template + slashTemplate); }
|
AddressTemplate { public AddressTemplate append(String template) { String slashTemplate = template.startsWith("/") ? template : "/" + template; return AddressTemplate.of(this.template + slashTemplate); } }
|
AddressTemplate { public AddressTemplate append(String template) { String slashTemplate = template.startsWith("/") ? template : "/" + template; return AddressTemplate.of(this.template + slashTemplate); } private AddressTemplate(String template); }
|
AddressTemplate { public AddressTemplate append(String template) { String slashTemplate = template.startsWith("/") ? template : "/" + template; return AddressTemplate.of(this.template + slashTemplate); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
AddressTemplate { public AddressTemplate append(String template) { String slashTemplate = template.startsWith("/") ? template : "/" + template; return AddressTemplate.of(this.template + slashTemplate); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
@Test public void subTemplate() { AddressTemplate at = AddressTemplate.of("{a}/b=c/{d}=e/f=g"); assertEquals("", at.subTemplate(0, 0).getTemplate()); assertEquals("", at.subTemplate(2, 2).getTemplate()); assertEquals("b=c", at.subTemplate(1, 2).getTemplate()); assertEquals("{d}=e/f=g", at.subTemplate(2, 4).getTemplate()); assertEquals(at, at.subTemplate(0, 4)); }
|
public AddressTemplate subTemplate(int fromIndex, int toIndex) { LinkedList<Token> subTokens = new LinkedList<>(); subTokens.addAll(this.tokens.subList(fromIndex, toIndex)); return AddressTemplate.of(join(this.optional, subTokens)); }
|
AddressTemplate { public AddressTemplate subTemplate(int fromIndex, int toIndex) { LinkedList<Token> subTokens = new LinkedList<>(); subTokens.addAll(this.tokens.subList(fromIndex, toIndex)); return AddressTemplate.of(join(this.optional, subTokens)); } }
|
AddressTemplate { public AddressTemplate subTemplate(int fromIndex, int toIndex) { LinkedList<Token> subTokens = new LinkedList<>(); subTokens.addAll(this.tokens.subList(fromIndex, toIndex)); return AddressTemplate.of(join(this.optional, subTokens)); } private AddressTemplate(String template); }
|
AddressTemplate { public AddressTemplate subTemplate(int fromIndex, int toIndex) { LinkedList<Token> subTokens = new LinkedList<>(); subTokens.addAll(this.tokens.subList(fromIndex, toIndex)); return AddressTemplate.of(join(this.optional, subTokens)); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
AddressTemplate { public AddressTemplate subTemplate(int fromIndex, int toIndex) { LinkedList<Token> subTokens = new LinkedList<>(); subTokens.addAll(this.tokens.subList(fromIndex, toIndex)); return AddressTemplate.of(join(this.optional, subTokens)); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
@Test public void replaceWildcards() { AddressTemplate at = AddressTemplate.of("a=b"); at = at.replaceWildcards(null); assertEquals("a=b", at.getTemplate()); at = AddressTemplate.of("a=b"); at = at.replaceWildcards(null, null); assertEquals("a=b", at.getTemplate()); at = AddressTemplate.of("a=b"); at = at.replaceWildcards("foo"); assertEquals("a=b", at.getTemplate()); at = AddressTemplate.of("{a}/b={c}"); at = at.replaceWildcards("foo"); assertEquals("{a}/b={c}", at.getTemplate()); at = AddressTemplate.of("a=*/c=*"); at = at.replaceWildcards("b"); assertEquals("a=b/c=*", at.getTemplate()); at = AddressTemplate.of("a=*/c=*"); at = at.replaceWildcards("b", null); assertEquals("a=b/c=*", at.getTemplate()); at = AddressTemplate.of("a=*/c=*"); at = at.replaceWildcards("b", "d"); assertEquals("a=b/c=d", at.getTemplate()); at = AddressTemplate.of("a=*/c=*"); at = at.replaceWildcards("b", "d", "foo"); assertEquals("a=b/c=d", at.getTemplate()); at = AddressTemplate.of("a=*/c={d}"); at = at.replaceWildcards("b", "d", "foo"); assertEquals("a=b/c={d}", at.getTemplate()); }
|
public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); }
|
AddressTemplate { public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); } }
|
AddressTemplate { public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); } private AddressTemplate(String template); }
|
AddressTemplate { public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
AddressTemplate { public AddressTemplate replaceWildcards(String wildcard, String... wildcards) { List<String> allWildcards = new ArrayList<>(); allWildcards.add(wildcard); if (wildcards != null) { allWildcards.addAll(Arrays.asList(wildcards)); } LinkedList<Token> replacedTokens = new LinkedList<>(); Iterator<String> wi = allWildcards.iterator(); for (Token token : tokens) { if (wi.hasNext() && token.hasKey() && "*".equals(token.getValue())) { replacedTokens.add(new Token(token.getKey(), wi.next())); } else { replacedTokens.add(new Token(token.key, token.value)); } } return AddressTemplate.of(join(this.optional, replacedTokens)); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
@Test public void resolve() { AddressTemplate at = AddressTemplate.of("{a}/b={c}"); ResourceAddress resolved = at.resolve(new EchoContext()); assertResolved(new String[][]{{"a", "a"}, {"b", "c"}}, resolved); }
|
public ResourceAddress resolve(StatementContext context, List<String> wildcards) { Resolution<ModelNode> resolution = new Resolution<ModelNode>() { private ModelNode modelNode; @Override public void init() { this.modelNode = new ModelNode(); } @Override public void addKeyValue(String key, String value) { this.modelNode.add(key, value); } @Override public ModelNode getResult() { return modelNode; } }; _resolve(context, wildcards, resolution); return new ResourceAddress(resolution.getResult()); }
|
AddressTemplate { public ResourceAddress resolve(StatementContext context, List<String> wildcards) { Resolution<ModelNode> resolution = new Resolution<ModelNode>() { private ModelNode modelNode; @Override public void init() { this.modelNode = new ModelNode(); } @Override public void addKeyValue(String key, String value) { this.modelNode.add(key, value); } @Override public ModelNode getResult() { return modelNode; } }; _resolve(context, wildcards, resolution); return new ResourceAddress(resolution.getResult()); } }
|
AddressTemplate { public ResourceAddress resolve(StatementContext context, List<String> wildcards) { Resolution<ModelNode> resolution = new Resolution<ModelNode>() { private ModelNode modelNode; @Override public void init() { this.modelNode = new ModelNode(); } @Override public void addKeyValue(String key, String value) { this.modelNode.add(key, value); } @Override public ModelNode getResult() { return modelNode; } }; _resolve(context, wildcards, resolution); return new ResourceAddress(resolution.getResult()); } private AddressTemplate(String template); }
|
AddressTemplate { public ResourceAddress resolve(StatementContext context, List<String> wildcards) { Resolution<ModelNode> resolution = new Resolution<ModelNode>() { private ModelNode modelNode; @Override public void init() { this.modelNode = new ModelNode(); } @Override public void addKeyValue(String key, String value) { this.modelNode.add(key, value); } @Override public ModelNode getResult() { return modelNode; } }; _resolve(context, wildcards, resolution); return new ResourceAddress(resolution.getResult()); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
AddressTemplate { public ResourceAddress resolve(StatementContext context, List<String> wildcards) { Resolution<ModelNode> resolution = new Resolution<ModelNode>() { private ModelNode modelNode; @Override public void init() { this.modelNode = new ModelNode(); } @Override public void addKeyValue(String key, String value) { this.modelNode.add(key, value); } @Override public ModelNode getResult() { return modelNode; } }; _resolve(context, wildcards, resolution); return new ResourceAddress(resolution.getResult()); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
@Test public void testToString() { ModelNode address = new ModelNode(); address.add("subsystem", "test"); address.add("resource", "name"); String s = AddressUtils.toString(address, true); Assert.assertEquals("subsystem=test/resource=name", s); }
|
public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
@Test public void testToStringValueContainsSlash() { ModelNode address = new ModelNode(); address.add("subsystem", "test"); address.add("resource", "java:/global/a"); String s = AddressUtils.toString(address, true); Assert.assertEquals("subsystem=test/resource=java\\:\\/global\\/a", s); }
|
public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
AddressUtils { public static String toString(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
@Test public void testAsKey() { ModelNode address = new ModelNode(); address.add("subsystem", "test"); address.add("resource", "name"); String s = AddressUtils.asKey(address, true); Assert.assertEquals("subsystem=test/resource=name", s); }
|
public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
@Test public void testAsKeyValueContainsSlash() { ModelNode address = new ModelNode(); address.add("subsystem", "test"); address.add("resource", "java:/global/a"); String s = AddressUtils.asKey(address, true); Assert.assertEquals("subsystem=test/resource=java\\:\\/global\\/a", s); }
|
public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
AddressUtils { public static String asKey(ModelNode address, boolean fq) { List<Property> tuples = address.asPropertyList(); StringBuilder sb = new StringBuilder(); int i=0; for (final Property tuple : tuples) { if(i>0) sb.append("/"); sb.append(tuple.getName()); sb.append("="); if(i==tuples.size()-1) if(fq) sb.append(escapeValue(tuple.getValue().asString())); else sb.append("*"); else sb.append(escapeValue(tuple.getValue().asString())); i++; } return sb.toString(); } static ModelNode toFqAddress(ModelNode address, String resourceName); static ModelNode fromFqAddress(ModelNode address); static String getDenominatorType(List<Property> addressTuple); static String toString(ModelNode address, boolean fq); static String asKey(ModelNode address, boolean fq); }
|
@Test public void findMapping() { Container basicAttributes = new Container(NAMESPACE, "basicAttributes", "Basic Attributes"); InteractionUnit root = new Builder() .start(new Container(NAMESPACE, "root", "Root", OrderIndependance)) .mappedBy(new DMRMapping().setAddress("root")) .add(new Select(NAMESPACE, "table", "Table")) .start(new Container(NAMESPACE, "forms", "Forms", Choice)) .add(basicAttributes) .mappedBy(new DMRMapping().setAddress("basicAttributes")) .add(new Container(NAMESPACE, "extendedAttributes", "Basic Attributes")) .end() .end().build(); DMRMapping mapping = (DMRMapping) basicAttributes.findMapping(DMR, new Predicate<DMRMapping>() { @Override public boolean appliesTo(DMRMapping candidate) { return true; } }); assertNotNull(mapping); assertEquals("basicAttributes", mapping.getAddress()); mapping = (DMRMapping) basicAttributes.findMapping(DMR, new Predicate<DMRMapping>() { @Override public boolean appliesTo(final DMRMapping candidate) { return "root".equals(candidate.getAddress()); } }); assertNotNull(mapping); assertEquals("root", mapping.getAddress()); }
|
public <T extends Mapping> T findMapping(MappingType type) { return (T) this.findMapping(type, DEFAULT_PREDICATE); }
|
InteractionUnit implements Consumer, Producer { public <T extends Mapping> T findMapping(MappingType type) { return (T) this.findMapping(type, DEFAULT_PREDICATE); } }
|
InteractionUnit implements Consumer, Producer { public <T extends Mapping> T findMapping(MappingType type) { return (T) this.findMapping(type, DEFAULT_PREDICATE); } protected InteractionUnit(QName id, final String label); protected InteractionUnit(final QName id, final String label, S stereotype); }
|
InteractionUnit implements Consumer, Producer { public <T extends Mapping> T findMapping(MappingType type) { return (T) this.findMapping(type, DEFAULT_PREDICATE); } protected InteractionUnit(QName id, final String label); protected InteractionUnit(final QName id, final String label, S stereotype); S getStereotype(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); void addMapping(Mapping mapping); boolean hasMapping(MappingType type); T getMapping(MappingType type); T findMapping(MappingType type); T findMapping(MappingType type, Predicate<T> predicate); @Override Set<Resource<ResourceType>> getInputs(); @Override boolean doesConsume(Resource<ResourceType> event); void accept(InteractionUnitVisitor visitor); Container getParent(); boolean hasParent(); QName getId(); String getLabel(); void setLabel(final String label); @Override boolean doesConsume(); @Override boolean doesProduce(); boolean doesProduce(Resource<ResourceType> resource); @Override void setOutputs(Resource<ResourceType>... resource); @Override void setInputs(Resource<ResourceType>... resource); Set<Resource<ResourceType>> getOutputs(); Integer getScopeId(); void setScopeId(Integer scopeId); }
|
InteractionUnit implements Consumer, Producer { public <T extends Mapping> T findMapping(MappingType type) { return (T) this.findMapping(type, DEFAULT_PREDICATE); } protected InteractionUnit(QName id, final String label); protected InteractionUnit(final QName id, final String label, S stereotype); S getStereotype(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); void addMapping(Mapping mapping); boolean hasMapping(MappingType type); T getMapping(MappingType type); T findMapping(MappingType type); T findMapping(MappingType type, Predicate<T> predicate); @Override Set<Resource<ResourceType>> getInputs(); @Override boolean doesConsume(Resource<ResourceType> event); void accept(InteractionUnitVisitor visitor); Container getParent(); boolean hasParent(); QName getId(); String getLabel(); void setLabel(final String label); @Override boolean doesConsume(); @Override boolean doesProduce(); boolean doesProduce(Resource<ResourceType> resource); @Override void setOutputs(Resource<ResourceType>... resource); @Override void setInputs(Resource<ResourceType>... resource); Set<Resource<ResourceType>> getOutputs(); Integer getScopeId(); void setScopeId(Integer scopeId); }
|
@Test public void testProcedureEquality() { Procedure proc1 = new TestProcedure(QName.valueOf("foo.bar:proc")) {}; Procedure proc2 = new TestProcedure(QName.valueOf("foo.bar:proc")) {}; Procedure proc3 = new TestProcedure(QName.valueOf("foo.bar:proc"), QName.valueOf("some:origin")) {}; Procedure proc4 = new TestProcedure(QName.valueOf("foo.bar:proc2")) {}; Procedure proc5 = new TestProcedure(QName.valueOf("foo.bar:proc"), QName.valueOf("some:origin")) {}; assertEquals(proc1, proc2); assertFalse(proc2.equals(proc3)); assertFalse(proc1.equals(proc4)); assertEquals(proc3, proc5); }
|
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof InteractionUnit)) { return false; } InteractionUnit that = (InteractionUnit) o; if (!id.equals(that.id)) { return false; } return true; }
|
InteractionUnit implements Consumer, Producer { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof InteractionUnit)) { return false; } InteractionUnit that = (InteractionUnit) o; if (!id.equals(that.id)) { return false; } return true; } }
|
InteractionUnit implements Consumer, Producer { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof InteractionUnit)) { return false; } InteractionUnit that = (InteractionUnit) o; if (!id.equals(that.id)) { return false; } return true; } protected InteractionUnit(QName id, final String label); protected InteractionUnit(final QName id, final String label, S stereotype); }
|
InteractionUnit implements Consumer, Producer { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof InteractionUnit)) { return false; } InteractionUnit that = (InteractionUnit) o; if (!id.equals(that.id)) { return false; } return true; } protected InteractionUnit(QName id, final String label); protected InteractionUnit(final QName id, final String label, S stereotype); S getStereotype(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); void addMapping(Mapping mapping); boolean hasMapping(MappingType type); T getMapping(MappingType type); T findMapping(MappingType type); T findMapping(MappingType type, Predicate<T> predicate); @Override Set<Resource<ResourceType>> getInputs(); @Override boolean doesConsume(Resource<ResourceType> event); void accept(InteractionUnitVisitor visitor); Container getParent(); boolean hasParent(); QName getId(); String getLabel(); void setLabel(final String label); @Override boolean doesConsume(); @Override boolean doesProduce(); boolean doesProduce(Resource<ResourceType> resource); @Override void setOutputs(Resource<ResourceType>... resource); @Override void setInputs(Resource<ResourceType>... resource); Set<Resource<ResourceType>> getOutputs(); Integer getScopeId(); void setScopeId(Integer scopeId); }
|
InteractionUnit implements Consumer, Producer { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof InteractionUnit)) { return false; } InteractionUnit that = (InteractionUnit) o; if (!id.equals(that.id)) { return false; } return true; } protected InteractionUnit(QName id, final String label); protected InteractionUnit(final QName id, final String label, S stereotype); S getStereotype(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); void addMapping(Mapping mapping); boolean hasMapping(MappingType type); T getMapping(MappingType type); T findMapping(MappingType type); T findMapping(MappingType type, Predicate<T> predicate); @Override Set<Resource<ResourceType>> getInputs(); @Override boolean doesConsume(Resource<ResourceType> event); void accept(InteractionUnitVisitor visitor); Container getParent(); boolean hasParent(); QName getId(); String getLabel(); void setLabel(final String label); @Override boolean doesConsume(); @Override boolean doesProduce(); boolean doesProduce(Resource<ResourceType> resource); @Override void setOutputs(Resource<ResourceType>... resource); @Override void setInputs(Resource<ResourceType>... resource); Set<Resource<ResourceType>> getOutputs(); Integer getScopeId(); void setScopeId(Integer scopeId); }
|
@Test public void readLogFilesAndVerifyStale() { LogFile stale = new LogFile("stale.log", Collections.<String>emptyList(), 0); store.states.put(stale.getName(), stale); dispatcher.push(StaticDmrResponse.ok(logFileNodes("server.log"))); store.readLogFiles(NoopChannel.INSTANCE); assertTrue(store.states.get(stale.getName()).isStale()); }
|
@Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = ReadLogFiles.class) public void readLogFiles(final Dispatcher.Channel channel) { final ModelNode op = listLogFilesOp(); dispatcher.execute(new DMRAction(op), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to read list of log files using " + op + ": " + response.getFailureDescription())); } else { logFiles.clear(); activeLogFile = null; List<Property> properties = response.get(RESULT).asPropertyList(); for (Property property : properties) { ModelNode node = property.getValue(); node.get(FILE_NAME).set(property.getName()); logFiles.add(node); } Set<String> names = new HashSet<>(); for (ModelNode logFile : logFiles) { names.add(logFile.get(FILE_NAME).asString()); } for (Map.Entry<String, LogFile> entry : states.entrySet()) { if (!names.contains(entry.getKey())) { entry.getValue().setStale(true); } } channel.ack(); } } }); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void openLogFile() { dispatcher.push(StaticDmrResponse.ok(comp(logFileNodes("server.log"), linesNode(2)))); store.logFiles.add(logFileNode("server.log")); store.openLogFile(new OpenLogFile("server.log"), NoopChannel.INSTANCE); assertFalse(store.pauseFollow); LogFile activeLogFile = store.getActiveLogFile(); assertNotNull(activeLogFile); assertEquals("server.log", activeLogFile.getName()); assertLines(activeLogFile.getContent(), 0, 1); assertFalse(activeLogFile.isHead()); assertTrue(activeLogFile.isTail()); assertEquals(Position.TAIL, activeLogFile.getReadFrom()); assertEquals(0, activeLogFile.getSkipped()); assertTrue(activeLogFile.isFollow()); assertFalse(activeLogFile.isStale()); }
|
@Process(actionType = OpenLogFile.class) public void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { final ModelNode op = readLogFileOp(action.getName()); op.get("tail").set(true); dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to open " + action.getName() + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); LogFile newLogFile = new LogFile(action.getName(), readLines(compResult), readFileSize(action.getName(), compResult)); newLogFile.setFollow(true); states.put(action.getName(), newLogFile); activate(newLogFile); channel.ack(); } } }); } else { activate(logFile); channel.ack(); } }
|
LogStore extends ChangeSupport { @Process(actionType = OpenLogFile.class) public void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { final ModelNode op = readLogFileOp(action.getName()); op.get("tail").set(true); dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to open " + action.getName() + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); LogFile newLogFile = new LogFile(action.getName(), readLines(compResult), readFileSize(action.getName(), compResult)); newLogFile.setFollow(true); states.put(action.getName(), newLogFile); activate(newLogFile); channel.ack(); } } }); } else { activate(logFile); channel.ack(); } } }
|
LogStore extends ChangeSupport { @Process(actionType = OpenLogFile.class) public void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { final ModelNode op = readLogFileOp(action.getName()); op.get("tail").set(true); dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to open " + action.getName() + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); LogFile newLogFile = new LogFile(action.getName(), readLines(compResult), readFileSize(action.getName(), compResult)); newLogFile.setFollow(true); states.put(action.getName(), newLogFile); activate(newLogFile); channel.ack(); } } }); } else { activate(logFile); channel.ack(); } } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = OpenLogFile.class) public void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { final ModelNode op = readLogFileOp(action.getName()); op.get("tail").set(true); dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to open " + action.getName() + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); LogFile newLogFile = new LogFile(action.getName(), readLines(compResult), readFileSize(action.getName(), compResult)); newLogFile.setFollow(true); states.put(action.getName(), newLogFile); activate(newLogFile); channel.ack(); } } }); } else { activate(logFile); channel.ack(); } } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = OpenLogFile.class) public void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { final ModelNode op = readLogFileOp(action.getName()); op.get("tail").set(true); dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to open " + action.getName() + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); LogFile newLogFile = new LogFile(action.getName(), readLines(compResult), readFileSize(action.getName(), compResult)); newLogFile.setFollow(true); states.put(action.getName(), newLogFile); activate(newLogFile); channel.ack(); } } }); } else { activate(logFile); channel.ack(); } } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void selectLogFile() { LogFile logFile = new LogFile("server.log", lines(0), 0); store.states.put(logFile.getName(), logFile); store.activate(logFile); assertFalse(store.pauseFollow); store.selectLogFile(new SelectLogFile("server.log"), NoopChannel.INSTANCE); LogFile activeLogFile = store.getActiveLogFile(); assertSame(logFile, activeLogFile); }
|
@Process(actionType = SelectLogFile.class) public void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { channel.nack(new IllegalStateException("Cannot select unknown log file " + action.getName() + ". " + "Please open the log file first!")); return; } activate(logFile); channel.ack(); }
|
LogStore extends ChangeSupport { @Process(actionType = SelectLogFile.class) public void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { channel.nack(new IllegalStateException("Cannot select unknown log file " + action.getName() + ". " + "Please open the log file first!")); return; } activate(logFile); channel.ack(); } }
|
LogStore extends ChangeSupport { @Process(actionType = SelectLogFile.class) public void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { channel.nack(new IllegalStateException("Cannot select unknown log file " + action.getName() + ". " + "Please open the log file first!")); return; } activate(logFile); channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = SelectLogFile.class) public void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { channel.nack(new IllegalStateException("Cannot select unknown log file " + action.getName() + ". " + "Please open the log file first!")); return; } activate(logFile); channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = SelectLogFile.class) public void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel) { final LogFile logFile = states.get(action.getName()); if (logFile == null) { channel.nack(new IllegalStateException("Cannot select unknown log file " + action.getName() + ". " + "Please open the log file first!")); return; } activate(logFile); channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void closeLogFile() { LogFile foo = new LogFile("foo.log", Collections.<String>emptyList(), 0); LogFile bar = new LogFile("bar.log", Collections.<String>emptyList(), 0); store.states.put(foo.getName(), foo); store.states.put(bar.getName(), bar); store.activate(foo); store.closeLogFile(new CloseLogFile("bar.log"), NoopChannel.INSTANCE); assertFalse(store.pauseFollow); LogFile activeLogFile = store.getActiveLogFile(); assertNotNull(activeLogFile); assertSame(foo, activeLogFile); assertEquals(1, store.states.size()); assertSame(foo, store.states.values().iterator().next()); }
|
@Process(actionType = CloseLogFile.class) public void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel) { LogFile removed = states.remove(action.getName()); if (removed == activeLogFile) { activeLogFile = null; pauseFollow = true; } channel.ack(); }
|
LogStore extends ChangeSupport { @Process(actionType = CloseLogFile.class) public void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel) { LogFile removed = states.remove(action.getName()); if (removed == activeLogFile) { activeLogFile = null; pauseFollow = true; } channel.ack(); } }
|
LogStore extends ChangeSupport { @Process(actionType = CloseLogFile.class) public void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel) { LogFile removed = states.remove(action.getName()); if (removed == activeLogFile) { activeLogFile = null; pauseFollow = true; } channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = CloseLogFile.class) public void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel) { LogFile removed = states.remove(action.getName()); if (removed == activeLogFile) { activeLogFile = null; pauseFollow = true; } channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = CloseLogFile.class) public void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel) { LogFile removed = states.remove(action.getName()); if (removed == activeLogFile) { activeLogFile = null; pauseFollow = true; } channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void changePageSize() { store.changePageSize(new ChangePageSize(42), NoopChannel.INSTANCE); assertEquals(42, store.pageSize); }
|
@Process(actionType = ChangePageSize.class) public void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel) { if (action.getPageSize() == pageSize) { channel.ack(); } else { pageSize = action.getPageSize(); if (activeLogFile != null) { final ModelNode op = readLogFileOp(activeLogFile.getName()); switch (activeLogFile.getPosition()) { case HEAD: op.get("tail").set(false); break; case LINE_NUMBER: op.get("skip").set(activeLogFile.getSkipped()); break; case TAIL: op.get("tail").set(true); break; } dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to change page size to " + pageSize + " for " + activeLogFile + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); int fileSize = readFileSize(activeLogFile.getName(), compResult); List<String> lines = readLines(compResult); activeLogFile.setFileSize(fileSize); activeLogFile.setLines(lines); channel.ack(); } } }); } } }
|
LogStore extends ChangeSupport { @Process(actionType = ChangePageSize.class) public void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel) { if (action.getPageSize() == pageSize) { channel.ack(); } else { pageSize = action.getPageSize(); if (activeLogFile != null) { final ModelNode op = readLogFileOp(activeLogFile.getName()); switch (activeLogFile.getPosition()) { case HEAD: op.get("tail").set(false); break; case LINE_NUMBER: op.get("skip").set(activeLogFile.getSkipped()); break; case TAIL: op.get("tail").set(true); break; } dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to change page size to " + pageSize + " for " + activeLogFile + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); int fileSize = readFileSize(activeLogFile.getName(), compResult); List<String> lines = readLines(compResult); activeLogFile.setFileSize(fileSize); activeLogFile.setLines(lines); channel.ack(); } } }); } } } }
|
LogStore extends ChangeSupport { @Process(actionType = ChangePageSize.class) public void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel) { if (action.getPageSize() == pageSize) { channel.ack(); } else { pageSize = action.getPageSize(); if (activeLogFile != null) { final ModelNode op = readLogFileOp(activeLogFile.getName()); switch (activeLogFile.getPosition()) { case HEAD: op.get("tail").set(false); break; case LINE_NUMBER: op.get("skip").set(activeLogFile.getSkipped()); break; case TAIL: op.get("tail").set(true); break; } dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to change page size to " + pageSize + " for " + activeLogFile + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); int fileSize = readFileSize(activeLogFile.getName(), compResult); List<String> lines = readLines(compResult); activeLogFile.setFileSize(fileSize); activeLogFile.setLines(lines); channel.ack(); } } }); } } } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = ChangePageSize.class) public void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel) { if (action.getPageSize() == pageSize) { channel.ack(); } else { pageSize = action.getPageSize(); if (activeLogFile != null) { final ModelNode op = readLogFileOp(activeLogFile.getName()); switch (activeLogFile.getPosition()) { case HEAD: op.get("tail").set(false); break; case LINE_NUMBER: op.get("skip").set(activeLogFile.getSkipped()); break; case TAIL: op.get("tail").set(true); break; } dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to change page size to " + pageSize + " for " + activeLogFile + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); int fileSize = readFileSize(activeLogFile.getName(), compResult); List<String> lines = readLines(compResult); activeLogFile.setFileSize(fileSize); activeLogFile.setLines(lines); channel.ack(); } } }); } } } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = ChangePageSize.class) public void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel) { if (action.getPageSize() == pageSize) { channel.ack(); } else { pageSize = action.getPageSize(); if (activeLogFile != null) { final ModelNode op = readLogFileOp(activeLogFile.getName()); switch (activeLogFile.getPosition()) { case HEAD: op.get("tail").set(false); break; case LINE_NUMBER: op.get("skip").set(activeLogFile.getSkipped()); break; case TAIL: op.get("tail").set(true); break; } dispatcher.execute(new DMRAction(wrapInComposite(op)), new AsyncCallback<DMRResponse>() { @Override public void onFailure(Throwable caught) { channel.nack(caught); } @Override public void onSuccess(DMRResponse result) { ModelNode response = result.get(); if (response.isFailure()) { channel.nack(new RuntimeException("Failed to change page size to " + pageSize + " for " + activeLogFile + " using " + op + ": " + response.getFailureDescription())); } else { ModelNode compResult = response.get(RESULT); int fileSize = readFileSize(activeLogFile.getName(), compResult); List<String> lines = readLines(compResult); activeLogFile.setFileSize(fileSize); activeLogFile.setLines(lines); channel.ack(); } } }); } } } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void follow() { LogFile logFile = new LogFile("server.log", Collections.<String>emptyList(), 0); store.states.put(logFile.getName(), logFile); store.activate(logFile); store.follow(NoopChannel.INSTANCE); assertFalse(store.pauseFollow); LogFile activeLogFile = store.getActiveLogFile(); assertNotNull(activeLogFile); assertTrue(activeLogFile.isFollow()); }
|
@Process(actionType = FollowLogFile.class) public void follow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to follow: No active log file!")); return; } navigate(new NavigateInLogFile(TAIL), channel); activeLogFile.setFollow(true); startFollowing(activeLogFile); }
|
LogStore extends ChangeSupport { @Process(actionType = FollowLogFile.class) public void follow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to follow: No active log file!")); return; } navigate(new NavigateInLogFile(TAIL), channel); activeLogFile.setFollow(true); startFollowing(activeLogFile); } }
|
LogStore extends ChangeSupport { @Process(actionType = FollowLogFile.class) public void follow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to follow: No active log file!")); return; } navigate(new NavigateInLogFile(TAIL), channel); activeLogFile.setFollow(true); startFollowing(activeLogFile); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = FollowLogFile.class) public void follow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to follow: No active log file!")); return; } navigate(new NavigateInLogFile(TAIL), channel); activeLogFile.setFollow(true); startFollowing(activeLogFile); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = FollowLogFile.class) public void follow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to follow: No active log file!")); return; } navigate(new NavigateInLogFile(TAIL), channel); activeLogFile.setFollow(true); startFollowing(activeLogFile); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void pauseFollow() { LogFile logFile = new LogFile("server.log", Collections.<String>emptyList(), 0); logFile.setFollow(true); store.states.put(logFile.getName(), logFile); store.activate(logFile); store.pauseFollow(NoopChannel.INSTANCE); assertTrue(store.pauseFollow); LogFile activeLogFile = store.getActiveLogFile(); assertNotNull(activeLogFile); assertTrue(activeLogFile.isFollow()); }
|
@Process(actionType = PauseFollowLogFile.class) public void pauseFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to pause follow: No active log file!")); return; } pauseFollow = true; channel.ack(); }
|
LogStore extends ChangeSupport { @Process(actionType = PauseFollowLogFile.class) public void pauseFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to pause follow: No active log file!")); return; } pauseFollow = true; channel.ack(); } }
|
LogStore extends ChangeSupport { @Process(actionType = PauseFollowLogFile.class) public void pauseFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to pause follow: No active log file!")); return; } pauseFollow = true; channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = PauseFollowLogFile.class) public void pauseFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to pause follow: No active log file!")); return; } pauseFollow = true; channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = PauseFollowLogFile.class) public void pauseFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to pause follow: No active log file!")); return; } pauseFollow = true; channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test public void unFollow() { LogFile logFile = new LogFile("server.log", Collections.<String>emptyList(), 0); logFile.setFollow(true); store.states.put(logFile.getName(), logFile); store.activate(logFile); store.unFollow(NoopChannel.INSTANCE); assertFalse(store.pauseFollow); LogFile activeLogFile = store.getActiveLogFile(); assertNotNull(activeLogFile); assertFalse(activeLogFile.isFollow()); }
|
@Process(actionType = UnFollowLogFile.class) public void unFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to unfollow: No active log file!")); return; } activeLogFile.setFollow(false); channel.ack(); }
|
LogStore extends ChangeSupport { @Process(actionType = UnFollowLogFile.class) public void unFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to unfollow: No active log file!")); return; } activeLogFile.setFollow(false); channel.ack(); } }
|
LogStore extends ChangeSupport { @Process(actionType = UnFollowLogFile.class) public void unFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to unfollow: No active log file!")); return; } activeLogFile.setFollow(false); channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); }
|
LogStore extends ChangeSupport { @Process(actionType = UnFollowLogFile.class) public void unFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to unfollow: No active log file!")); return; } activeLogFile.setFollow(false); channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); }
|
LogStore extends ChangeSupport { @Process(actionType = UnFollowLogFile.class) public void unFollow(final Dispatcher.Channel channel) { if (activeLogFile == null) { channel.nack(new IllegalStateException("Unable to unfollow: No active log file!")); return; } activeLogFile.setFollow(false); channel.ack(); } @Inject LogStore(ServerStore serverStore, DispatchAsync dispatcher, Scheduler scheduler, BootstrapContext bootstrap); @Process(actionType = ReadLogFiles.class) void readLogFiles(final Dispatcher.Channel channel); @Process(actionType = ReadLogFilesForRefresh.class) void readLogFilesForRefresh(final Dispatcher.Channel channel); @Process(actionType = OpenLogFile.class) void openLogFile(final OpenLogFile action, final Dispatcher.Channel channel); @Process(actionType = StreamLogFile.class) void streamLogFile(final StreamLogFile action, final Dispatcher.Channel channel); @Process(actionType = RefreshLogFile.class) void refreshLogFile(final RefreshLogFile action, final Dispatcher.Channel channel); @Process(actionType = DownloadLogFile.class) void downloadLogFile(final DownloadLogFile action, final Dispatcher.Channel channel); @Process(actionType = CloseLogFile.class) void closeLogFile(final CloseLogFile action, final Dispatcher.Channel channel); @Process(actionType = SelectLogFile.class) void selectLogFile(final SelectLogFile action, final Dispatcher.Channel channel); @Process(actionType = NavigateInLogFile.class) void navigate(final NavigateInLogFile action, final Dispatcher.Channel channel); @Process(actionType = ChangePageSize.class) void changePageSize(final ChangePageSize action, final Dispatcher.Channel channel); @Process(actionType = FollowLogFile.class) void follow(final Dispatcher.Channel channel); @Process(actionType = PauseFollowLogFile.class) void pauseFollow(final Dispatcher.Channel channel); @Process(actionType = UnFollowLogFile.class) void unFollow(final Dispatcher.Channel channel); List<ModelNode> getLogFiles(); LogFile getActiveLogFile(); boolean isOpen(final String name); PendingStreamingRequest getPendingStreamingRequest(); final static String FILE_NAME; final static String FILE_SIZE; final static String LAST_MODIFIED_TIMESTAMP; }
|
@Test(expected = AssertionError.class) public void nil() { AddressTemplate.of(null); }
|
public static AddressTemplate of(String template) { return new AddressTemplate(template); }
|
AddressTemplate { public static AddressTemplate of(String template) { return new AddressTemplate(template); } }
|
AddressTemplate { public static AddressTemplate of(String template) { return new AddressTemplate(template); } private AddressTemplate(String template); }
|
AddressTemplate { public static AddressTemplate of(String template) { return new AddressTemplate(template); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
AddressTemplate { public static AddressTemplate of(String template) { return new AddressTemplate(template); } private AddressTemplate(String template); static AddressTemplate of(String template); int getNumTokens(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); AddressTemplate append(String template); AddressTemplate subTemplate(int fromIndex, int toIndex); AddressTemplate replaceWildcards(String wildcard, String... wildcards); String getResourceType(); String getTemplate(); boolean isOptional(); ResourceAddress resolve(StatementContext context, List<String> wildcards); ResourceAddress resolve(StatementContext context, String... wildcards); String resolveAsKey(StatementContext context, String... wildcards); }
|
@Test public void testDifferentLoggerSuppliersSameNameExplicit(TestInfo info) { final String loggerName = info.getDisplayName(); final Logger logEventLogger = LoggerFactory.getLogger(loggerName); logEventLogger.debug(e -> String.format("Logger %s for LogEvents", loggerName)); final Logger<SpecializedLogEvent> specializedLogEventLogger = LoggerFactory.getLogger(loggerName, new SpecializedLogEventSupplier()); assertFalse(logEventLogger == specializedLogEventLogger); specializedLogEventLogger.debug(e -> { e.name = "Special"; e.version = 2; return String.format("Logger %s for SpecializedLogEvents", loggerName); }); final Logger originalLogger = LoggerFactory.getLogger(loggerName); assertTrue(logEventLogger == originalLogger); }
|
public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); Logger<T> getLogger(String name, Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); Logger<T> getLogger(String name, Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); }
|
@Test public void testDifferentLoggerSuppliersSameNameImplicit() { final Logger logEventLogger = LoggerFactory.getLogger(); logEventLogger.debug(e -> String.format("Logger %s ", logEventLogger.getName())); final Logger<SpecializedLogEvent> specializedLogEventLogger = LoggerFactory.getLogger(new SpecializedLogEventSupplier()); assertFalse(logEventLogger == specializedLogEventLogger); specializedLogEventLogger.debug(e -> { e.name = "Special"; e.version = 2; return String.format("Logger %s for SpecializedLogEvents", specializedLogEventLogger.getName()); }); final Logger originalLogger = LoggerFactory.getLogger(); assertTrue(logEventLogger == originalLogger); }
|
public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); Logger<T> getLogger(String name, Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); }
|
LoggerRegistry { public <T extends LogEvent> Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder) { final String name = getLoggerName(); return getLogger(name, supplier, builder); } Logger<T> getLogger(Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); Logger<T> getLogger(String name, Supplier<?> supplier, Function<? super LoggerKey, ? extends Logger> builder); }
|
@Test public final void verifyGetAuthorizationTokenDeserialisesBearerToken() { final Key key = Key.generateKey(random); final Token token = Token.generate(random, key, "hello"); final ContainerRequest request = mock(ContainerRequest.class); given(request.getHeaderString("Authorization")).willReturn("Bearer " + token.serialise()); final Token result = utility.getAuthorizationToken(request); assertEquals(token.serialise(), result.serialise()); }
|
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
@Test public final void verifyTestClearsIntermediateSecret() { final byte[] secretBytes = new byte[32]; for (byte i = 32; --i >= 0; secretBytes[i] = i); final ByteBuffer secretByteBuffer = ByteBuffer.wrap(secretBytes); assertTrue(Arrays.equals(secretByteBuffer.array(), secretBytes)); given(secretsManager.getSecretVersion("secretId", "clientRequestToken")).willReturn(secretByteBuffer); rotator.testSecret("secretId", "clientRequestToken"); final byte[] modifiedBytes = secretByteBuffer.array(); assertEquals(32, modifiedBytes.length); for (int i = modifiedBytes.length; --i >= 0; assertEquals(0, modifiedBytes[i])); }
|
protected void testSecret(final String secretId, final String clientRequestToken) { final ByteBuffer buffer = getSecretsManager().getSecretVersion(secretId, clientRequestToken); try { if (buffer.remaining() != fernetKeySize) { throw new IllegalStateException("Fernet key must be exactly " + fernetKeySize + " bytes"); } final byte[] signingKey = new byte[16]; buffer.get(signingKey); final byte[] encryptionKey = new byte[16]; buffer.get(encryptionKey); if (buffer.hasRemaining()) { throw new IllegalStateException("Encountered extra bytes."); } new Key(signingKey, encryptionKey); wipe(signingKey); wipe(encryptionKey); } finally { wipe(buffer); } getLogger().info("testSecret: Successfully validated Fernet Key for ARN {} and version {}.", secretId, clientRequestToken); }
|
SimpleFernetKeyRotator extends AbstractFernetKeyRotator { protected void testSecret(final String secretId, final String clientRequestToken) { final ByteBuffer buffer = getSecretsManager().getSecretVersion(secretId, clientRequestToken); try { if (buffer.remaining() != fernetKeySize) { throw new IllegalStateException("Fernet key must be exactly " + fernetKeySize + " bytes"); } final byte[] signingKey = new byte[16]; buffer.get(signingKey); final byte[] encryptionKey = new byte[16]; buffer.get(encryptionKey); if (buffer.hasRemaining()) { throw new IllegalStateException("Encountered extra bytes."); } new Key(signingKey, encryptionKey); wipe(signingKey); wipe(encryptionKey); } finally { wipe(buffer); } getLogger().info("testSecret: Successfully validated Fernet Key for ARN {} and version {}.", secretId, clientRequestToken); } }
|
SimpleFernetKeyRotator extends AbstractFernetKeyRotator { protected void testSecret(final String secretId, final String clientRequestToken) { final ByteBuffer buffer = getSecretsManager().getSecretVersion(secretId, clientRequestToken); try { if (buffer.remaining() != fernetKeySize) { throw new IllegalStateException("Fernet key must be exactly " + fernetKeySize + " bytes"); } final byte[] signingKey = new byte[16]; buffer.get(signingKey); final byte[] encryptionKey = new byte[16]; buffer.get(encryptionKey); if (buffer.hasRemaining()) { throw new IllegalStateException("Encountered extra bytes."); } new Key(signingKey, encryptionKey); wipe(signingKey); wipe(encryptionKey); } finally { wipe(buffer); } getLogger().info("testSecret: Successfully validated Fernet Key for ARN {} and version {}.", secretId, clientRequestToken); } protected SimpleFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms, final SecureRandom random); protected SimpleFernetKeyRotator(final SecureRandom random); SimpleFernetKeyRotator(); }
|
SimpleFernetKeyRotator extends AbstractFernetKeyRotator { protected void testSecret(final String secretId, final String clientRequestToken) { final ByteBuffer buffer = getSecretsManager().getSecretVersion(secretId, clientRequestToken); try { if (buffer.remaining() != fernetKeySize) { throw new IllegalStateException("Fernet key must be exactly " + fernetKeySize + " bytes"); } final byte[] signingKey = new byte[16]; buffer.get(signingKey); final byte[] encryptionKey = new byte[16]; buffer.get(encryptionKey); if (buffer.hasRemaining()) { throw new IllegalStateException("Encountered extra bytes."); } new Key(signingKey, encryptionKey); wipe(signingKey); wipe(encryptionKey); } finally { wipe(buffer); } getLogger().info("testSecret: Successfully validated Fernet Key for ARN {} and version {}.", secretId, clientRequestToken); } protected SimpleFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms, final SecureRandom random); protected SimpleFernetKeyRotator(final SecureRandom random); SimpleFernetKeyRotator(); }
|
SimpleFernetKeyRotator extends AbstractFernetKeyRotator { protected void testSecret(final String secretId, final String clientRequestToken) { final ByteBuffer buffer = getSecretsManager().getSecretVersion(secretId, clientRequestToken); try { if (buffer.remaining() != fernetKeySize) { throw new IllegalStateException("Fernet key must be exactly " + fernetKeySize + " bytes"); } final byte[] signingKey = new byte[16]; buffer.get(signingKey); final byte[] encryptionKey = new byte[16]; buffer.get(encryptionKey); if (buffer.hasRemaining()) { throw new IllegalStateException("Encountered extra bytes."); } new Key(signingKey, encryptionKey); wipe(signingKey); wipe(encryptionKey); } finally { wipe(buffer); } getLogger().info("testSecret: Successfully validated Fernet Key for ARN {} and version {}.", secretId, clientRequestToken); } protected SimpleFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms, final SecureRandom random); protected SimpleFernetKeyRotator(final SecureRandom random); SimpleFernetKeyRotator(); }
|
@Test public final void verifyFinishSecretDoesNothing() { final Map<String, List<String>> versions = new HashMap<>(); versions.put("version", singletonList("AWSCURRENT")); rotator.finishSecret("secret", "version", versions); verifyNoMoreInteractions(secretsManager); }
|
@SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
@Test public final void verifyFinishSecretFails() { final Map<String, List<String>> versions = new HashMap<>(); versions.put("version", singletonList("AWSPENDING")); assertThrows(RuntimeException.class, () -> rotator.finishSecret("secret", "version", versions)); }
|
@SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
@Test public final void verifyFinishSecretRotatesSecret() { final Map<String, List<String>> versions = new HashMap<>(); versions.put("newVersion", singletonList("AWSPENDING")); versions.put("oldVersion", singletonList("AWSCURRENT")); rotator.finishSecret("secret", "newVersion", versions); verify(secretsManager).rotateSecret("secret", "newVersion", "oldVersion"); }
|
@SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { @SuppressWarnings("PMD.DataflowAnomalyAnalysis") protected void finishSecret(final String secretId, final String clientRequestToken, final Map<String, List<String>> versions) { final Entry<? extends String, ?> currentEntry = versions.entrySet().stream().filter(entry -> { final Collection<? extends String> versionStages = entry.getValue(); return versionStages.contains(CURRENT.getAwsName() ); }).findFirst().orElseThrow(() -> new IllegalStateException("No AWSCURRENT secret set for " + secretId + ".")); final String currentVersion = currentEntry.getKey(); if (currentVersion.equalsIgnoreCase(clientRequestToken)) { getLogger().warn("finishSecret: Version {} already marked as AWSCURRENT for {}", currentVersion, secretId); return; } getSecretsManager().rotateSecret(secretId, clientRequestToken, currentVersion); getLogger().info("finishSecret: Successfully set AWSCURRENT stage to version {} for secret {}.", clientRequestToken, secretId); } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
@Test public final void verifySeedOnlyRunsOnce() { final GenerateRandomResult randomResult = new GenerateRandomResult(); final byte[] bytes = new byte[512]; Arrays.fill(bytes, (byte)17); randomResult.setPlaintext(ByteBuffer.wrap(bytes)); given(kms.generateRandom(any(GenerateRandomRequest.class))).willReturn(randomResult); rotator.seed(); rotator.seed(); verify(random, times(1)).setSeed(bytes); }
|
protected void seed() { if (!seeded.get()) { synchronized (random) { if (!seeded.get()) { getLogger().debug("Seeding random number generator"); final GenerateRandomRequest request = new GenerateRandomRequest(); request.setNumberOfBytes(512); final GenerateRandomResult result = getKms().generateRandom(request); final ByteBuffer randomBytes = result.getPlaintext(); final byte[] bytes = new byte[randomBytes.remaining()]; randomBytes.get(bytes); random.setSeed(bytes); seeded.set(true); getLogger().debug("Seeded random number generator"); } } } }
|
AbstractFernetKeyRotator implements RequestStreamHandler { protected void seed() { if (!seeded.get()) { synchronized (random) { if (!seeded.get()) { getLogger().debug("Seeding random number generator"); final GenerateRandomRequest request = new GenerateRandomRequest(); request.setNumberOfBytes(512); final GenerateRandomResult result = getKms().generateRandom(request); final ByteBuffer randomBytes = result.getPlaintext(); final byte[] bytes = new byte[randomBytes.remaining()]; randomBytes.get(bytes); random.setSeed(bytes); seeded.set(true); getLogger().debug("Seeded random number generator"); } } } } }
|
AbstractFernetKeyRotator implements RequestStreamHandler { protected void seed() { if (!seeded.get()) { synchronized (random) { if (!seeded.get()) { getLogger().debug("Seeding random number generator"); final GenerateRandomRequest request = new GenerateRandomRequest(); request.setNumberOfBytes(512); final GenerateRandomResult result = getKms().generateRandom(request); final ByteBuffer randomBytes = result.getPlaintext(); final byte[] bytes = new byte[randomBytes.remaining()]; randomBytes.get(bytes); random.setSeed(bytes); seeded.set(true); getLogger().debug("Seeded random number generator"); } } } } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { protected void seed() { if (!seeded.get()) { synchronized (random) { if (!seeded.get()) { getLogger().debug("Seeding random number generator"); final GenerateRandomRequest request = new GenerateRandomRequest(); request.setNumberOfBytes(512); final GenerateRandomResult result = getKms().generateRandom(request); final ByteBuffer randomBytes = result.getPlaintext(); final byte[] bytes = new byte[randomBytes.remaining()]; randomBytes.get(bytes); random.setSeed(bytes); seeded.set(true); getLogger().debug("Seeded random number generator"); } } } } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
AbstractFernetKeyRotator implements RequestStreamHandler { protected void seed() { if (!seeded.get()) { synchronized (random) { if (!seeded.get()) { getLogger().debug("Seeding random number generator"); final GenerateRandomRequest request = new GenerateRandomRequest(); request.setNumberOfBytes(512); final GenerateRandomResult result = getKms().generateRandom(request); final ByteBuffer randomBytes = result.getPlaintext(); final byte[] bytes = new byte[randomBytes.remaining()]; randomBytes.get(bytes); random.setSeed(bytes); seeded.set(true); getLogger().debug("Seeded random number generator"); } } } } protected AbstractFernetKeyRotator(final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); protected AbstractFernetKeyRotator(final ObjectMapper mapper, final SecretsManager secretsManager, final AWSKMS kms,
final SecureRandom random); void handleRequest(final InputStream input, final OutputStream output, final Context context); }
|
@Test public final void verifyAssertCurrentStageExistsThrowsException() { final GetSecretValueRequest request = new GetSecretValueRequest(); request.setSecretId("secret"); request.setVersionStage("AWSCURRENT"); given(delegate.getSecretValue(eq(request))).willThrow(new ResourceNotFoundException("not found")); assertThrows(ResourceNotFoundException.class, () -> manager.assertCurrentStageExists("secret")); }
|
public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyAssertDoesNothing() { final GetSecretValueRequest request = new GetSecretValueRequest(); request.setSecretId("secret"); request.setVersionStage("AWSCURRENT"); given(delegate.getSecretValue(eq(request))).willReturn(new GetSecretValueResult()); manager.assertCurrentStageExists("secret"); }
|
public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public void assertCurrentStageExists(final String secretId) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(CURRENT.getAwsName()); getDelegate().getSecretValue(getSecretValueRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyDescribeSecretPassesThrough() { final DescribeSecretRequest request = new DescribeSecretRequest(); request.setSecretId("secret"); final DescribeSecretResult sampleResult = new DescribeSecretResult(); sampleResult.setRotationEnabled(true); sampleResult.addVersionIdsToStagesEntry("version", singletonList("AWSPREVIOUS")); given(delegate.describeSecret(eq(request))).willReturn(sampleResult); final DescribeSecretResult result = manager.describeSecret("secret"); assertTrue(result.isRotationEnabled()); assertTrue(result.getVersionIdsToStages().get("version").contains("AWSPREVIOUS")); }
|
public DescribeSecretResult describeSecret(final String secretId) { final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest(); describeSecretRequest.setSecretId(secretId); return getDelegate().describeSecret(describeSecretRequest); }
|
SecretsManager { public DescribeSecretResult describeSecret(final String secretId) { final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest(); describeSecretRequest.setSecretId(secretId); return getDelegate().describeSecret(describeSecretRequest); } }
|
SecretsManager { public DescribeSecretResult describeSecret(final String secretId) { final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest(); describeSecretRequest.setSecretId(secretId); return getDelegate().describeSecret(describeSecretRequest); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public DescribeSecretResult describeSecret(final String secretId) { final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest(); describeSecretRequest.setSecretId(secretId); return getDelegate().describeSecret(describeSecretRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public DescribeSecretResult describeSecret(final String secretId) { final DescribeSecretRequest describeSecretRequest = new DescribeSecretRequest(); describeSecretRequest.setSecretId(secretId); return getDelegate().describeSecret(describeSecretRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyGetSecretVersionRetrievesBinary() throws UnsupportedEncodingException { final GetSecretValueRequest request = new GetSecretValueRequest(); request.setSecretId("secret"); request.setVersionId("version"); final GetSecretValueResult response = new GetSecretValueResult(); response.setSecretBinary(ByteBuffer.wrap("expected".getBytes("UTF-8"))); given(delegate.getSecretValue(eq(request))).willReturn(response); final ByteBuffer result = manager.getSecretVersion("secret", "version"); final byte[] buffer = new byte[result.remaining()]; result.get(buffer); assertEquals("expected", new String(buffer, "UTF-8")); }
|
public ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionId(clientRequestToken); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); }
|
SecretsManager { public ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionId(clientRequestToken); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } }
|
SecretsManager { public ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionId(clientRequestToken); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionId(clientRequestToken); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionId(clientRequestToken); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyGetSecretStageRetrievesBinary() throws UnsupportedEncodingException { final GetSecretValueRequest request = new GetSecretValueRequest(); request.setSecretId("secret"); request.setVersionStage("AWSPENDING"); final GetSecretValueResult response = new GetSecretValueResult(); response.setSecretBinary(ByteBuffer.wrap("expected".getBytes("UTF-8"))); given(delegate.getSecretValue(eq(request))).willReturn(response); final ByteBuffer result = manager.getSecretStage("secret", PENDING); final byte[] buffer = new byte[result.remaining()]; result.get(buffer); assertEquals("expected", new String(buffer, "UTF-8")); }
|
public ByteBuffer getSecretStage(final String secretId, final Stage stage) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(stage.getAwsName()); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); }
|
SecretsManager { public ByteBuffer getSecretStage(final String secretId, final Stage stage) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(stage.getAwsName()); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } }
|
SecretsManager { public ByteBuffer getSecretStage(final String secretId, final Stage stage) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(stage.getAwsName()); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public ByteBuffer getSecretStage(final String secretId, final Stage stage) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(stage.getAwsName()); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public ByteBuffer getSecretStage(final String secretId, final Stage stage) { final GetSecretValueRequest getSecretValueRequest = new GetSecretValueRequest(); getSecretValueRequest.setSecretId(secretId); getSecretValueRequest.setVersionStage(stage.getAwsName()); final GetSecretValueResult result = getDelegate().getSecretValue(getSecretValueRequest); return result.getSecretBinary(); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyGetAuthorizationTokenRejectsMalformedHeader() { final ContainerRequest request = mock(ContainerRequest.class); given(request.getHeaderString("Authorization")).willReturn("Basic YWxpY2U6cGFzc3dvcmQ= 76bd6d14-0148-43c4-8ea0-8368336ce9f1"); assertThrows(NotAuthorizedException.class, () -> utility.getAuthorizationToken(request)); }
|
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
@Test public final void verifyRotateSecretTagsNewKeyAndUntagsOldKey() { manager.rotateSecret("secret", "new", "old"); final UpdateSecretVersionStageRequest request = new UpdateSecretVersionStageRequest(); request.setSecretId("secret"); request.setVersionStage("AWSCURRENT"); request.setMoveToVersionId("new"); request.setRemoveFromVersionId("old"); verify(delegate).updateSecretVersionStage(eq(request)); }
|
public void rotateSecret(final String secretId, final String clientRequestToken, final String currentVersion) { final UpdateSecretVersionStageRequest updateSecretVersionStageRequest = new UpdateSecretVersionStageRequest(); updateSecretVersionStageRequest.setSecretId(secretId); updateSecretVersionStageRequest.setVersionStage(CURRENT.getAwsName()); updateSecretVersionStageRequest.setMoveToVersionId(clientRequestToken); updateSecretVersionStageRequest.setRemoveFromVersionId(currentVersion); getDelegate().updateSecretVersionStage(updateSecretVersionStageRequest); }
|
SecretsManager { public void rotateSecret(final String secretId, final String clientRequestToken, final String currentVersion) { final UpdateSecretVersionStageRequest updateSecretVersionStageRequest = new UpdateSecretVersionStageRequest(); updateSecretVersionStageRequest.setSecretId(secretId); updateSecretVersionStageRequest.setVersionStage(CURRENT.getAwsName()); updateSecretVersionStageRequest.setMoveToVersionId(clientRequestToken); updateSecretVersionStageRequest.setRemoveFromVersionId(currentVersion); getDelegate().updateSecretVersionStage(updateSecretVersionStageRequest); } }
|
SecretsManager { public void rotateSecret(final String secretId, final String clientRequestToken, final String currentVersion) { final UpdateSecretVersionStageRequest updateSecretVersionStageRequest = new UpdateSecretVersionStageRequest(); updateSecretVersionStageRequest.setSecretId(secretId); updateSecretVersionStageRequest.setVersionStage(CURRENT.getAwsName()); updateSecretVersionStageRequest.setMoveToVersionId(clientRequestToken); updateSecretVersionStageRequest.setRemoveFromVersionId(currentVersion); getDelegate().updateSecretVersionStage(updateSecretVersionStageRequest); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public void rotateSecret(final String secretId, final String clientRequestToken, final String currentVersion) { final UpdateSecretVersionStageRequest updateSecretVersionStageRequest = new UpdateSecretVersionStageRequest(); updateSecretVersionStageRequest.setSecretId(secretId); updateSecretVersionStageRequest.setVersionStage(CURRENT.getAwsName()); updateSecretVersionStageRequest.setMoveToVersionId(clientRequestToken); updateSecretVersionStageRequest.setRemoveFromVersionId(currentVersion); getDelegate().updateSecretVersionStage(updateSecretVersionStageRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public void rotateSecret(final String secretId, final String clientRequestToken, final String currentVersion) { final UpdateSecretVersionStageRequest updateSecretVersionStageRequest = new UpdateSecretVersionStageRequest(); updateSecretVersionStageRequest.setSecretId(secretId); updateSecretVersionStageRequest.setVersionStage(CURRENT.getAwsName()); updateSecretVersionStageRequest.setMoveToVersionId(clientRequestToken); updateSecretVersionStageRequest.setRemoveFromVersionId(currentVersion); getDelegate().updateSecretVersionStage(updateSecretVersionStageRequest); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyPutSecretValueStoresKey() throws IOException { final String expected = "expected"; final Key key = mock(Key.class); final Answer<?> answer = new Answer<Void>() { public Void answer(final InvocationOnMock invocation) throws Throwable { final OutputStream stream = invocation.getArgument(0); stream.write(expected.getBytes("UTF-8")); return null; } }; doAnswer(answer).when(key).writeTo(any(OutputStream.class)); manager.putSecretValue("secret", "version", key, PREVIOUS); final PutSecretValueRequest request = new PutSecretValueRequest(); request.setSecretId("secret"); request.setClientRequestToken("version"); request.setVersionStages(singleton("AWSPREVIOUS")); request.setSecretBinary(ByteBuffer.wrap(expected.getBytes("UTF-8"))); verify(delegate).putSecretValue(eq(request)); }
|
public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public final void verifyPutSecretValueStoresKeys() throws IOException { final String expected = "expected"; final Key key0 = mock(Key.class); final Key key1 = mock(Key.class); final Answer<?> answer = new Answer<Void>() { public Void answer(final InvocationOnMock invocation) throws Throwable { final OutputStream stream = invocation.getArgument(0); stream.write(expected.getBytes("UTF-8")); return null; } }; doAnswer(answer).when(key0).writeTo(any(OutputStream.class)); doAnswer(answer).when(key1).writeTo(any(OutputStream.class)); manager.putSecretValue("secret", "version", asList(key0, key1), PREVIOUS); final PutSecretValueRequest request = new PutSecretValueRequest(); request.setSecretId("secret"); request.setClientRequestToken("version"); request.setVersionStages(singleton("AWSPREVIOUS")); request.setSecretBinary(ByteBuffer.wrap((expected + expected).getBytes("UTF-8"))); verify(delegate).putSecretValue(eq(request)); }
|
public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } SecretsManager(final AWSSecretsManager delegate); }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
SecretsManager { public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); } SecretsManager(final AWSSecretsManager delegate); void shutdown(); void assertCurrentStageExists(final String secretId); DescribeSecretResult describeSecret(final String secretId); ByteBuffer getSecretVersion(final String secretId, final String clientRequestToken); ByteBuffer getSecretStage(final String secretId, final Stage stage); void rotateSecret(final String secretId, final String clientRequestToken,
final String currentVersion); void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage); void putSecretValue(final String secretId, final String clientRequestToken, final Collection<? extends Key> keys,
final Stage stage); }
|
@Test public void testFromString() { final String string = "gAAAAAAdwJ6wAAECAwQFBgcICQoLDA0ODy021cpGVWKZ_eEwCGM4BLLF_5CV9dOPmrhuVUPgJobwOz7JcbmrR64jVmpU4IwqDA=="; final Token result = Token.fromString(string); assertEquals((byte) 0x80, result.getVersion()); assertEquals(Instant.from(formatter.parse("1985-10-26T01:20:00-07:00")), result.getTimestamp()); assertArrayEquals(new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, result.getInitializationVector().getIV()); }
|
public static Token fromString(final String string) { return fromBytes(decoder.decode(string)); }
|
Token { public static Token fromString(final String string) { return fromBytes(decoder.decode(string)); } }
|
Token { public static Token fromString(final String string) { return fromBytes(decoder.decode(string)); } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); }
|
Token { public static Token fromString(final String string) { return fromBytes(decoder.decode(string)); } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) static Token fromBytes(final byte[] bytes); static Token fromString(final String string); static Token generate(final Key key, final String plainText); static Token generate(final SecureRandom random, final Key key, final String plainText); static Token generate(final Key key, final byte[] payload); static Token generate(final SecureRandom random, final Key key, final byte[] payload); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Key key, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); @SuppressWarnings("PMD.LawOfDemeter") void writeTo(final OutputStream outputStream); byte getVersion(); Instant getTimestamp(); IvParameterSpec getInitializationVector(); String toString(); boolean isValidSignature(final Key key); }
|
Token { public static Token fromString(final String string) { return fromBytes(decoder.decode(string)); } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) static Token fromBytes(final byte[] bytes); static Token fromString(final String string); static Token generate(final Key key, final String plainText); static Token generate(final SecureRandom random, final Key key, final String plainText); static Token generate(final Key key, final byte[] payload); static Token generate(final SecureRandom random, final Key key, final byte[] payload); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Key key, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); @SuppressWarnings("PMD.LawOfDemeter") void writeTo(final OutputStream outputStream); byte getVersion(); Instant getTimestamp(); IvParameterSpec getInitializationVector(); String toString(); boolean isValidSignature(final Key key); }
|
@Test public void testGenerate() { final SecureRandom deterministicRandom = new SecureRandom() { private static final long serialVersionUID = 3075400891983079965L; public void nextBytes(final byte[] bytes) { for (int i = bytes.length; --i >= 0; bytes[i] = 1); } }; final Key key = Key.generateKey(deterministicRandom); final Token result = Token.generate(deterministicRandom, key, "Hello, world!"); final String plainText = result.validateAndDecrypt(key, validator); assertEquals("Hello, world!", plainText); }
|
public static Token generate(final Key key, final String plainText) { return generate(new SecureRandom(), key, plainText); }
|
Token { public static Token generate(final Key key, final String plainText) { return generate(new SecureRandom(), key, plainText); } }
|
Token { public static Token generate(final Key key, final String plainText) { return generate(new SecureRandom(), key, plainText); } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); }
|
Token { public static Token generate(final Key key, final String plainText) { return generate(new SecureRandom(), key, plainText); } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) static Token fromBytes(final byte[] bytes); static Token fromString(final String string); static Token generate(final Key key, final String plainText); static Token generate(final SecureRandom random, final Key key, final String plainText); static Token generate(final Key key, final byte[] payload); static Token generate(final SecureRandom random, final Key key, final byte[] payload); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Key key, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); @SuppressWarnings("PMD.LawOfDemeter") void writeTo(final OutputStream outputStream); byte getVersion(); Instant getTimestamp(); IvParameterSpec getInitializationVector(); String toString(); boolean isValidSignature(final Key key); }
|
Token { public static Token generate(final Key key, final String plainText) { return generate(new SecureRandom(), key, plainText); } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) static Token fromBytes(final byte[] bytes); static Token fromString(final String string); static Token generate(final Key key, final String plainText); static Token generate(final SecureRandom random, final Key key, final String plainText); static Token generate(final Key key, final byte[] payload); static Token generate(final SecureRandom random, final Key key, final byte[] payload); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Key key, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); @SuppressWarnings("PMD.LawOfDemeter") void writeTo(final OutputStream outputStream); byte getVersion(); Instant getTimestamp(); IvParameterSpec getInitializationVector(); String toString(); boolean isValidSignature(final Key key); }
|
@Test public void testSerialise() { final IvParameterSpec initializationVector = new IvParameterSpec( new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}); final Token invalidToken = new Token((byte) 0x80, Instant.ofEpochSecond(0), initializationVector, new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}); final String result = invalidToken.serialise(); assertEquals( "gAAAAAAAAAAAAQIDBAUGBwgJCgsMDQ4PEAECAwQFBgcICQoLDA0ODxABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fIA==", result); }
|
@SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( tokenStaticBytes + getCipherText().length)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } }
|
Token { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( tokenStaticBytes + getCipherText().length)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } }
|
Token { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( tokenStaticBytes + getCipherText().length)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); }
|
Token { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( tokenStaticBytes + getCipherText().length)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) static Token fromBytes(final byte[] bytes); static Token fromString(final String string); static Token generate(final Key key, final String plainText); static Token generate(final SecureRandom random, final Key key, final String plainText); static Token generate(final Key key, final byte[] payload); static Token generate(final SecureRandom random, final Key key, final byte[] payload); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Key key, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); @SuppressWarnings("PMD.LawOfDemeter") void writeTo(final OutputStream outputStream); byte getVersion(); Instant getTimestamp(); IvParameterSpec getInitializationVector(); String toString(); boolean isValidSignature(final Key key); }
|
Token { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( tokenStaticBytes + getCipherText().length)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } @SuppressWarnings({"PMD.ArrayIsStoredDirectly", "PMD.CyclomaticComplexity"}) protected Token(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText, final byte[] hmac); @SuppressWarnings({"PMD.PrematureDeclaration", "PMD.DataflowAnomalyAnalysis"}) static Token fromBytes(final byte[] bytes); static Token fromString(final String string); static Token generate(final Key key, final String plainText); static Token generate(final SecureRandom random, final Key key, final String plainText); static Token generate(final Key key, final byte[] payload); static Token generate(final SecureRandom random, final Key key, final byte[] payload); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Key key, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); @SuppressWarnings("PMD.LawOfDemeter") void writeTo(final OutputStream outputStream); byte getVersion(); Instant getTimestamp(); IvParameterSpec getInitializationVector(); String toString(); boolean isValidSignature(final Key key); }
|
@Test public void testGenerateKey() { final SecureRandom deterministicRandom = new SecureRandom() { private static final long serialVersionUID = 6548702184401342900L; public void nextBytes(final byte[] bytes) { for (int i = signingKeyBytes; --i >= 0; bytes[i] = 1); } }; final Key result = Key.generateKey(deterministicRandom); final byte[] signingKey = result.getSigningKeySpec().getEncoded(); for (int i = signingKeyBytes; --i >= 0;) { assertEquals(1, signingKey[i]); } final byte[] encryptionKey = result.getEncryptionKeySpec().getEncoded(); for (int i = encryptionKeyBytes; --i >= 0;) { assertEquals(1, encryptionKey[i]); } }
|
public static Key generateKey() { return generateKey(new SecureRandom()); }
|
Key { public static Key generateKey() { return generateKey(new SecureRandom()); } }
|
Key { public static Key generateKey() { return generateKey(new SecureRandom()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); }
|
Key { public static Key generateKey() { return generateKey(new SecureRandom()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
Key { public static Key generateKey() { return generateKey(new SecureRandom()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
@Test public void testGetHmac() { final Key key = new Key("AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA="); final byte[] result = key.sign((byte) 0x80, Instant.ofEpochSecond(1), new IvParameterSpec(new byte[] {2}), new byte[] {3}); assertEquals("WvLIvt4MSCQKgeLyvltUqN8O7mvcozhsEAgIiytxypw=", encoder.encodeToString(result)); }
|
public byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector, final byte[] cipherText) { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( getTokenPrefixBytes() + cipherText.length)) { return sign(version, timestamp, initializationVector, cipherText, byteStream); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } }
|
Key { public byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector, final byte[] cipherText) { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( getTokenPrefixBytes() + cipherText.length)) { return sign(version, timestamp, initializationVector, cipherText, byteStream); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } }
|
Key { public byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector, final byte[] cipherText) { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( getTokenPrefixBytes() + cipherText.length)) { return sign(version, timestamp, initializationVector, cipherText, byteStream); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); }
|
Key { public byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector, final byte[] cipherText) { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( getTokenPrefixBytes() + cipherText.length)) { return sign(version, timestamp, initializationVector, cipherText, byteStream); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
Key { public byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector, final byte[] cipherText) { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream( getTokenPrefixBytes() + cipherText.length)) { return sign(version, timestamp, initializationVector, cipherText, byteStream); } catch (final IOException e) { throw new IllegalStateException(e.getMessage(), e); } } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
@Test public void testGetSigningKeySpec() { final Key key = new Key("AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA="); final java.security.Key result = key.getSigningKeySpec(); assertEquals("HmacSHA256", result.getAlgorithm()); }
|
protected java.security.Key getSigningKeySpec() { return new SecretKeySpec(getSigningKey(), getSigningAlgorithm()); }
|
Key { protected java.security.Key getSigningKeySpec() { return new SecretKeySpec(getSigningKey(), getSigningAlgorithm()); } }
|
Key { protected java.security.Key getSigningKeySpec() { return new SecretKeySpec(getSigningKey(), getSigningAlgorithm()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); }
|
Key { protected java.security.Key getSigningKeySpec() { return new SecretKeySpec(getSigningKey(), getSigningAlgorithm()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
Key { protected java.security.Key getSigningKeySpec() { return new SecretKeySpec(getSigningKey(), getSigningAlgorithm()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
@Test public void testGetEncryptionKeySpec() { final Key key = new Key("AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA="); final SecretKeySpec result = key.getEncryptionKeySpec(); assertEquals("AES", result.getAlgorithm()); }
|
protected SecretKeySpec getEncryptionKeySpec() { return new SecretKeySpec(getEncryptionKey(), getEncryptionAlgorithm()); }
|
Key { protected SecretKeySpec getEncryptionKeySpec() { return new SecretKeySpec(getEncryptionKey(), getEncryptionAlgorithm()); } }
|
Key { protected SecretKeySpec getEncryptionKeySpec() { return new SecretKeySpec(getEncryptionKey(), getEncryptionAlgorithm()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); }
|
Key { protected SecretKeySpec getEncryptionKeySpec() { return new SecretKeySpec(getEncryptionKey(), getEncryptionAlgorithm()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
Key { protected SecretKeySpec getEncryptionKeySpec() { return new SecretKeySpec(getEncryptionKey(), getEncryptionAlgorithm()); } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
@Test public final void verifyGetAuthorizationTokenRejectsInvalidScheme() { final ContainerRequest request = mock(ContainerRequest.class); given(request.getHeaderString("Authorization")).willReturn("Basic YWxpY2U6cGFzc3dvcmQ="); assertThrows(NotAuthorizedException.class, () -> utility.getAuthorizationToken(request)); }
|
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
@Test public void testSerialise() { final Key key = new Key(new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, new byte[] {17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}); final String result = key.serialise(); assertEquals("AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA=", result); }
|
@SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(fernetKeyBytes)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException ioe) { throw new IllegalStateException(ioe.getMessage(), ioe); } }
|
Key { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(fernetKeyBytes)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException ioe) { throw new IllegalStateException(ioe.getMessage(), ioe); } } }
|
Key { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(fernetKeyBytes)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException ioe) { throw new IllegalStateException(ioe.getMessage(), ioe); } } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); }
|
Key { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(fernetKeyBytes)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException ioe) { throw new IllegalStateException(ioe.getMessage(), ioe); } } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
Key { @SuppressWarnings("PMD.LawOfDemeter") public String serialise() { try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream(fernetKeyBytes)) { writeTo(byteStream); return getEncoder().encodeToString(byteStream.toByteArray()); } catch (final IOException ioe) { throw new IllegalStateException(ioe.getMessage(), ioe); } } Key(final byte[] signingKey, final byte[] encryptionKey); Key(final byte[] concatenatedKeys); Key(final String string); static Key generateKey(); static Key generateKey(final SecureRandom random); byte[] sign(final byte version, final Instant timestamp, final IvParameterSpec initializationVector,
final byte[] cipherText); @SuppressWarnings("PMD.LawOfDemeter") byte[] encrypt(final byte[] payload, final IvParameterSpec initializationVector); @SuppressWarnings("PMD.LawOfDemeter") String serialise(); void writeTo(final OutputStream outputStream); int hashCode(); @SuppressWarnings("PMD.LawOfDemeter") boolean equals(final Object obj); }
|
@Test public final void verifyGetAuthorizationTokenIgnoresX() { final Key key = Key.generateKey(random); final Token token = Token.generate(random, key, "hello"); final ContainerRequest request = mock(ContainerRequest.class); given(request.getHeaderString("X-Authorization")).willReturn(token.serialise()); final Token result = utility.getAuthorizationToken(request); assertNull(result); }
|
@SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
TokenHeaderUtility { @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") public Token getAuthorizationToken(final ContainerRequest request) { String authorizationString = request.getHeaderString("Authorization"); if (authorizationString != null && !"".equals(authorizationString)) { authorizationString = authorizationString.trim(); final String[] components = authorizationString.split("\\s"); if (components.length != 2) { throw new NotAuthorizedException(authenticationType); } final String scheme = components[0]; if (!authenticationType.equalsIgnoreCase(scheme)) { throw new NotAuthorizedException(authenticationType); } final String tokenString = components[1]; return Token.fromString(tokenString); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
@Test public final void verifyGetXAuthorizationTokenDeserialisesToken() { final Key key = Key.generateKey(random); final Token token = Token.generate(random, key, "hello"); final ContainerRequest request = mock(ContainerRequest.class); given(request.getHeaderString("X-Authorization")).willReturn(token.serialise()); final Token result = utility.getXAuthorizationToken(request); assertEquals(token.serialise(), result.serialise()); }
|
public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
@Test public final void verifyGetXAuthorizationTokenIgnoresBearer() { final Key key = Key.generateKey(random); final Token token = Token.generate(random, key, "hello"); final ContainerRequest request = mock(ContainerRequest.class); given(request.getHeaderString("Authorization")).willReturn("Bearer " + token.serialise()); final Token result = utility.getXAuthorizationToken(request); assertNull(result); }
|
public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
TokenHeaderUtility { public Token getXAuthorizationToken(final ContainerRequest request) { final String xAuthorizationString = request.getHeaderString("X-Authorization"); if (xAuthorizationString != null && !"".equals(xAuthorizationString)) { return Token.fromString(xAuthorizationString.trim()); } return null; } @SuppressWarnings("PMD.AvoidLiteralsInIfCondition") Token getAuthorizationToken(final ContainerRequest request); Token getXAuthorizationToken(final ContainerRequest request); }
|
@Test public final void verifyToResponseGeneratesForbidden() { final PayloadValidationException exception = new PayloadValidationException("Invalid payload"); final Response response = mapper.toResponse(exception); assertEquals(403, response.getStatus()); }
|
public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } Response toResponse(final TokenValidationException exception); }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } Response toResponse(final TokenValidationException exception); }
|
@Test public final void verifyToResponseGeneratesUnauthorized() { final TokenValidationException exception = new TokenExpiredException("token expired"); final Response response = mapper.toResponse(exception); assertEquals(401, response.getStatus()); final String challenge = response.getHeaderString("WWW-Authenticate"); assertTrue(challenge.startsWith("Bearer ")); }
|
public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } Response toResponse(final TokenValidationException exception); }
|
TokenValidationExceptionMapper implements ExceptionMapper<TokenValidationException> { public Response toResponse(final TokenValidationException exception) { if (exception instanceof PayloadValidationException) { return status(FORBIDDEN).entity("Request could not be validated.").type(TEXT_PLAIN_TYPE).build(); } return new NotAuthorizedException("Bearer error=\"invalid_token\"").getResponse(); } Response toResponse(final TokenValidationException exception); }
|
@Test public void verifyAfterResponseClearsSecret() { final ByteBuffer secretBinary = ByteBuffer.wrap(new byte[] { 1, 1, 2, 3, 5, 8 }); assertTrue(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8})); final PutSecretValueRequest originalRequest = new PutSecretValueRequest(); originalRequest.setSecretBinary(secretBinary); final Request<PutSecretValueRequest> request = new DefaultRequest<PutSecretValueRequest>(originalRequest, "AWSSecretsManager"); final PutSecretValueResult result = mock(PutSecretValueResult.class); final HttpResponse httpResponse = mock(HttpResponse.class); final Response<PutSecretValueResult> response = new Response<PutSecretValueResult>(result, httpResponse); handler.afterResponse(request, response); assertFalse(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8})); }
|
public void afterResponse(final Request<?> request, final Response<?> response) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterResponse(final Request<?> request, final Response<?> response) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterResponse(final Request<?> request, final Response<?> response) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } MemoryOverwritingRequestHandler(final SecureRandom random); }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterResponse(final Request<?> request, final Response<?> response) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } MemoryOverwritingRequestHandler(final SecureRandom random); void afterResponse(final Request<?> request, final Response<?> response); void afterError(final Request<?> request, final Response<?> response, final Exception exception); }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterResponse(final Request<?> request, final Response<?> response) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } MemoryOverwritingRequestHandler(final SecureRandom random); void afterResponse(final Request<?> request, final Response<?> response); void afterError(final Request<?> request, final Response<?> response, final Exception exception); }
|
@Test public void verifyAfterErrorClearsSecret() { final ByteBuffer secretBinary = ByteBuffer.wrap(new byte[] { 1, 1, 2, 3, 5, 8 }); assertTrue(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8})); final PutSecretValueRequest originalRequest = new PutSecretValueRequest(); originalRequest.setSecretBinary(secretBinary); final Request<PutSecretValueRequest> request = new DefaultRequest<PutSecretValueRequest>(originalRequest, "AWSSecretsManager"); final PutSecretValueResult result = mock(PutSecretValueResult.class); final HttpResponse httpResponse = mock(HttpResponse.class); final Response<PutSecretValueResult> response = new Response<PutSecretValueResult>(result, httpResponse); handler.afterError(request, response, new Exception()); assertFalse(Arrays.equals(secretBinary.array(), new byte[] { 1, 1, 2, 3, 5, 8})); }
|
public void afterError(final Request<?> request, final Response<?> response, final Exception exception) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterError(final Request<?> request, final Response<?> response, final Exception exception) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterError(final Request<?> request, final Response<?> response, final Exception exception) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } MemoryOverwritingRequestHandler(final SecureRandom random); }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterError(final Request<?> request, final Response<?> response, final Exception exception) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } MemoryOverwritingRequestHandler(final SecureRandom random); void afterResponse(final Request<?> request, final Response<?> response); void afterError(final Request<?> request, final Response<?> response, final Exception exception); }
|
MemoryOverwritingRequestHandler extends RequestHandler2 { public void afterError(final Request<?> request, final Response<?> response, final Exception exception) { final Object requestObject = request.getOriginalRequestObject(); if (requestObject instanceof PutSecretValueRequest) { final PutSecretValueRequest putRequest = (PutSecretValueRequest) requestObject; overwriteSecret(putRequest); } } MemoryOverwritingRequestHandler(final SecureRandom random); void afterResponse(final Request<?> request, final Response<?> response); void afterError(final Request<?> request, final Response<?> response, final Exception exception); }
|
@Test public void testId() { Team team1 = new Team(1, null); assertNotNull(team1.getId()); }
|
public String getId() { return Integer.toString(id); }
|
Team { public String getId() { return Integer.toString(id); } }
|
Team { public String getId() { return Integer.toString(id); } Team(final int id, final String name); }
|
Team { public String getId() { return Integer.toString(id); } Team(final int id, final String name); String getId(); String getName(); void setName(final String name); boolean isScrumTeam(); void setScrumTeam(final boolean isScrumTeam); List<Employee> getEmployees(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
Team { public String getId() { return Integer.toString(id); } Team(final int id, final String name); String getId(); String getName(); void setName(final String name); boolean isScrumTeam(); void setScrumTeam(final boolean isScrumTeam); List<Employee> getEmployees(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
@Test public void testGetBuilder() { assertNotNull(objJPAEdmModel.getBuilder()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmModelBuilder(); } return builder; }
|
JPAEdmModel extends JPAEdmBaseViewImpl implements JPAEdmModelView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmModelBuilder(); } return builder; } }
|
JPAEdmModel extends JPAEdmBaseViewImpl implements JPAEdmModelView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmModelBuilder(); } return builder; } JPAEdmModel(final Metamodel metaModel, final String pUnitName); JPAEdmModel(final ODataJPAContext ctx); }
|
JPAEdmModel extends JPAEdmBaseViewImpl implements JPAEdmModelView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmModelBuilder(); } return builder; } JPAEdmModel(final Metamodel metaModel, final String pUnitName); JPAEdmModel(final ODataJPAContext ctx); @Override JPAEdmSchemaView getEdmSchemaView(); @Override JPAEdmBuilder getBuilder(); }
|
JPAEdmModel extends JPAEdmBaseViewImpl implements JPAEdmModelView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmModelBuilder(); } return builder; } JPAEdmModel(final Metamodel metaModel, final String pUnitName); JPAEdmModel(final ODataJPAContext ctx); @Override JPAEdmSchemaView getEdmSchemaView(); @Override JPAEdmBuilder getBuilder(); }
|
@Test public void testGetBuilder() { assertNotNull(objJPAEdmAssociationSet.getBuilder()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } JPAEdmAssociationSet(final JPAEdmSchemaView view); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
@Test public void testGetConsistentEdmAssociationSetList() { assertNotNull(objJPAEdmAssociationSet.getConsistentEdmAssociationSetList()); }
|
@Override public List<AssociationSet> getConsistentEdmAssociationSetList() { return associationSetList; }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public List<AssociationSet> getConsistentEdmAssociationSetList() { return associationSetList; } }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public List<AssociationSet> getConsistentEdmAssociationSetList() { return associationSetList; } JPAEdmAssociationSet(final JPAEdmSchemaView view); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public List<AssociationSet> getConsistentEdmAssociationSetList() { return associationSetList; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public List<AssociationSet> getConsistentEdmAssociationSetList() { return associationSetList; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
@Test public void testGetEdmAssociationSet() { assertNotNull(objJPAEdmAssociationSet.getEdmAssociationSet()); }
|
@Override public AssociationSet getEdmAssociationSet() { return currentAssociationSet; }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public AssociationSet getEdmAssociationSet() { return currentAssociationSet; } }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public AssociationSet getEdmAssociationSet() { return currentAssociationSet; } JPAEdmAssociationSet(final JPAEdmSchemaView view); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public AssociationSet getEdmAssociationSet() { return currentAssociationSet; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public AssociationSet getEdmAssociationSet() { return currentAssociationSet; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
@Test public void testGetEdmAssociation() { assertNotNull(objJPAEdmAssociationSet.getEdmAssociation()); }
|
@Override public Association getEdmAssociation() { return currentAssociation; }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public Association getEdmAssociation() { return currentAssociation; } }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public Association getEdmAssociation() { return currentAssociation; } JPAEdmAssociationSet(final JPAEdmSchemaView view); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public Association getEdmAssociation() { return currentAssociation; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public Association getEdmAssociation() { return currentAssociation; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
@Test public void testGetBuilderIdempotent() { JPAEdmBuilder builder1 = objJPAEdmAssociationSet.getBuilder(); JPAEdmBuilder builder2 = objJPAEdmAssociationSet.getBuilder(); assertEquals(builder1.hashCode(), builder2.hashCode()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } JPAEdmAssociationSet(final JPAEdmSchemaView view); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
JPAEdmAssociationSetView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationSetBuilder(); } return builder; } JPAEdmAssociationSet(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override List<AssociationSet> getConsistentEdmAssociationSetList(); @Override AssociationSet getEdmAssociationSet(); @Override Association getEdmAssociation(); }
|
@Test public void testGetpUnitName() { assertTrue(objJPAEdmBaseViewImpl.getpUnitName().equals("salesorderprocessing")); }
|
@Override public String getpUnitName() { return pUnitName; }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public String getpUnitName() { return pUnitName; } }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public String getpUnitName() { return pUnitName; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public String getpUnitName() { return pUnitName; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public String getpUnitName() { return pUnitName; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
@Test public void testGetJPAMetaModel() { assertNotNull(objJPAEdmBaseViewImpl.getJPAMetaModel()); }
|
@Override public Metamodel getJPAMetaModel() { return metaModel; }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public Metamodel getJPAMetaModel() { return metaModel; } }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public Metamodel getJPAMetaModel() { return metaModel; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public Metamodel getJPAMetaModel() { return metaModel; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public Metamodel getJPAMetaModel() { return metaModel; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
@Test public void testIsConsistent() { assertTrue(objJPAEdmBaseViewImpl.isConsistent()); }
|
@Override public boolean isConsistent() { return isConsistent; }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public boolean isConsistent() { return isConsistent; } }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public boolean isConsistent() { return isConsistent; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public boolean isConsistent() { return isConsistent; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public boolean isConsistent() { return isConsistent; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
@Test public void testClean() { objJPAEdmBaseViewImpl.clean(); assertFalse(objJPAEdmBaseViewImpl.isConsistent()); }
|
@Override public void clean() { pUnitName = null; metaModel = null; isConsistent = false; }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public void clean() { pUnitName = null; metaModel = null; isConsistent = false; } }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public void clean() { pUnitName = null; metaModel = null; isConsistent = false; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public void clean() { pUnitName = null; metaModel = null; isConsistent = false; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
JPAEdmBaseViewImpl implements JPAEdmBaseView { @Override public void clean() { pUnitName = null; metaModel = null; isConsistent = false; } JPAEdmBaseViewImpl(final JPAEdmBaseView view); JPAEdmBaseViewImpl(final ODataJPAContext context); JPAEdmBaseViewImpl(final Metamodel metaModel, final String pUnitName); @Override String getpUnitName(); @Override Metamodel getJPAMetaModel(); @Override boolean isConsistent(); @Override void clean(); @Override JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(); @Override JPAEdmExtension getJPAEdmExtension(); }
|
@Test public void testRooms() { List<Room> list = Arrays.asList(new Room(1, null), new Room(2, null), new Room(3, null)); Building building1 = new Building(1, null); building1.getRooms().add(list.get(0)); building1.getRooms().add(list.get(1)); building1.getRooms().add(list.get(2)); assertEquals(list, building1.getRooms()); }
|
public List<Room> getRooms() { return rooms; }
|
Building { public List<Room> getRooms() { return rooms; } }
|
Building { public List<Room> getRooms() { return rooms; } Building(final int id, final String name); }
|
Building { public List<Room> getRooms() { return rooms; } Building(final int id, final String name); String getId(); void setName(final String name); String getName(); void setImage(final byte[] byteArray); byte[] getImage(); List<Room> getRooms(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
Building { public List<Room> getRooms() { return rooms; } Building(final int id, final String name); String getId(); void setName(final String name); String getName(); void setImage(final byte[] byteArray); byte[] getImage(); List<Room> getRooms(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
@Test public void testGetBuilder() { assertNotNull(objComplexType.getBuilder()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testGetEdmComplexType() { assertEquals(objComplexType.getEdmComplexType().getName(), "String"); }
|
@Override public ComplexType getEdmComplexType() { return currentComplexType; }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType getEdmComplexType() { return currentComplexType; } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType getEdmComplexType() { return currentComplexType; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType getEdmComplexType() { return currentComplexType; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType getEdmComplexType() { return currentComplexType; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testSearchComplexTypeString() { assertNotNull(objComplexType.searchEdmComplexType("java.lang.String")); }
|
@Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testGetJPAEmbeddableType() { assertTrue(objComplexType.getJPAEmbeddableType().getAttributes().size() > 0); }
|
@Override public EmbeddableType<?> getJPAEmbeddableType() { return currentEmbeddableType; }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public EmbeddableType<?> getJPAEmbeddableType() { return currentEmbeddableType; } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public EmbeddableType<?> getJPAEmbeddableType() { return currentEmbeddableType; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public EmbeddableType<?> getJPAEmbeddableType() { return currentEmbeddableType; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public EmbeddableType<?> getJPAEmbeddableType() { return currentEmbeddableType; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testGetConsistentEdmComplexTypes() { assertTrue(objComplexType.getConsistentEdmComplexTypes().size() > 0); }
|
@Override public List<ComplexType> getConsistentEdmComplexTypes() { return consistentComplextTypes; }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public List<ComplexType> getConsistentEdmComplexTypes() { return consistentComplextTypes; } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public List<ComplexType> getConsistentEdmComplexTypes() { return consistentComplextTypes; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public List<ComplexType> getConsistentEdmComplexTypes() { return consistentComplextTypes; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public List<ComplexType> getConsistentEdmComplexTypes() { return consistentComplextTypes; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testSearchComplexTypeFullQualifiedName() { assertNotNull(objComplexType.searchEdmComplexType(new FullQualifiedName("salesorderprocessing", "String"))); }
|
@Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testSearchComplexTypeFullQualifiedNameNegative() { assertNull(objComplexType.searchEdmComplexType(new FullQualifiedName("salesorderprocessing", "lang.String"))); }
|
@Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public ComplexType searchEdmComplexType(final String embeddableTypeName) { return searchMap.get(embeddableTypeName); } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testGetBuilderIdempotent() { JPAEdmBuilder builder1 = objComplexType.getBuilder(); JPAEdmBuilder builder2 = objComplexType.getBuilder(); assertEquals(builder1.hashCode(), builder2.hashCode()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testExpandEdmComplexType() { ComplexType complexType = new ComplexType(); List<Property> properties = new ArrayList<Property>(); JPAEdmMapping mapping1 = new JPAEdmMappingImpl(); mapping1.setJPAColumnName("LINEITEMID"); ((Mapping) mapping1).setInternalName("LineItemKey.LiId"); JPAEdmMapping mapping2 = new JPAEdmMappingImpl(); mapping2.setJPAColumnName("LINEITEMNAME"); ((Mapping) mapping2).setInternalName("LineItemKey.LiName"); properties.add(new SimpleProperty().setName("LIID").setMapping((Mapping) mapping1)); properties.add(new SimpleProperty().setName("LINAME").setMapping((Mapping) mapping2)); complexType.setProperties(properties); List<Property> expandedList = null; try { objComplexType.expandEdmComplexType(complexType, expandedList, "SalesOrderItemKey"); } catch (ClassCastException e) { assertTrue(false); } assertTrue(true); }
|
@Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setMimeType(mapping.getMimeType()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setMimeType(mapping.getMimeType()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setMimeType(mapping.getMimeType()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setMimeType(mapping.getMimeType()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setMimeType(mapping.getMimeType()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testComplexTypeCreation() { try { objComplexType.getBuilder().build(); } catch (ODataJPARuntimeException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } catch (ODataJPAModelException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } assertEquals(objComplexType.pUnitName, "salesorderprocessing"); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
JPAEdmComplexType extends JPAEdmBaseViewImpl implements
JPAEdmComplexTypeView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmComplexTypeBuilder(); } return builder; } JPAEdmComplexType(final JPAEdmSchemaView view); JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName); }
|
@Test public void testId() { Employee employee1 = new Employee(1, null); assertNotNull(employee1.getId()); }
|
public String getId() { return Integer.toString(employeeId); }
|
Employee { public String getId() { return Integer.toString(employeeId); } }
|
Employee { public String getId() { return Integer.toString(employeeId); } Employee(final int employeeId, final String name); }
|
Employee { public String getId() { return Integer.toString(employeeId); } Employee(final int employeeId, final String name); String getId(); void setEmployeeName(final String employeeName); String getEmployeeName(); void setAge(final int age); int getAge(); void setManager(final Manager manager); Manager getManager(); void setTeam(final Team team); Team getTeam(); void setRoom(final Room room); Room getRoom(); void setImageUri(final String imageUri); String getImageUri(); void setLocation(final Location location); Location getLocation(); void setEntryDate(final Calendar date); Calendar getEntryDate(); void setImageType(final String imageType); String getImageType(); void setImage(final byte[] image); void setImage(final String imageUrl); byte[] getImage(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
Employee { public String getId() { return Integer.toString(employeeId); } Employee(final int employeeId, final String name); String getId(); void setEmployeeName(final String employeeName); String getEmployeeName(); void setAge(final int age); int getAge(); void setManager(final Manager manager); Manager getManager(); void setTeam(final Team team); Team getTeam(); void setRoom(final Room room); Room getRoom(); void setImageUri(final String imageUri); String getImageUri(); void setLocation(final Location location); Location getLocation(); void setEntryDate(final Calendar date); Calendar getEntryDate(); void setImageType(final String imageType); String getImageType(); void setImage(final byte[] image); void setImage(final String imageUrl); byte[] getImage(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
@Test public void testGetBuilder() { assertNotNull(objJPAEdmReferentialConstraint.getBuilder()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
@Test public void testGetBuilderIdempotent() { JPAEdmBuilder builder1 = objJPAEdmReferentialConstraint.getBuilder(); JPAEdmBuilder builder2 = objJPAEdmReferentialConstraint.getBuilder(); assertEquals(builder1.hashCode(), builder2.hashCode()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmRefConstraintBuilder(); } return builder; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
@Test public void testGetEdmReferentialConstraint() { assertNotNull(objJPAEdmReferentialConstraint .getEdmReferentialConstraint()); }
|
@Override public ReferentialConstraint getEdmReferentialConstraint() { return referentialConstraint; }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public ReferentialConstraint getEdmReferentialConstraint() { return referentialConstraint; } }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public ReferentialConstraint getEdmReferentialConstraint() { return referentialConstraint; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public ReferentialConstraint getEdmReferentialConstraint() { return referentialConstraint; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public ReferentialConstraint getEdmReferentialConstraint() { return referentialConstraint; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
@Test public void testGetRelationShipName() { assertEquals("Assoc_SalesOrderHeader_SalesOrderItem", objJPAEdmReferentialConstraint.getEdmRelationShipName()); }
|
@Override public String getEdmRelationShipName() { return relationShipName; }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public String getEdmRelationShipName() { return relationShipName; } }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public String getEdmRelationShipName() { return relationShipName; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public String getEdmRelationShipName() { return relationShipName; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
JPAEdmReferentialConstraint extends JPAEdmBaseViewImpl implements
JPAEdmReferentialConstraintView { @Override public String getEdmRelationShipName() { return relationShipName; } JPAEdmReferentialConstraint(final JPAEdmAssociationView associationView,
final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override ReferentialConstraint getEdmReferentialConstraint(); @Override boolean isExists(); @Override String getEdmRelationShipName(); }
|
@Test public void testGetBuilder() { JPAEdmBuilder builder = objJPAEdmAssociationEnd.getBuilder(); assertNotNull(builder); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
@Test public void testGetBuilderIdempotent() { JPAEdmBuilder builder1 = objJPAEdmAssociationEnd.getBuilder(); JPAEdmBuilder builder2 = objJPAEdmAssociationEnd.getBuilder(); assertEquals(builder1.hashCode(), builder2.hashCode()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationEndBuilder(); } return builder; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
@Test public void testGetAssociationEnd1() { AssociationEnd associationEnd = objJPAEdmAssociationEnd .getEdmAssociationEnd1(); assertEquals(associationEnd.getType().getName(), "SOID"); }
|
@Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
@Test public void testGetAssociationEnd2() { AssociationEnd associationEnd = objJPAEdmAssociationEnd .getEdmAssociationEnd2(); assertEquals(associationEnd.getType().getName(), "String"); }
|
@Override public AssociationEnd getEdmAssociationEnd2() { return currentAssociationEnd2; }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd2() { return currentAssociationEnd2; } }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd2() { return currentAssociationEnd2; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd2() { return currentAssociationEnd2; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd2() { return currentAssociationEnd2; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
@Test public void testCompare() { assertTrue(objJPAEdmAssociationEnd.compare( getAssociationEnd("SOID", 1), getAssociationEnd("String", 1))); assertFalse(objJPAEdmAssociationEnd.compare( getAssociationEnd("String", 2), getAssociationEnd("SOID", 1))); }
|
@Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType()) && end1.getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd2.getMultiplicity())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals( currentAssociationEnd1.getType()) && end1.getMultiplicity().equals( currentAssociationEnd2.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()))) { return true; } return false; }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType()) && end1.getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd2.getMultiplicity())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals( currentAssociationEnd1.getType()) && end1.getMultiplicity().equals( currentAssociationEnd2.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()))) { return true; } return false; } }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType()) && end1.getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd2.getMultiplicity())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals( currentAssociationEnd1.getType()) && end1.getMultiplicity().equals( currentAssociationEnd2.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()))) { return true; } return false; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType()) && end1.getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd2.getMultiplicity())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals( currentAssociationEnd1.getType()) && end1.getMultiplicity().equals( currentAssociationEnd2.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()))) { return true; } return false; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public boolean compare(final AssociationEnd end1, final AssociationEnd end2) { if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType()) && end1.getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd2.getMultiplicity())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals( currentAssociationEnd1.getType()) && end1.getMultiplicity().equals( currentAssociationEnd2.getMultiplicity()) && end2 .getMultiplicity().equals( currentAssociationEnd1.getMultiplicity()))) { return true; } return false; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
@Test public void testBuildAssociationEnd() { assertEquals("SOID", objJPAEdmAssociationEnd.getEdmAssociationEnd1().getType().getName()); assertEquals(new FullQualifiedName("salesorderprocessing", "SOID"), objJPAEdmAssociationEnd.getEdmAssociationEnd1().getType()); assertTrue(objJPAEdmAssociationEnd.isConsistent()); }
|
@Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
JPAEdmAssociationEndView { @Override public AssociationEnd getEdmAssociationEnd1() { return currentAssociationEnd1; } JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView); @Override JPAEdmBuilder getBuilder(); @Override AssociationEnd getEdmAssociationEnd1(); @Override AssociationEnd getEdmAssociationEnd2(); @Override boolean compare(final AssociationEnd end1, final AssociationEnd end2); @Override String getJoinColumnName(); @Override String getJoinColumnReferenceColumnName(); @Override String getMappedByName(); @Override String getOwningPropertyName(); }
|
@Test public void testName() { Employee employee1 = new Employee(1, VALUE_NAME); assertEquals(VALUE_NAME, employee1.getEmployeeName()); }
|
public String getEmployeeName() { return employeeName; }
|
Employee { public String getEmployeeName() { return employeeName; } }
|
Employee { public String getEmployeeName() { return employeeName; } Employee(final int employeeId, final String name); }
|
Employee { public String getEmployeeName() { return employeeName; } Employee(final int employeeId, final String name); String getId(); void setEmployeeName(final String employeeName); String getEmployeeName(); void setAge(final int age); int getAge(); void setManager(final Manager manager); Manager getManager(); void setTeam(final Team team); Team getTeam(); void setRoom(final Room room); Room getRoom(); void setImageUri(final String imageUri); String getImageUri(); void setLocation(final Location location); Location getLocation(); void setEntryDate(final Calendar date); Calendar getEntryDate(); void setImageType(final String imageType); String getImageType(); void setImage(final byte[] image); void setImage(final String imageUrl); byte[] getImage(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
Employee { public String getEmployeeName() { return employeeName; } Employee(final int employeeId, final String name); String getId(); void setEmployeeName(final String employeeName); String getEmployeeName(); void setAge(final int age); int getAge(); void setManager(final Manager manager); Manager getManager(); void setTeam(final Team team); Team getTeam(); void setRoom(final Room room); Room getRoom(); void setImageUri(final String imageUri); String getImageUri(); void setLocation(final Location location); Location getLocation(); void setEntryDate(final Calendar date); Calendar getEntryDate(); void setImageType(final String imageType); String getImageType(); void setImage(final byte[] image); void setImage(final String imageUrl); byte[] getImage(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); }
|
@Test public void testGetBuilder() { assertNotNull(objAssociation.getBuilder()); }
|
@Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationBuilder(); } return builder; }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationBuilder(); } return builder; } }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationBuilder(); } return builder; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationBuilder(); } return builder; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public JPAEdmBuilder getBuilder() { if (builder == null) { builder = new JPAEdmAssociationBuilder(); } return builder; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
@Test public void testGetEdmAssociation() { assertNotNull(objAssociation.getEdmAssociation()); assertEquals(objAssociation.getEdmAssociation().getName(), ASSOCIATION_NAME); }
|
@Override public Association getEdmAssociation() { return currentAssociation; }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public Association getEdmAssociation() { return currentAssociation; } }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public Association getEdmAssociation() { return currentAssociation; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public Association getEdmAssociation() { return currentAssociation; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public Association getEdmAssociation() { return currentAssociation; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
@Test public void testGetConsistentEdmAssociationList() { assertTrue(objAssociation.getConsistentEdmAssociationList().size() > 0); }
|
@Override public List<Association> getConsistentEdmAssociationList() { return consistentAssociatonList; }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public List<Association> getConsistentEdmAssociationList() { return consistentAssociatonList; } }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public List<Association> getConsistentEdmAssociationList() { return consistentAssociatonList; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public List<Association> getConsistentEdmAssociationList() { return consistentAssociatonList; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public List<Association> getConsistentEdmAssociationList() { return consistentAssociatonList; } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
@Test public void testAddJPAEdmAssociationView() { class LocalJPAAssociationView extends JPAEdmTestModelView { @Override public AssociationEnd getEdmAssociationEnd1() { AssociationEnd associationEnd = new AssociationEnd(); associationEnd.setType(new FullQualifiedName( "salesorderprocessing", "SalesOrderHeader")); associationEnd.setRole("SalesOrderHeader"); associationEnd.setMultiplicity(EdmMultiplicity.ONE); return associationEnd; } @Override public AssociationEnd getEdmAssociationEnd2() { AssociationEnd associationEnd = new AssociationEnd(); associationEnd.setType(new FullQualifiedName( "salesorderprocessing", "SalesOrderItem")); associationEnd.setRole("SalesOrderItem"); associationEnd.setMultiplicity(EdmMultiplicity.MANY); return associationEnd; } @Override public Association getEdmAssociation() { Association association = new Association(); association.setEnd1(new AssociationEnd() .setType(new FullQualifiedName("salesorderprocessing", "SalesOrderHeader"))); association.setEnd2(new AssociationEnd() .setType(new FullQualifiedName("salesorderprocessing", "SalesOrderItem"))); return association; } } LocalJPAAssociationView assocViewObj = new LocalJPAAssociationView(); JPAEdmAssociation objLocalAssociation = new JPAEdmAssociation( assocViewObj, assocViewObj, assocViewObj, 1); try { objLocalAssociation.getBuilder().build(); } catch (ODataJPARuntimeException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } catch (ODataJPAModelException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } objAssociation.addJPAEdmAssociationView(objLocalAssociation, localView); }
|
@Override public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) { if (associationView != null) { currentAssociation = associationView.getEdmAssociation(); associationMap .put(currentAssociation.getName(), currentAssociation); associationEndMap.put(currentAssociation.getName(), associationEndView); addJPAEdmRefConstraintView(associationView .getJPAEdmReferentialConstraintView()); } }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) { if (associationView != null) { currentAssociation = associationView.getEdmAssociation(); associationMap .put(currentAssociation.getName(), currentAssociation); associationEndMap.put(currentAssociation.getName(), associationEndView); addJPAEdmRefConstraintView(associationView .getJPAEdmReferentialConstraintView()); } } }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) { if (associationView != null) { currentAssociation = associationView.getEdmAssociation(); associationMap .put(currentAssociation.getName(), currentAssociation); associationEndMap.put(currentAssociation.getName(), associationEndView); addJPAEdmRefConstraintView(associationView .getJPAEdmReferentialConstraintView()); } } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) { if (associationView != null) { currentAssociation = associationView.getEdmAssociation(); associationMap .put(currentAssociation.getName(), currentAssociation); associationEndMap.put(currentAssociation.getName(), associationEndView); addJPAEdmRefConstraintView(associationView .getJPAEdmReferentialConstraintView()); } } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
JPAEdmAssociation extends JPAEdmBaseViewImpl implements
JPAEdmAssociationView { @Override public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) { if (associationView != null) { currentAssociation = associationView.getEdmAssociation(); associationMap .put(currentAssociation.getName(), currentAssociation); associationEndMap.put(currentAssociation.getName(), associationEndView); addJPAEdmRefConstraintView(associationView .getJPAEdmReferentialConstraintView()); } } JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
final JPAEdmEntityTypeView entityTypeView,
final JPAEdmPropertyView propertyView, final int value); JPAEdmAssociation(final JPAEdmSchemaView view); @Override JPAEdmBuilder getBuilder(); @Override Association getEdmAssociation(); @Override List<Association> getConsistentEdmAssociationList(); @Override Association searchAssociation(final JPAEdmAssociationEndView view); @Override void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
final JPAEdmAssociationEndView associationEndView); @Override void addJPAEdmRefConstraintView(
final JPAEdmReferentialConstraintView refView); @Override JPAEdmReferentialConstraintView getJPAEdmReferentialConstraintView(); @Override int getNumberOfAssociationsWithSimilarEndPoints(
final JPAEdmAssociationEndView view); }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.