id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
1e016693-5b90-4402-8aa8-d3380d0e3b60 | @Override
public void teardownTest(JavaSamplerContext context) {
super.teardownTest(context);
try {
if (table != null) {
table.flushCommits();
table.close();
table = null ;
}
} catch (IOException e) {
System.out.println("teardown error");
}
} |
cda82e28-6724-4efe-9002-1a9aca166a4a | private JMeterHTablePool(Configuration config, int poolsize,byte[] tableName, final boolean autoFlush,final long writeBufferSize) {
tablePool = new HTablePool(config, poolsize, new HTableFactory() {
@Override
public HTableInterface createHTableInterface(Configuration config,
byte[] tableName) {
try {
HTable hTable = new HTable(config, tableName);
hTable.setAutoFlush(autoFlush);
hTable.setWriteBufferSize(writeBufferSize);
return hTable;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
} |
502fc4c0-021a-4b40-a83b-16b1bbb9deff | @Override
public HTableInterface createHTableInterface(Configuration config,
byte[] tableName) {
try {
HTable hTable = new HTable(config, tableName);
hTable.setAutoFlush(autoFlush);
hTable.setWriteBufferSize(writeBufferSize);
return hTable;
} catch (IOException e) {
throw new RuntimeException(e);
}
} |
4f21297a-e8f2-413a-b9cd-e582cbabcef1 | public static JMeterHTablePool getinstancePool(Configuration config,
int poolSize, byte[] tableName, final boolean autoFlush,
final long writeBufferSize) {
if (instancePool == null) {
synchronized (JMeterHTablePool.class) {
if(instancePool == null ){
System.out.println("Pool instance");
instancePool = new JMeterHTablePool(config, poolSize, tableName, autoFlush,
writeBufferSize);
}
}
}
return instancePool;
} |
0f958c32-3d5b-4636-9c31-202de022ae23 | @SuppressWarnings("deprecation")
public synchronized void flush(String tableName) throws IOException {
HTableInterface hTable = tablePool.getTable(tableName);
try {
hTable.flushCommits();
} finally {
if (hTable != null) {
tablePool.putTable(hTable);
}
}
} |
7613f78e-baf7-4d53-afa0-92d33bf32657 | public synchronized void close() throws IOException {
tablePool.close();
} |
ca6b32a9-cc98-4f03-9a32-b95c24967b7b | public synchronized void close(String tableName) throws IOException {
tablePool.closeTablePool(tableName.getBytes());
} |
12ee3e79-a468-4136-8a16-23234c698329 | @Override
public void setupTest(JavaSamplerContext context) {
super.setupTest(context);
if (table == null) {
String tableName = context.getParameter("tableName");
byte[] tableNamebyte = tableName.getBytes();
boolean autoFlush = Boolean.valueOf(context.getParameter("autoFlush"));
long writeBufferSize = Long.valueOf(context.getParameter("writeBufferSize"));
int poolSize = Integer.parseInt(context.getParameter("poolSize"));
try {
table = JMeterHTablePool.getinstancePool(conf,poolSize,tableNamebyte,autoFlush,writeBufferSize).tablePool.getTable(tableName);
} catch (Exception e) {
System.out.println("htable pool error");
}
}
if( methedType == null ){
methedType = context.getParameter("putOrget");
}
if( keyNumLength == 0){
keyNumLength = Integer.parseInt(context.getParameter("keyNumLength"));
}
if(cfs == null){
String cf = context.getParameter("cf");
cfs = cf.split(",");
}
if( qualifiers == null ){
String qualifier = context.getParameter("qualifier");
qualifiers = qualifier.split(",");
}
if( values == null ){
String valueLength = context.getParameter("valueLength");
values = Strings.repeat('v', Integer.parseInt(valueLength));
}
if( writeToWAL == true ){
writeToWAL = Boolean.valueOf(context.getParameter("writeToWAL"));
}
} |
4142391b-e473-40fc-9ff1-68b389643f12 | public SampleResult runTest(JavaSamplerContext context) {
SampleResult sampleResult = new SampleResult();
sampleResult.sampleStart();
String key = String.valueOf(String.valueOf(new Random().nextInt(keyNumLength)).hashCode());
try {
if (methedType.equals("put")) {
put = new Put(Bytes.toBytes(key));
put.setWriteToWAL(writeToWAL);
for (int j = 0; j < cfs.length; j++) {
for (int n = 0; n < qualifiers.length; n++) {
put.add(Bytes.toBytes(cfs[j]),
Bytes.toBytes(qualifiers[n]),
Bytes.toBytes(values));
table.put(put);
}
}
} else if (methedType.equals("get")) {
get = new Get((key ).getBytes());
Result rs = table.get(get);
}
sampleResult.setSuccessful(true);
} catch (Throwable e) {
sampleResult.setSuccessful(false);
} finally {
sampleResult.sampleEnd();
}
// // θΏεζ―ε¦ε€ηζε
return sampleResult;
} |
72476995-c851-4529-a61b-d5fb1f2d0654 | @Override
public Arguments getDefaultParameters() {
Arguments params = new Arguments();
params.addArgument("putOrget", "put");
params.addArgument("keyNumLength", "5");
params.addArgument("valueLength", "1000");
params.addArgument("cf", "cf");
params.addArgument("qualifier", "a");
params.addArgument("tableName","test");
params.addArgument("autoFlush","false");
params.addArgument("writeBufferSize","2097152");
params.addArgument("writeToWAL","true");
params.addArgument("poolSize","500");
return params;
} |
2bf308f0-9919-49ac-8344-1b80cc3bca80 | @Override
public void teardownTest(JavaSamplerContext context) {
super.teardownTest(context);
try {
if (table != null) {
table.flushCommits();
table.close();
table = null ;
}
} catch (IOException e) {
System.out.println("teardown error");
}
} |
9700a211-8353-4b4f-93bb-32f325943ef1 | public Sexo() {
} |
5ed0712e-8dc1-4a18-9eb3-56db27df0115 | public Integer getIdsexo() {
return idsexo;
} |
e1677eac-04d9-4668-be1b-5bf1d267571e | public void setIdsexo(Integer idsexo) {
this.idsexo = idsexo;
} |
d4434e73-2403-4d78-b6a7-a207b3c02201 | public String getDescricao() {
return descricao;
} |
32abf997-fff5-4d52-984f-c03f94ac2d0e | public void setDescricao(String descricao) {
this.descricao = descricao;
} |
72ea6471-bdfa-46b6-a18c-2fe3ad187c0d | public List<Pessoa> getPessoas() {
return pessoas;
} |
97d68b2d-68a3-4808-8d08-2e3fd45cba35 | public void setPessoas(List<Pessoa> pessoas) {
this.pessoas = pessoas;
} |
37b27d0e-6d6e-4eab-b5af-06ff850dfe41 | @Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + Objects.hashCode(this.idsexo);
return hash;
} |
45ff9172-045a-46fd-b378-0b8d94052e2e | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Sexo other = (Sexo) obj;
if (!Objects.equals(this.idsexo, other.idsexo)) {
return false;
}
return true;
} |
6af74705-87d3-4d8d-842f-7195300a2934 | public Pessoa() {
} |
27170965-ef58-45d2-ba7d-36d8dc6f36dd | public Integer getIdPessoa() {
return idPessoa;
} |
acfee0b5-a409-4954-8919-04e9bf90881e | public void setIdPessoa(Integer idPessoa) {
this.idPessoa = idPessoa;
} |
24c622d2-bc7b-431e-bf84-23804c71ef94 | public String getNome() {
return nome;
} |
f4668b10-5a0a-4c1e-b5e6-902d63b512a4 | public void setNome(String nome) {
this.nome = nome;
} |
aa33dc47-0a5b-4c71-9647-a84524c00fdc | public String getEmail() {
return email;
} |
2cffc649-8137-4bca-acee-d50cb8af27d4 | public void setEmail(String email) {
this.email = email;
} |
d3ba523c-0b84-4ac8-bb5b-c2e5fa7d416a | public String getTelefone() {
return telefone;
} |
e3076066-0e0e-47b8-bdc7-11564affc66a | public void setTelefone(String telefone) {
this.telefone = telefone;
} |
2d19556f-7977-4f00-84a1-82c104e70ffc | public String getCpf() {
return cpf;
} |
544fd384-7617-419f-ad30-fa494ad14586 | public void setCpf(String cpf) {
this.cpf = cpf;
} |
d451f73c-39c0-4cca-95d8-3e9840ce185b | public Date getDataDeNascimento() {
return dataDeNascimento;
} |
7228ec6e-0d6d-4ce4-a386-4b89c63b8bc2 | public void setDataDeNascimento(Date dataDeNascimento) {
this.dataDeNascimento = dataDeNascimento;
} |
57080da0-bc38-4f99-9aa7-57531b67194c | public String getDataDeCadastro() {
return dataDeCadastro;
} |
20e9836a-7f9c-4de3-a96a-e7ed78b5544d | public void setDataDeCadastro(String dataDeCadastro) {
this.dataDeCadastro = dataDeCadastro;
} |
a85e5608-4808-4f43-a485-b2075aaf49bb | @Override
public int hashCode() {
int hash = 7;
hash = 19 * hash + Objects.hashCode(this.idPessoa);
return hash;
} |
20dc0b0a-1582-4384-a72f-bbd76fab0089 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Pessoa other = (Pessoa) obj;
if (!Objects.equals(this.idPessoa, other.idPessoa)) {
return false;
}
return true;
} |
7f09ba6b-a1db-4e9d-8b3b-a50b87dda96f | public HibernateDao(Class<T> classe, Session session) {
super();
this.classe = classe;
this.session = session;
} |
0cdafa45-71cd-4731-bbb5-747f30c73bf8 | @Override
public void save(T entity) {
session.save(entity);
} |
ec9bdddf-5440-4180-99e0-99492ff9df9c | @Override
public void remove(T entity) {
session.delete(entity);
} |
9436a666-9185-4718-b21d-5aede5c2b842 | @Override
public void update(T entity) {
session.update(entity);
} |
1eff0822-2c6e-49ff-9394-3115d5250a47 | @Override
public void merge(T entity) {
session.merge(entity);
} |
9edbf718-6e38-4fd8-8b94-d78c5c68aef7 | @Override
public T getEntity(Serializable id) {
T entity = (T)session.get(classe, id);
return entity;
} |
c3103541-f9d7-468e-b568-c73f2fa08231 | @Override
public T getEntitybyDetachedCriteria(DetachedCriteria criteria) {
T entity = (T)criteria.getExecutableCriteria(session).uniqueResult();
return entity;
} |
5e4d66e2-8217-4edd-ac31-6a6f82e1af72 | @Override
public List<T> getEntities() {
List<T> entities=(List<T>)session.createCriteria(classe).list();
return entities;
} |
ca7aa29e-b94c-41b8-95db-f1f7fe3e8852 | @Override
public List<T> getListEntitybyDetachedCriteria(DetachedCriteria criteria) {
return criteria.getExecutableCriteria(session).list();
} |
7410bf71-2f3c-4c2a-87d4-bb3688498da5 | void save(T entity); |
25df9f85-e9e7-476f-8fc0-31801297fb17 | void remove(T entity); |
670205a7-182e-4e2d-908c-dff5688e0556 | void update(T entity); |
bb8320de-cacf-483b-94a5-e46ad4d010a4 | void merge(T entity); |
85610d09-de3a-4397-989e-d4e585ac4f7c | T getEntity(Serializable id); |
b89c31d0-1a8e-42e2-9e26-5c9323cc200b | T getEntitybyDetachedCriteria(DetachedCriteria criteria); |
6886d50c-8399-4ba0-b1e7-674e2999df2d | List<T> getEntities(); |
999d7610-16bf-4a5e-bb65-11a8f0d0e9ee | List<T> getListEntitybyDetachedCriteria(DetachedCriteria criteria); |
664a4052-c618-45bc-a588-d91c981ac56a | public static void setRequestSession(Session session){
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put(HIBERNATE_SESSION, session);
} |
a479b8a2-6c1a-4e13-8fa9-90c961e8bd3a | public static Session getRequestSession() {
return (Session)FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(HIBERNATE_SESSION);
} |
244daac5-ab4b-4b08-8713-e3bf309aca36 | public static SessionFactory getSessionFactory() {
return sessionFactory;
} |
7c22e0b6-9fd8-4f06-a512-22bb1090b73b | @Override
public void afterPhase(PhaseEvent fase) {
if (fase.getPhaseId().equals(PhaseId.RESTORE_VIEW)) {
System.out.println("antes da fase: "+getPhaseId());
Session session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
FacesContextUtil.setRequestSession(session);
}
} |
3e2a585d-4604-4170-85ed-95bcfc1c9717 | @Override
public void beforePhase(PhaseEvent fase) {
System.out.println("Depois da fase: "+getPhaseId());
if(fase.getPhaseId().equals(PhaseId.RENDER_RESPONSE)){
Session session = FacesContextUtil.getRequestSession();
try {
session.getTransaction().commit();
} catch (Exception e) {
if(session.getTransaction().isActive()){
session.getTransaction().rollback();
}
}
finally{
session.close();
}
}
} |
b5ff86e3-5ef7-4859-90fd-4c1d82c26976 | @Override
public PhaseId getPhaseId() {
return PhaseId.ANY_PHASE;
} |
bc441f40-9cea-49cb-986b-a183827bd77e | public static void main(String[] args) {
int SIZE = 10;
int[] arry = new int[SIZE];
for (int i=0; i<SIZE; i++) {
arry[i] = getRandom(arry);
System.out.print(arry[i]+ " ");
}
new QuickSort().quickSort(0, SIZE-1, arry);
System.out.println("\nμ λ ¬ ν ");
for (int i=0; i<SIZE; i++) {
System.out.print(arry[i]+ " ");
}
} |
9c7d67b5-c3ae-4fe6-b334-9f4c8919f4b3 | public void quickSort(int left, int right, int[] arry) {
int i,j,tmp, pivot;
if (left < right) {
i = left;
j = right;
pivot = arry[left];
while (i < j) {
while (arry[j] > pivot) j--;
while (i < j && arry[i] <= pivot) i++;
tmp = arry[i];
arry[i] = arry[j];
arry[j] = tmp;
}
arry[left] = arry[i];
arry[i] = pivot;
quickSort(left, i-1, arry);
quickSort(i+1, right, arry);
}
} |
ee759d78-04e9-411e-8914-5d4c5cefcec7 | private static int getRandom(int[] arry) {
Random random = new Random();
int randomNum;
do {
randomNum = random.nextInt(100);
} while (isExist(arry, randomNum));
for (int i=0; i<arry.length; i++) {
if (arry[i] == randomNum) getRandom(arry);
}
return randomNum;
} |
9d0dedd7-7fc8-4ad5-a2ea-e1526fe8d6e1 | private static boolean isExist(int[] arry, int randomNum) {
for (int i=0; i < arry.length; i++) {
if (arry[i] == randomNum) return true;
}
return false;
} |
d8bb0e35-779d-4bc2-bec3-343313dc4dce | public Stack() {
this.top = 0;
data = new int[10];
this.dataSize = 10;
} |
ca992abe-fae6-41f1-bcee-707d7c2356f2 | public Stack(int size) {
this.top = 0;
data = new int[size];
this.dataSize = size;
} |
9320e25f-fb5d-418e-a7bf-4872d2730aa8 | public void push(int value) {
if (!isFull()) {
this.data[top++] = value;
} else {
System.out.println("μ€νμ΄ νμ
λλ€.");
}
} |
bc3fae0c-3dc1-4629-94d8-0419e5e71d81 | public int pop() {
if (!isEmpty()) {
top--;
return data[top];
}
System.out.println("μ€νμ΄ λΉμ΄μμ΅λλ€.");
return 0;
} |
d8d9755b-b3cb-412f-a388-ae7c3ceae118 | private boolean isEmpty() {
return (top == 0);
} |
f93b9358-f95f-41a1-a2ea-c47f07285e77 | private boolean isFull() {
return (this.top == dataSize - 1);
} |
4a54a321-1999-4f57-b2a2-11e71de74058 | public static void main(String[] args) {
} |
17bc0471-846f-47eb-969e-d17fd9db2a22 | public SocialUser(long l) {
this.userNum = l;
} |
6eb2d160-4833-47a4-b2aa-ee25b1818633 | public boolean isSameUser(String guestUser) {
return false;
} |
7a89e7fc-aadf-4d8c-b68c-ec266df12e3f | public boolean isSameUser(SocialUser loginUser) {
return loginUser.getUserNum() == this.userNum;
} |
92669c00-a11d-4172-ba0a-7c70c9b76d99 | public long getUserNum() {
return userNum;
} |
6e40f56a-68c6-4cf2-ac7f-e80c9b3cc586 | public void setUserNum(long userNum) {
this.userNum = userNum;
} |
268d39eb-bc0d-4516-8bc3-4f3280bb064f | public SocialUser findByUserId(String userId); |
50399e2b-3f07-4aaa-8a4f-6457dc54d8a8 | public SocialUser findByEmailAndProviderId(String email,
ProviderType providerType); |
3566f3c5-6853-4d03-a379-77f0bdcfb319 | public static void main(String[] args) {
int primaryCnt= 0;
int totalCnt = 0;
boolean isPrimary = true;
for (int i=2; i<=100; i++) {
for (int j=2; j<=i-1; j++) {
if ((i % j) == 0) {
isPrimary = false;
continue;
}
}
if (isPrimary) {
System.out.println("primary number ===>" + i);
primaryCnt++;
}
isPrimary = true;
totalCnt++;
}
System.out.println("total cnt=====>"+totalCnt);
System.out.println("total primary number=====>"+primaryCnt);
} |
6c307387-a610-4d02-8c47-304a14a445f3 | boolean required(); |
81597c11-cef2-48fe-b610-ff6093b9e3a4 | @RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
Date date = new Date();
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
String formattedDate = dateFormat.format(date);
model.addAttribute("serverTime", formattedDate );
return "home";
} |
d4b5c031-b3f3-4214-9dc5-0d6b4c2ea87a | @RequestMapping("/duplicate_userid")
public @ResponseBody String duplicateUserId(@LoginUser(required = false) SocialUser loginUser, String userId) {
log.debug("userId : {}", userId);
SocialUser socialUser = userService.findByUserId(userId);
if (socialUser == null) {
return "false";
}
if (socialUser.isSameUser(loginUser)) {
return "false";
}
return "true";
} |
f76c891b-583c-4e00-8ab6-8d23820ea47c | @RequestMapping("/duplicate_email")
public @ResponseBody String duplicateEmail(@LoginUser(required = false) SocialUser guestUser, String email,
ProviderType providerType) {
log.debug("email : {}", email);
SocialUser socialUser = userService.findByEmailAndProviderId(email, providerType);
if (socialUser == null) {
return "false";
}
if (socialUser.isSameUser(guestUser)) {
return "false";
}
return "true";
} |
981d89ff-b19d-4dab-9772-9a8cab05b607 | public static void main(String args[]) {
SortedSet<Integer> pickedNumber = new TreeSet<Integer>();
Random random = new Random();
while (pickedNumber.size() < 6) pickedNumber.add(random.nextInt(45)+1);
System.out.println("lotto number is " + pickedNumber);
} |
743eb927-3047-4ab9-b29d-7a453bef6d2c | @Test
public void testPush() {
Stack stack = new Stack();
stack.push(10);
stack.push(15);
stack.push(21);
assertThat(stack.pop(), is(21));
assertThat(stack.pop(), is(15));
assertThat(stack.pop(), is(10));
assertThat(stack.pop(), is(0));
} |
d44d2967-8b1e-41b9-bb8a-422255343e9a | @Test
public void duplicateUserId_login_isSameUser() {
String userId = "userId";
SocialUser loginUser = new SocialUser(1L);
when(userService.findByUserId(userId)).thenReturn(loginUser);
String actual = dut.duplicateUserId(loginUser, userId);
assertThat(actual, is("false"));
} |
0f21477e-be61-4817-8f77-74760fc54a9f | @Test
public void duplicateUserId_login_isNotSameUser() {
String userId = "userId";
SocialUser loginUser = new SocialUser(1L);
when(userService.findByUserId(userId)).thenReturn(loginUser);
String actual = dut.duplicateUserId(new SocialUser(2L), userId);
assertThat(actual, is("true"));
} |
cba830b9-db5a-4ba1-bb31-2d8cdd1df6aa | @Test
public void duplicateEmail_doesnot_existed() {
String actual = dut.duplicateEmail(new SocialUser(1L), "userId", ProviderType.slipp);
assertThat(actual, is("false"));
} |
23549847-b6e6-4763-9c2e-555bb0beae01 | @Test
public void duplicateEmail_login_isSameUser() {
String email = "email@slipp.net";
ProviderType providerType = ProviderType.slipp;
SocialUser loginUser = new SocialUser(1L);
when(userService.findByEmailAndProviderId(email, providerType)).thenReturn(loginUser);
String actual = dut.duplicateEmail(loginUser, email, providerType);
assertThat(actual, is("false"));
} |
2d9c7254-524d-4f54-96ef-a8b458e86cf3 | @Test
public void duplicateEmail_login_isNotSameUser() {
String email = "email@slipp.net";
ProviderType providerType = ProviderType.slipp;
SocialUser loginUser = new SocialUser(1L);
when(userService.findByEmailAndProviderId(email, providerType)).thenReturn(loginUser);
String actual = dut.duplicateEmail(new SocialUser(2L), email, providerType);
assertThat(actual, is("true"));
} |
95bf2165-4dd5-4269-915a-7cd8bba46f8f | @Test
public void testSort() {
QuickSort quickSort = new QuickSort();
int arry[] = new int [] {3, 21, 53, 34, 28, 11, 4, 19, 5, 10 };
quickSort.quickSort(0, arry.length-1, arry);
int result[] = new int [] {3, 4, 5, 10, 11, 19, 21, 28, 34, 53 };
for (int i=0; i < arry.length; i++) {
assertThat(arry[i], is(result[i]));
}
} |
fc6dc760-cca6-442a-a4e1-e283a16e6111 | protected Bier(){
} |
2105e571-7f7c-40ec-8890-34e8eff27104 | public long getBierNr() {
return bierNr;
} |
6467c04b-bca0-4203-b068-4bbed6a3615a | public String getNaam() {
return naam;
} |
711691e0-796b-498c-b49b-b2d87caf4731 | public BigDecimal getAlcohol() {
return alcohol;
} |
ac8fe0d8-e46a-48ee-b1b2-00486b0db9a6 | public BigDecimal getPrijs() {
return prijs;
} |
a1c74440-4bbe-4995-abcd-69bb756a25bf | public Soort getSoort() {
return soort;
} |
27e495ff-56c8-4df7-9bfe-cad0d7423119 | public Brouwer getBrouwer() {
return brouwer;
} |
1c8c7791-0b4b-47d9-b9d2-60d080fa03c4 | @Override
public boolean equals(Object object){
if(!(object instanceof Bier)){
return false;
}
else{
Bier anderBier = (Bier) object;
return(naam.equals(anderBier.getNaam()) &&
brouwer.getNaam().equals(anderBier.getBrouwer().getNaam()));
}
} |
b5ec1827-f043-44ff-af9a-6c0c8aa6d0dc | @Override
public int hashCode() {
String hashCode = naam+brouwer.getNaam();
return hashCode.hashCode();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.