Skip to content

Instantly share code, notes, and snippets.

View milenkovicm's full-sized avatar
👨‍🍳

Marko Milenković milenkovicm

👨‍🍳
View GitHub Profile
@milenkovicm
milenkovicm / WarSmokeTest.java
Created March 14, 2012 11:42
[Junit] Arquillian - how to export shrinkwrap archive
@RunWith(Arquillian.class)
public class WarSmokeTest {
@Deployment
public static Archive<?> createTestArchive() {
final MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");
final WebArchive archive = ShrinkWrap.create(WebArchive.class)
.addAsWebInfResource("META-INF/beans.xml")
///
@milenkovicm
milenkovicm / BeansXmlTest.java
Created March 12, 2012 11:54
[Junit] Arquillian - use of @ShouldThrowException(Exception.class) at @deployment method
package org.jboss.weld.tests.xml.broken.stereotype;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.BeanArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Test;
import org.junit.runner.RunWith;
@milenkovicm
milenkovicm / AnEasyMockTestClass.java
Created March 12, 2012 00:00
[Junit] EasyMock - few examples, how to use it
package acme;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.easymock.Capture;
import org.easymock.EasyMock;
import org.junit.AfterClass;
import org.junit.Before;
@milenkovicm
milenkovicm / eclipse_preferences_linux.epf
Created March 11, 2012 18:29
[eclipse] settings - user preference for fedora linux
#Sun Mar 11 18:21:01 GMT 2012
/instance/org.eclipse.jdt.ui/sp_cleanup.always_use_parentheses_in_expressions=false
/instance/org.eclipse.team.ui/org.eclipse.team.ui.first_time=false
/instance/org.eclipse.jdt.ui/cleanup.add_default_serial_version_id=false
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
/instance/org.eclipse.wst.xml.xpath.ui/org.eclipse.wst.xml.xpath.ui.xpath_custom_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
/instance/org.jboss.tools.jsf.ui/Use\ Large\ Icons\ -\ Columns=false
/instance/org.jboss.ide.eclipse.archives.ui/showProjectRoot=true
/instance/org.eclipse.jdt.ui/sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
@milenkovicm
milenkovicm / eclipse_template_file.xml
Created March 10, 2012 16:54
[eclipse] settings - java file template with MIT license header
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/*
* Copyright (c) 2012 Marko Milenkovic
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@milenkovicm
milenkovicm / eclipse_formater.xml
Created March 10, 2012 16:53
[eclipse] settings - java code formater
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="MM_eclipse" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
@milenkovicm
milenkovicm / eclipse_cleanup.xml
Created March 10, 2012 16:53
[eclipse] settings - java code cleanup
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2">
<profile kind="CleanUpProfile" name="MM_eclipse" version="2">
<setting id="cleanup.remove_unused_private_fields" value="true"/>
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
<setting id="cleanup.never_use_blocks" value="false"/>
<setting id="cleanup.remove_unused_private_methods" value="true"/>
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
@milenkovicm
milenkovicm / LoggerProducer.java
Created March 6, 2012 14:18
[Java] CDI - Slf4j Logger Producer
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Singleton
public class LoggerProducer {
@milenkovicm
milenkovicm / pom.xml
Created March 5, 2012 15:03
[mvn] pom - my multiple test profiles
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>integration</artifactId>
<groupId>xxxx</groupId>
<version>1.0.2-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>jee</artifactId>
@milenkovicm
milenkovicm / pom.xml
Created February 24, 2012 22:46
[mvn ] pom - pom.xml with multiple arquillian profiles
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>weld-core-parent</artifactId>
<groupId>org.jboss.weld</groupId>
<version>1.1.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-test-arquillian</artifactId>