Aug 25, 2011

Api Design: Key vs Session

During discussion of our new API an question come up, why session is better than a simple key.
Session concept is to have per connection object with details on customer, it's preferences, etc.
Key concept is to have passive key and number of services that uses it.
I came up with following:
Session Key
Holds request specific data Need to hold request specific data in api objects
More agile approach, you can make you session active, have one master instance for actions or session-specific actors Managing class and a collection of keys are needed for two way communication
Visible list of services available You should knew about service existence before use it
It's complex to fake system It's easy to confuse keys
It's subject to update. Please place you thoughts about it.

Aug 21, 2011

Legacy system development

If you're like me, then you probably faced developing new features for legacy systems (system with no test coverage) without full understanding of source. I've done this a couple times, and want to share lessons learnt:

Legacy documentation

There are 3 sources of information about system - experienced colleagues, documentation(if exists, including javadocs and tests) and source. Fact is, you should not trust first two and use them only to understand third.
Colleagues may forget smth or think of it as of obvious thing. Tests, if they exists may be incorrect or deprecated. If documentation isn't a part of delivery, noone bothers keeping it up-to-date.

Development surroundings

Most likely new development will introduce bugs. Mine does. But not in feature you're working on. It will be some other functionality, linked with yours.
So, you need to recheck code you're depending on and recheck code, that depends on your new logic.

Also requirements is important - if you haven't understand them, you will not deliver valuable feature.

Summary

  • Use all information you can get, but dont rely on it
  • Only reliable source of information - code
  • Check and recheck code you're depending on and code that depends on your's code
  • Understand your requirements

Jun 25, 2011

JMeter and SLAMD for load test's in plain Java

This is article about my experience developing simple load (performance) test's for our app. 2 most famous tools were analysed: SLAMD and JMeter.

Criteria



SLAMD



Jmeter



Comments



Parameters



+



+



Ability of systems to pass parameters to Java Jobs



Distributes support



Web



Lan



How client/server communication is organized



GUI



Web



Java(bugged, see explanations)



Jmeter GUI haven't allowed my custom classes to execute. Command line
worked perfectly fine



Test Plan support



No



Yes



Jmeter has more abilities for test cases creation



Test Data support



Normall



Advanced



Jmeter: CSV file native support, advanced parameters.



Documented



Good



Norm



 



Sources



Available



Available



 



Main Goal



LDAP



Web



 



Reporting



Advanced



Normall



SLAMD has more reporting facilities than Jmeter (Timers, Counters,
internal stuff).



Reporting formats



plain, HTML, PDF



Visual, XML.



 



Test plan format



server internal



Xml



We can see Jmeter test plan as xml and customise it.




Jan 25, 2011

Windows: how to repartition or create new disk

My Computer (right click) Manage.
In the window Storage -> Disc Management.
For me and for other's folks without memory.

Jan 19, 2011

NT Аутентификации java приложений и tomcat с базой данных Oracle 10g

Добавление функциональности для NT Аутентификации java приложений и tomcat с базой данных Oracle 10?g.
Шаги:
1. Настроить Oracle так, чтобы он понимал Os Autentification.
Для этого:
1.0. Будут активно использованы следующие параметры:
REMOTE_OS_AUTHENT,os_authent_prefix.
Они достаются запросом: show parameter os_authent;(пользователь SYSTEM)
1.1. Установим значение флага в базе : REMOTE_OS_AUTHENT=TRUE;
Полезная ссылка: http://all-oracle.ru/content/view/?part=1&id=99
1.2. Создаём пользователя, используя? код:
CREATE USER "OPS$DOMAIN\USER" IDENTIFIED EXTERNALLY;

Надо заменить домен (DOMAIN) и пользователя (USER) на данные того, из-под кого запускается приложение. Внимание, всё вводить в верхнем регистре.
Полезная ссылка: http://www.oracle-base.com/articles/misc/OsAuthentication.php
1.3. Теперь должно работать, для проверки можно выполнить(локально): sqlplus /@SID.
Должно зайти, не спрашивая пароля и имени пользователя.
2. Установить InstantClient и добавить его в PATH и java.library.path.
Ссылка для скачивания:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
3. Tomcat: Изменить запись в server.xml c такой:

< resource auth="Container" driverclassname="oracle.jdbc.OracleDriver" name="jdbc/DB" password="password" type="javax.sql.DataSource" url="jdbc:oracle:thin:@host:1521:SID" username="username" maxidle="0"></resource>

на

< resource auth="Container" driverclassname="oracle.jdbc.OracleDriver" name="jdbc/AMTDB" type="javax.sql.DataSource" url="jdbc:oracle:oci:@host:1521:SID" maxidle="0"></resource>

т.е. удалить имя пользователя и пароль, заменив в URL thin на oci.
Java:

String url = "jdbc:oracle:oci:/@172.30.38.182:1521:amt";
Driver driver = new oracle.jdbc.OracleDriver();
DriverManager.registerDriver(driver);
Properties props = new Properties();
Connection conn = DriverManager.getConnection( url, props);

4. Profit!